是否有这么一种状况,在linux下修改了DNS,而后用命令service network reset重启了,网络配置,而后发现DNS又变回原来的样子了。 html
其实这是由于ifcfg-eth0的配置文件PEERDNS选项作的怪。我找到相关的资料 linux
PEERDNS=answer where answer is one of the following: yes — Modify /etc/resolv.conf if the DNS directive is set. If using DHCP, then yes is the default. no — Do not modify /etc/resolv.conf.相关资料
上面说的是,若是你使用了DHCP来自动获取IP就会使用默认的resolv.conf配置。 shell
若是把PEERDNS设置为NO的时候,就不会自动使用默认的resolv.conf配置 网络