跳到主要内容
常见问题 DNSDebianresolv.conf

Debian 域名解析失败(resolv.conf)?

resolv.conf 是手动写的还是 systemd-resolved 管理的,决定排查路线。本文按「分清谁管 → 走对的路径 → 验证解析」三步修复。

发布于 2026/11/11 所属频道 Ubuntu 与 Debian

简短答案

域名解析失败,先看 resolv.conf 是被 systemd-resolved 管理还是被手动写过。最小安装的 Debian 13.7 DVD 默认走 systemd-resolved,直接手写 resolv.conf 会被服务重发覆盖、且改完不生效。先分清管理权,再走对路径。

现象对照

现象 判断
resolv.conf 是软链到 systemd-resolve 路径 系统托管,改 resolv.conf 本身无效
是普通文件且写死 nameserver 手动写过,重启后失效
resolvectl status 报 no link 无活动网络接口,解析无从谈起

排查步骤

ls -l /etc/resolv.conf
resolvectl status
sudo systemd-resolve --unflush-caches
sudo apt install dnsutils
dig @8.8.8.8 example.com +short      # 直接指上游验证链路

手动指定 nameserver 的正确姿势:写入 netplan/systemd 网络配置,不直接改 resolv.conf;验证用 dig 指定上游 IP,排除是链路还是配置问题。Debian 侧说明见 Debian 发行条目,Ubuntu 桌面/服务器机制对照 Ubuntu 发行条目。

操作小结

  1. ls -l /etc/resolv.conf 先分清托管还是手动
  2. 托管走 netplan/systemd 配置,不手写
  3. dig @上游IP 验证链路是否本身可达
  4. 改完 resolvectl --unflush-caches 清缓存再测

相关链接

本文内容基于公开资料整理,仅供参考;涉及授权与合规的操作请以厂商官方文档为准。

相关推荐下载

按本文主题匹配的官方原版镜像条目

配套 PE 工具

制作启动盘、备份数据、修复引导

其他常见问题

同一集合内的相近主题,按标签与关键词匹配