原文链接:https://www.f2er.com/ubuntu/354978.htmlroot@hony:~# cat /etc/issue
Ubuntu 16.04 LTS \n \l#########################
vim /etc/NetworkManager/NetworkManager.conf
[main]
plugins=ifupdown,keyfile,ofono
dns=dnsmasq[ifupdown]
managed=true # trueservice network-manager restart
###########此处必须设置,不然重启网络,设置的dns会变成默认的
nameserver 127.0.0.1
#########################
#设置dns
vim /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 10.230.8.10设置静态ip地址
vim /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
auto ens33 #ens33 可以通过ifconfig 可以看到网卡的名字
iface ens33 inet static
address 10.230.68.76
netmask 255.255.255.0
gateway 10.230.68.1重启网卡 /etc/init.d/networking restart
ping www.baidu.com 能通的话说明可以正常上网了。