ubuntu 16.04 设置静态IP
1. sudo vi /etc/network/interfaces
auto ens160
iface ens160 inet static
address 172.16.20.145
netmask 255.255.252.0
gateway 172.16.23.254
#dns-nameservers 172.16.20.1 172.16.1.1 8.8.8.8
dns-nameservers 172.16.1.1
sudo vi /etc/NetworkManager/NetworkManager.conf
change:
[ifupdown]
managed=false
to:
[ifupdown]
managed=true
sudo vi /etc/resolvconf/resolv.conf.d/base
nameserver 172.16.1.1
nameserver 172.16.20.1
nameserver 8.8.8.8
nameserver 8.8.4.4