查看系统正在使用的 DNS 服务器

显示 systemd-resolved 实际生效的各连接解析设置。

Linux网络解析器systemd-resolved DNS 解析DNS低风险
运行 resolvectl status,找到活动接口下的 DNS Servers 一行——那就是系统实际使用的解析服务器。

01命令

命令
$ resolvectl status | grep -A2 'DNS Servers'

02作用说明

新版 Ubuntu 和 Fedora 不再老老实实读 /etc/resolv.conf,DNS 由 systemd-resolved 按网卡分别管理,resolvectl status 就是查看它的入口。想知道“我的 Pi-hole/AdGuard 怎么没生效?”跑一下就能看出自定义服务器有没有挂到对应接口上,还是仍然在用路由器的 DNS。全局 DNS 在最上面,各接口的在其下方。

03风险

风险低风险
使用条件systemd-resolved (default on Ubuntu/Fedora); on other distros use cat /etc/resolv.conf
!注意: 没有 systemd-resolved 的发行版没有这个命令——改看 /etc/resolv.conf;接口级 DNS 只有在域名匹配该接口的搜索域时才会覆盖全局 DNS。

04撤销

✓无需撤销——该命令不会改变持久状态。

05来源

  • resolvectl(1) — manual page
    Arch Linux · community · 2026-09-17
    依据: resolvectl status shows the DNS servers and domains configured per link by systemd-resolved.
  • systemd-resolved — Arch Wiki
    Arch Linux · community · 2026-09-17
    依据: resolvectl status is the way to inspect which DNS servers systemd-resolved is using per interface.

最后验证: 2026-09-18 · 分类: 网络

06相关方案