1. modify /etc/networks/interfaces as follow.
****************************************************************************************
auto lo
iface lo inet loopback
#net card eth0 configuration
auto eth0
iface eth0 inet static
#set static ip
address 192.168.1.108
netmask 255.255.255.0
gateway 192.168.1.1
#dns-nameservers 8.8.8.8
#network 192.168.1.0
#boardcast 192.168.1.255
****************************************************************************************
2. modify /etc/resolvconf/resolv.conf.d/head as follow.
****************************************************************************************
nameserver 202.96.128.86
****************************************************************************************
the below 3 lines was ok before:
search mydomain.com
nameserver 61.139.39.73
nameserver 61.139.2.69
3. sudo resolvconf -u
after this command, the contents of /etc/resolv.conf is the same as /etc/resolvconf/resolv.conf.d/head.
4. sudo /etc/init.d/networking restart
5. modify /etc/resolv.conf as follow if it not changed after network restarted
****************************************************************************************
nameserver 202.96.128.86
****************************************************************************************
notice:
1. if the ip showed in ifconfig result not corresponding to the one in /etc/network/interfaces after sudo /etc/init.d/networking restart, try the below solution:
$ sudo ifdown eth0;sudo ifup eth0
2. if Ubuntu can't connect to network, it may be nameserver is not proper, and try a new nameserver.
Ubuntu下设置static ip及DNS的博文链接:
http://www.jb51.net/os/Ubuntu/104873.html
http://m.blog.csdn.net/blog/u011255705/24573299