昨天晚上还可以,早上来了就不可以了,研究了一阵子,发现原因是ubuntu的网络管理工具network manager的一个bug。
解决方法:
第一步:卸载络管理工具,sudo apt-get remove network manager.
第二步:在/etc/network/interfaces中增加以下内容
iface eth0 inet static //eth0表示第一块网卡,如果是第二块网卡,就是eth1
address 192.168.1.244 //ip地址
netmask 255.255.255.0
broadcast 192.168.1.255
gateway 192.168.1.1 //.网关地址
auto eth0 www.baidu.com
第三步:在/etc/resolv.conf中增加如下内容,
nameserver 192.168.1.1
nameserver 202.117.128.2
第四步:执行 sudo /etc/init.d/networking restart
done