最後更新: 2020-07-21
介紹
Centos 8 會有它 (Default: 啟用)
provides network name resolution to local applications via a D-Bus interface
It implements a caching and validating DNS/DNSSEC stub resolver
(LLMNR / MulticastDNS resolver and responder)
Port: 9355/TCP
CLI
# Restart service
systemctl restart systemd-resolved
# Status
resolvectl
Global Protocols: -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported resolv.conf mode: stub Current DNS Server: 1.1.1.1 DNS Servers: 1.1.1.1 1.0.0.1 Fallback DNS Servers: 8.8.8.8 8.8.4.4 Link 2 (ens160) Current Scopes: DNS Protocols: +DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported Current DNS Server: 1.1.1.1 DNS Servers: 1.1.1.1 1.0.0.1
resolvectl status ens160
Link 2 (ens160) Current Scopes: DNS Protocols: +DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported Current DNS Server: 1.1.1.1 DNS Servers: 1.1.1.1 1.0.0.1
# Set nameserver
resolvectl dns ens160 1.1.1.1 1.0.0.1
# Test
resolvectl query hk.yahoo.com
# Cache
resolvectl flush-caches
# Generated by systemd-resolved
cat /run/systemd/resolve/resolv.conf
Ubuntu
Config
- /etc/systemd/resolved.conf
- /etc/systemd/resolved.conf.d/
resolved.conf
[Resolve] # A space-separated list of IPv4 and IPv6 addresses DNS=1.1.1.1 1.0.0.1 FallbackDNS=8.8.8.8 8.8.4.4
Help
man resolved.conf
Centos
Global settings:
FILES: /etc/systemd/resolved.conf (Or /etc/systemd/resolved.conf.d/resolved.conf)
[Resolve] #DNS= #FallbackDNS= #Domains= #LLMNR=yes #MulticastDNS=yes #DNSSEC=allow-downgrade #DNSOverTLS=no #Cache=yes #DNSStubListener=udp
Per-link dynamic settings
FILES: /etc/systemd/network/*.network