添加静态ip
修改/etc/network/interfaces文件
iface eth0 inet static
address 192.168.0.117
gateway 192.168.0.1
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
添加永久dns
sudo vi /etc/resolvconf/resolv.conf.d/base(这个文件默认是空的)
在里面插入:
nameserver 8.8.8.8
nameserver 8.8.4.4
如果有多个DNS就一行一个
修改好保存,然后执行: sudo resolvconf -u
再看/etc/resolv.conf,最下面就多了2行:
nameserver 8.8.8.8
nameserver 8.8.4.4
重启网卡
sudo /etc/init.d/network restart