Ubuntu 22.04
原来的:
root@ubuntu:~# resolvectl
Global
Protocols: -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
resolv.conf mode: stub
Link 2 (ens5)
Current Scopes: DNS
Protocols: +DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
Current DNS Server: 12.34.56.78
DNS Servers: 12.34.56.78 12.34.56.79
我做了什么:
- 在文件中添加
nameservers
条目/etc/netplan/01-netcfg.yaml
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
version: 2
renderer: networkd
ethernets:
ens5:
dhcp4: yes
nameservers:
addresses: [8.8.8.8, 1.1.1.1]
netplan apply
/etc/systemd/resolved.conf
在文件中添加 DNS 服务器
[Resolve]
DNS=8.8.8.8 1.1.1.1
FallbackDNS=8.8.4.4
systemctl restart systemd-resolved
systemctl enable systemd-resolved
重启后:
root@ubuntu:~# resolvectl
Global
Protocols: -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
resolv.conf mode: stub
Current DNS Server: 8.8.8.8
DNS Servers: 8.8.8.8 1.1.1.1
Fallback DNS Servers: 8.8.4.4
Link 2 (ens5)
Current Scopes: DNS
Protocols: +DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
Current DNS Server: 8.8.8.8
DNS Servers: 8.8.8.8 1.1.1.1 12.34.56.78 12.34.56.79
如何删除DNS 服务器列表中的12.34.56.78
和?12.34.56.79