# cat /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 注意看:.net
1 /etc/resolv.conf 實際上是一個Linkrest
它其實指向的是 /run/resolvconf/resolv.conf server
3 若是想本身定義 nameserver,那麼有如下2個辦法:blog
A 在網卡的配置文件/etc/network/interfaces 裏面加:dns
dns-nameservers 192.168.3.45 192.168.8.10it
dns-search foo.org bar.com test
重啓網絡配置
sudo service networking restart 或者 sudo /etc/init.d/networking restart
也能夠重啓網卡
sudo ifconfig eth0 down sudo ifconfig eth0 up
B 修改 resolvconf服務的配置文件: /etc/resolvconf/resolv.conf.d/base file
echo "search test.com" >> /etc/resolvconf/resolv.conf.d/base
echo "nameserver 202.106.0.20 " >> /etc/resolvconf/resolv.conf.d/base
這樣,在機器重啓或 resolvconf 服務重啓 均可以保證配置會寫到/etc/resolv.conf 裏面
重啓 resolvconf 服務
service resolvconf restart
A比B的優先級更高,,不過可能會斷網.
摘至:http://blog.csdn.net/liangdsh/article/details/70256039