ubuntu 18.04配置静态IP及DNS

2019-11-10  本文已影响0人  小桥流水啦啦啦

1、断开网络服务
sudo /etc/init.d/networking stop

2、设置静态IP
gedit /etc/network/interfaces
将里边的内容改为

auto lo
iface lo inet loopback

auto ens33
iface ens33 inet static
address 192.168.109.128
netmask 255.255.255.0
gateway 192.168.109.1
#network 192.168.109.1
#broadcast 192.168.1.255
dns-nameserver 112.4.0.55
dns-nameserver 221.131.143.69

3、设置DNS服务器
nameserver dns的ip地址
vim /etc/systemd/resolved.conf

[Resolve]
DNS=112.4.0.55 221.131.143.69
#FallbackDNS=
#Domains=
#LLMNR=no
#MulticastDNS=no
#DNSSEC=no
#Cache=yes
#DNSStubListener=yes

gedit /etc/NetworkManager/NetworkManager.conf
做如下修改:

[main]
plugins=ifupdown,keyfile

[ifupdown]
managed=true

[device]
wifi.scan-rand-mac-address=no

4、重启网络服务

/etc/init.d/networking start

=====未解决== 2019-10-14 23:03

上一篇 下一篇

猜你喜欢

热点阅读