openwrt 之 DNS配置文件修改

参考:http://www.openwrt.org.cn/bbs/thread-1639-1-1.html


我在openwrt的web界面修改的wan口dns服务器为8.8.8.8。但是通过ssh查看/etc/resolv.conf文件发现总是被重置为了:

  1. root@Wrv54g:~# cat /etc/resolv.conf 
  2. search lan
  3. nameserver 127.0.0.1
复制代码
据我观察在web刚改完之后有几秒保持了我修改的dns,但之后马上会被重置,请问是什么原因?
  1. root@Wrv54g:~# cat /etc/resolv.conf 
  2. nameserver 127.0.0.1
  3. nameserver 8.8.8.8
  4. nameserver 8.8.4.4
  5. root@Wrv54g:~# cat /etc/resolv.conf 
  6. nameserver 127.0.0.1
  7. nameserver 8.8.8.8
  8. nameserver 8.8.4.4
  9. root@Wrv54g:~# cat /etc/resolv.conf 
  10. search lan
  11. nameserver 127.0.0.1
  12. root@Wrv54g:~# cat /etc/resolv.conf 
  13. search lan
  14. nameserver 127.0.0.1
  15. root@Wrv54g:~# cat /etc/resolv.conf 
  16. search lan
  17. nameserver 127.0.0.1
  18. root@Wrv54g:~#
复制代码

dnsmasq重置了!实际使用的是/tmp/resolv.conf.auto

修改/etc/config/network 文件
config 'interface' 'lan'            
        option 'type' 'bridge'      
        option 'ifname' 'eth0.0'    
        option 'proto' 'static'     
        option 'netmask' '255.255.255.0'
        option 'dns' '208.67.222.222'   
        option 'gateway' '192.168.3.1'  
        option 'ipaddr' '192.168.3.250'

root@Raspberry:/#  /etc/init.d/dnsmasq restart

你可能感兴趣的:(OpenWrt)