在服务器机器上,我有/etc/network/interfaces
类似如下的文件:
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.1.35
netmask 255.255.252.0
network 192.168.0.0
broadcast 192.168.3.255
gateway 192.168.1.1
dns-nameservers 192.168.1.3 192.168.1.4
dns-search example.com
运行时resolvconf -u
,/etc/resolv.conf
文件变成:
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 192.168.1.3
nameserver 192.168.1.4
search pelicandd.com
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 192.168.1.13
为什么会有nameserver 192.168.1.13
?
答案1
Resolvconf/etc/resolv.conf
使用的文件按/etc/resolvconf/resolv.conf.d/
以下顺序生成:head
、、base
。tail
该head
文件几乎始终存在,并且仅包含有关生成文件的警告消息。该base
文件也可能存在,但默认情况下为空。可能有一个tail
文件,鉴于恶意条目出现在末尾,这很可能是您的情况中的罪魁祸首。