我有一个Ubuntu服务器,但无法通过此服务器建立Internet连接。我所获得的IP,子网,网关和2个DNS服务器是我必须放入的标准地址。我将提供详细信息:
1)
ping 8.8.8.8
退货
Network is unreachable
2)
sudo nano /etc/network/interfaces
被设定为
#The loopback network interface
auto lo
iface lo inet loopback
#The primary network interface
#auto eth0 <-- this is a comment
iface eth0 inet static
address "My_static_ip_here"
netmask 255.255.255.0
gateway "My_Gateway_here"
3)
sudo nano /etc/resolve.conf
被设定为
nameserver "My_DNS_server_1_here"
nameserver "My_DNS_server_2_here"
最后, ifconfig
在lo上返回127.0.0.1地址和一个子网255.0.0.0,由于我的限制,在此我无法给出详细的ifconfig信息。PS:这是我正在使用的虚拟机。PS2:我尝试使用iface eth0 inet dhcp对其进行自动dhcp,但是在网络重新启动期间,它会一直加载并永远加载,因此无法正常工作,我想提供此静态IP。
试试这个:
将DNS服务器放在中/etc/network/interfaces
,而不是/etc/resolv.conf
在静态配置的底部添加此行
dns-nameservers 208.67.222.222 208.67.220.220 #OpenDNS' servers as example
然后在终端中运行这些命令以重新启动接口。
sudo su
ifdown eth0 && ifup eth0
希望这行得通!
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句