基于域名的dnsmasq条件转发

基于域名的dnsmasq条件转发

期望的结果是我需要 dnsmasq 根据它需要解析的主机名转发它收到的查询。

  • DNS 是唯一需要的功能。没有 dhcp、tftp 等。
  • 192.168.1.2 是提供 dnsmasq 服务的机器
  • 192.168.1.7 是正在查询 dnsmask 的机器。
  • 使 192.168.1.2 上的服务器遵循这些限制并不相关或不需要。

    例如,在 192.168.1.7 上输入:

    nslookup some.mydomain.local

它应该转发到 10.0.1.1 的 DNS 服务器
,而对 apple.com 的请求应该转发到 8.8.8.8

我的 dnsmasq 文件如下所示:

server=/mydomain.local/10.0.1.1
server=/mydomain.local/10.0.1.2
server=/mydomain.local/10.0.1.3
server=/mydomain.local/10.0.1.4

server=/mydomain.com/10.0.1.1
server=/mydomain.com/10.0.1.2
server=/mydomain.com/10.0.1.3
server=/mydomain.com/10.0.1.4

server=8.8.8.8
server=8.8.4.4
listen-address=0.0.0.0
bind-interfaces

但日志输出显示它没有执行我想要的操作:

 mypc dnsmasq: query[PTR] 2.1.168.192.in-addr.arpa from 192.168.1.7
 mypc dnsmasq: cached 192.168.1.2 is mypc.mydomain.local
 mypc dnsmasq: query[A] apple.com.mydomain.local from 192.168.1.7
 mypc dnsmasq: forwarded apple.com.mydomain.local to 10.0.1.1
 mypc dnsmasq: forwarded apple.com.mydomain.local to 10.0.1.2
 mypc dnsmasq: forwarded apple.com.mydomain.local to 10.0.1.4
 mypc dnsmasq: forwarded apple.com.mydomain.local to 10.0.1.3
 mypc dnsmasq: reply apple.com.mydomain.local is NXDOMAIN-IPv4
 mypc dnsmasq: query[AAAA] apple.com.mydomain.local from 192.168.1.7
 mypc dnsmasq: forwarded apple.com.mydomain.local to 10.0.1.1
 mypc dnsmasq: forwarded apple.com.mydomain.local to 10.0.1.2
 mypc dnsmasq: forwarded apple.com.mydomain.local to 10.0.1.4
 mypc dnsmasq: forwarded apple.com.mydomain.local to 10.0.1.3
 mypc dnsmasq: reply apple.com.mydomain.local is NXDOMAIN-IPv6
 mypc dnsmasq: query[A] apple.com.mydomain.com from 192.168.1.7
 mypc dnsmasq: forwarded apple.com.mydomain.com to 10.0.1.1
 mypc dnsmasq: forwarded apple.com.mydomain.com to 10.0.1.2
 mypc dnsmasq: forwarded apple.com.mydomain.com to 10.0.1.4
 mypc dnsmasq: forwarded apple.com.mydomain.com to 10.0.1.3
 mypc dnsmasq: reply apple.com.mydomain.com is NXDOMAIN-IPv4
 mypc dnsmasq: query[AAAA] apple.com.mydomain.com from 192.168.1.7
 mypc dnsmasq: forwarded apple.com.mydomain.com to 10.0.1.1
 mypc dnsmasq: forwarded apple.com.mydomain.com to 10.0.1.2
 mypc dnsmasq: forwarded apple.com.mydomain.com to 10.0.1.4
 mypc dnsmasq: forwarded apple.com.mydomain.com to 10.0.1.3
 mypc dnsmasq: reply apple.com.mydomain.com is NXDOMAIN-IPv6
 mypc dnsmasq: query[A] apple.com.dc1.mydomain.com from 192.168.1.7
 mypc dnsmasq: forwarded apple.com.dc1.mydomain.com to 8.8.8.8
 mypc dnsmasq: forwarded apple.com.dc1.mydomain.com to 8.8.4.4
 mypc dnsmasq: forwarded apple.com.dc1.mydomain.com to 10.0.1.1
 mypc dnsmasq: forwarded apple.com.dc1.mydomain.com to 10.0.1.2
 mypc dnsmasq: forwarded apple.com.dc1.mydomain.com to 10.0.1.4
 mypc dnsmasq: forwarded apple.com.dc1.mydomain.com to 10.0.1.3
 mypc dnsmasq: reply apple.com.dc1.mydomain.com is NXDOMAIN-IPv4
 mypc dnsmasq: query[AAAA] apple.com.dc1.mydomain.com from 192.168.1.7
 mypc dnsmasq: forwarded apple.com.dc1.mydomain.com to 8.8.4.4
 mypc dnsmasq: reply apple.com.dc1.mydomain.com is NXDOMAIN-IPv6
 mypc dnsmasq: query[A] apple.com from 192.168.1.7
 mypc dnsmasq: forwarded apple.com to 8.8.4.4
 mypc dnsmasq: reply apple.com is 17.172.224.47
 mypc dnsmasq: reply apple.com is 17.178.96.59
 mypc dnsmasq: reply apple.com is 17.142.160.59
 mypc dnsmasq: query[AAAA] apple.com from 192.168.1.7
 mypc dnsmasq: forwarded apple.com to 8.8.4.4
 mypc dnsmasq: reply apple.com is NODATA-IPv6

想法?

提前致谢,

相关内容