静态ip

auto eth0
iface eth0 inet static
address 10.20.40.11
netmask 255.255.254.0
gateway 10.20.41.254
dns-nameservers 114.114.114.114

sudo ip addr flush ens33     # 刷新IP
sudo systemctl restart networking.service

ubuntu1804

  1. 添加域名服务器
cd /etc/systemd
sudo vim resolve.conf

DNS=8.8.8.8 223.5.5.5

#保存
reboot