linux – dnsmasq读取/ etc / hosts,但没有使用它

前端之家收集整理的这篇文章主要介绍了linux – dnsmasq读取/ etc / hosts,但没有使用它前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我已经完成了dnsmasq的默认安装.当我运行dig时,它似乎使用dnsmasq(127.0.0.1),但结果不包括/ etc / hosts中包含的主机名.

/ etc / hosts中:

  1. 192.168.1.13 sun

在终端:

  1. $dig sun
  2.  
  3. ; <<>> DiG 9.6-ESV-R4 <<>> sun
  4. ;; global options: +cmd
  5. ;; Got answer:
  6. ;; ->>HEADER<<- opcode: QUERY,status: NXDOMAIN,id: 32131
  7. ;; flags: qr rd ra; QUERY: 1,ANSWER: 0,AUTHORITY: 1,ADDITIONAL: 0
  8.  
  9. ;; QUESTION SECTION:
  10. ;sun. IN A
  11.  
  12. ;; AUTHORITY SECTION:
  13. . 9699 IN SOA a.root-servers.net. nstld.verisign-grs.com. 2011041100 1800 900 604800 86400
  14.  
  15. ;; Query time: 1 msec
  16. ;; SERVER: 127.0.0.1#53(127.0.0.1)
  17. ;; WHEN: Tue Apr 12 05:20:56 2011
  18. ;; MSG SIZE rcvd: 96

在终端:

  1. $dig @localhost sun
  2.  
  3. ; <<>> DiG 9.6-ESV-R4 <<>> @localhost sun
  4. ; (2 servers found)
  5. ;; global options: +cmd
  6. ;; Got answer:
  7. ;; ->>HEADER<<- opcode: QUERY,id: 43763
  8. ;; flags: qr rd ra; QUERY: 1,ADDITIONAL: 0
  9.  
  10. ;; QUESTION SECTION:
  11. ;sun. IN A
  12.  
  13. ;; AUTHORITY SECTION:
  14. . 10800 IN SOA a.root-servers.net. nstld.verisign-grs.com. 2011041800 1800 900 604800 86400
  15.  
  16. ;; Query time: 40 msec
  17. ;; SERVER: 127.0.0.1#53(127.0.0.1)
  18. ;; WHEN: Mon Apr 18 17:15:23 2011
  19. ;; MSG SIZE rcvd: 96

我尝试过使用本地和扩展主机/域名,但似乎无法让其中任何一个工作.我的主要目标是能够使用一台计算机来托管局域网DNS,我不在乎这些名称是sun还是sun.domain,无论什么工作.

这是我的/etc/resolv.conf

  1. nameserver 127.0.0.1
  2. domain members.linode.com
  3. search members.linode.com
  4. nameserver 72.14.188.5
  5. nameserver 72.14.179.5

和/etc/dnsmasq.conf

  1. domain-needed
  2. bogus-priv

如果它有所作为,这一切都在ubuntu 10.04机器上.我一直在关注本指南:http://www.mythicalbeast.co.uk/linux/dnsmasq_howto.html(虽然不是逐字逐句,因为它也设置了DHCP)

解决方法

你的/etc/resolv.conf是什么样的?寻找域名或搜索元素.

为dnsmasq设置一个.local域,然后将其添加到你的resolv.conf,它应该工作.

尝试挖掘sun.local @localhost.

猜你在找的Linux相关文章