1
2
3
4
5
### check status
resolvectl status
### 测试 域名解析
resolvectl query baidu.com
resolvectl query google.com

配置

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
vim /etc/systemd/resolved.conf
[Resolve]
# 上游的dns服务器,可以配置多条
DNS=192.168.50.1
FallbackDNS=223.5.5.5 223.6.6.6 114.114.114.114
#Domains=
#LLMNR=yes
#MulticastDNS=yes
#DNSSEC=allow-downgrade
#DNSOverTLS=no
#Cache=yes
#DNSStubListener=yes
#ReadEtcHosts=yes
1
ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf

archlinux

https://wiki.archlinux.org/index.php/Systemd-resolved

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
vim /etc/systemd/resolved.conf
[Resolve]
DNS=192.168.50.1

# link
ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf

# restart systemd-resolved
sudo systemctl restart systemd-resolved

# check systemd-resolved status
resolvectl status

systemd-resolved

https://blog.wiloon.com/?p=13243

debian

https://wiki.debian.org/resolv.conf

1
2
3
4
5
6
vim /etc/dhcp/dhclient.conf

prepend domain-name-servers 223.5.5.5;
supersede domain-name-servers 223.5.5.5;
sudo dhclient -r
sudo dhclient