是否有這麼一種狀況,在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配置 網絡