我正在按照这个教程为我的网站开发项目build立一个testing服务器。
当我尝试设置一个静态IP地址(使用下面的configuration)时,我尝试使用ping时收到错误“ping:unknown host www.google.com”。
auto eth0 iface eth0 inet static address 192.168.0.100 netmask 255.255.255.0 network 192.168.0.0 broadcast 192.168.0.255 gateway 192.168.0.1
当configuration如下时,Ping工作正常:
auto eth0 iface eth0 inet dhcp
我是服务器设置和pipe理的新手。
这是根据要求从/sbin/ifconfig eth0的输出:
eth0 Link encap:Ethernet HWaddr 00:08:a1:0d:93:a1 inet addr:192.168.0.100 Bcast:192.168.0.255 Mask:255.255.255.0 inet6 addr: fe80::208:a1ff:fe0d:93a1/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:69 errors:0 dropped:0 overruns:0 frame:0 TX packets:303 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:9323 (9.3 KB) TX bytes:12240 (12.2 KB) Interrupt:21 Base address:0xd800
route -n输出route -n :
Kernal IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 0.0.0.0 192.168.0.1 0.0.0.0 UG 100 0 0 eth0
来自/etc/resolv.conf DNS信息:
nameserver 192.168.1.1 nameserver 71.242.0.12 domain home search home
你运行/etc/init.d/networking restart吗?
你也可以这样做:
/sbin/ifconfig eth0 192.168.0.100 netmask 255.255.255.0 up /sbin/route add default gw 192.168.0.1 eth0
这应该调出eth0,并允许您尝试ping事情,如果重新启动networking失败