問題:Ubuntu18.04上使用傳統(tǒng)方式設置DNS未生效,直接ping IP可以通仲智,ping 域名無法ping通沉帮。
auto ens33
iface ens33 inet static
address 192.168.32.10
netmask 255.255.255.0
gateway 192.168.32.2
dns-servernames 192.168.32.2
上面的DNS配置不生效屡萤。
正確DNS設置方法:
1珍剑、編輯/etc/systemd/resolved.conf
sudo vim /etc/systemd/resolved.conf
[Resolve]
DNS=192.168.32.2
#FallbackDNS=
#Domains=
#LLMNR=no
#MulticastDNS=no
#DNSSEC=no
#DNSOverTLS=no
#Cache=yes
#DNSStubListener=yes
2、保存退出后執(zhí)行:
systemctl restart systemd-resolved.service
3死陆、查看當前DNS設置
resolvectl status
Global
LLMNR setting: no
MulticastDNS setting: no
DNSOverTLS setting: no
DNSSEC setting: no
DNSSEC supported: no
Current DNS Server: 192.168.32.2
DNS Servers: 192.168.32.2
DNSSEC NTA: 10.in-addr.arpa
16.172.in-addr.arpa
168.192.in-addr.arpa
17.172.in-addr.arpa
18.172.in-addr.arpa
19.172.in-addr.arpa
20.172.in-addr.arpa
21.172.in-addr.arpa
22.172.in-addr.arpa
23.172.in-addr.arpa
24.172.in-addr.arpa
25.172.in-addr.arpa
26.172.in-addr.arpa
27.172.in-addr.arpa
28.172.in-addr.arpa
29.172.in-addr.arpa
30.172.in-addr.arpa
31.172.in-addr.arpa
corp
d.f.ip6.arpa
home
internal
intranet
lan
local
private
test
Link 2 (ens33)
Current Scopes: none
LLMNR setting: yes
MulticastDNS setting: no
DNSOverTLS setting: no
DNSSEC setting: no
DNSSEC supported: no