1.修改/etc/network/interfaces
# The primary network interface
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.1.100
gateway 192.168.1.1
netmask 255.255.255.0
dns-nameservers 8.8.8.8
2. 打开配置文件sudo vi /etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4
nameserver 192.168.40.1
domain localdomain
search localdomain
3.修改完毕后重启网络:sudo /etc/init.d/networking restart
发现问题ubuntu10.04必须写回环配置,否则开机mysql起不来,ubuntu12.04不写下面两句话也可以
auto lo
iface lo inet loopback