修改ip:
vi /etc/network/interfaces
auto eth0
iface eth0 inet static
address 192.168.1.120
netmask 255.255.255.0
gateway 192.168.1.1
修改dns:
vi /etc/resolvconf/resolv.conf.d/base (长期)
vi /etc/resolv.conf (临时)
nameserver 114.114.114.114
摘:http://blog.sina.com.cn/s/blog_67be3b450101de44.html
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address xxx.xxx.xxx.xxx
netmask xxx.xxx.xxx.xxx
gateway xxx.xxx.xxx.xxx
auto eth0:0
iface eth0:0 inet static
address xxx.xxx.xxx.xxx
netmask xxx.xxx.xxx.xxx
#dns-nameservers 202.102.224.68 202.102.227.68
up route add -net xxx.xxx.xxx.xxx netmask xxx.xxx.xxx.xxx gw xxx.xxx.xxx.xxx eth0
up route add -net xxx.xxx.xxx.xxx netmask xxx.xxx.xxx.xxx gw xxx.xxx.xxx.xxx eth0
up route add -net xxx.xxx.xxx.xxx netmask xxx.xxx.xxx.xxx gw xxx.xxx.xxx.xxx eth0