您的位置:首页 > 其它

Ubuntu16.04设置ip,dns

2018-03-18 13:08 627 查看

Ubuntu16.04设置ip/dns

注意:在设置完ip/dns后,需要自己重新开启一下网络服务(有时甚至需要重启电脑):

sudo /etc/init.d/networking restart


设置ip

sudo gedit /etc/network/interfaces


打开的文件如下:

[注] 添加时,在终端先查一下自己想要设置的网卡的名称,不一定是eth0,将eth0替换为自己网卡的名称,然后将自己设置的地址等信息更换即可

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.0.88
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
# dns-* options are implemented by the resolvconf package, if instatlled
dns-nameservers 192.168.0.1


设置DNS

sudo vi /etc/resolvconf/resolv.conf.d/base


打开文件写入:

search localdomain #如果本Server为DNS服务器,可以加上这一句,如果不是,可以不加
nameserver 8.8.8.8 #希望修改成的DNS
nameserver 114.114.114.114 #希望修改成的DNS
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  Ubuntu ip nameserver