284 字
1 分钟
Debian配置静态IP解决DNS无法解析问题

配置静态IP#

如果说是用于服务器,一定还是/etc/network/interfaces这个配置文件好使。

配置文件如下:

Terminal window
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto enp3s5
iface enp3s5 inet static
address 192.168.1.5/24
gateway 192.168.1.1
dns-nameservers 223.5.5.5 223.6.6.6

注:这里的auto也是要修改的,不要忘记

问题出现#

这个时候出现了这样的一个问题:

Image_1766068041105

DNS服务器应该是没有任何问题的才对,为此我还特地检查了dns-nameservers的拼写,但是很遗憾不是的。

问题检查#

如果是DNS域名解析的问题,那么应该不能ping通域名,只能pingIP的,所以需要做一下测试。

结果却是非常完美,www.baidu.comwww.bing.com均出现了上图的问题,但是223.5.5.5192.168.1.1都是没有问题的。

问题解决#

/etc/reslov.conf#

这个文件后来确定是以前用于控制DNS的配置文件,但是Debian保留了下来,最后有一位大神用一条命令成功解决问题:

Terminal window
echo "nameserver 223.5.5.5" >> /etc/reslov.conf
Debian配置静态IP解决DNS无法解析问题
https://ivoinkwell.xyz/posts/specks/debian-static-ip-dns-fix/
作者
Ivo
发布于
2026-03-15
许可协议
CC BY-NC-SA 4.0