dnsmasq的Rebind protection導致的域名解析問題

路由器配置如下:

root@liangbo:~# uci show network.wan
network.wan=interface
network.wan.ifname=eth0
network.wan.proto=dhcp   <=============WAN 自動獲取配置信息

root@liangbo:~# uci show network.lan
network.lan=interface
network.lan.ifname=eth1
network.lan.force_link=1
network.lan.type=bridge
network.lan.proto=static
network.lan.ipaddr=192.168.1.1
network.lan.netmask=255.255.255.0
network.lan.ip6assign=60

root@liangbo:~# ifconfig eth0   <=====WAN口成功獲得地址
eth0      Link encap:Ethernet  HWaddr 00:1B:C5:09:A6:F3
          inet addr:10.100.20.71  Bcast:10.100.20.255  Mask:255.255.255.0
          inet6 addr: fe80::21b:c5ff:fe09:a6f3/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:55112 errors:0 dropped:297 overruns:0 frame:0
          TX packets:32181 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:18004058 (17.1 MiB)  TX bytes:6529135 (6.2 MiB)

root@liangbo:~# uci show dhcp
dhcp.@dnsmasq[0]=dnsmasq
dhcp.@dnsmasq[0].boguspriv=1
dhcp.@dnsmasq[0].localise_queries=1
dhcp.@dnsmasq[0].rebind_protection=1
dhcp.@dnsmasq[0].rebind_localhost=1
dhcp.@dnsmasq[0].local=/lan/
dhcp.@dnsmasq[0].domain=lan
dhcp.@dnsmasq[0].expandhosts=1
dhcp.@dnsmasq[0].authoritative=1
dhcp.@dnsmasq[0].readethers=1
dhcp.@dnsmasq[0].leasefile=/tmp/dhcp.leases
dhcp.@dnsmasq[0].resolvfile=/tmp/resolv.conf.auto   <==== 使用該文件解析域名.
dhcp.@dnsmasq[0].domainneeded=1
...

root@liangbo:~# cat /tmp/resolv.conf.auto                 <==== DHCP分配的DNS服務器
# Interface wan
nameserver 172.16.172.82
nameserver 172.16.172.83
search jiguan.hnecgc.com.cn

試圖解析 oa.hnccgc.com 失敗

root@liangbo:~# nslookup oa.hnccgc.com
Server:    127.0.0.1
Address 1: 127.0.0.1 localhost
nslookup: can't resolve 'oa.hnccgc.com': Name or service not known    <=== failed

試圖使用172.16.172.82 解析 oa.hnccgc.com 成功
root@liangbo:~# nslookup oa.hnccgc.com 172.16.172.82
Server:    172.16.172.82
Address 1: 172.16.172.82 bogon
Name:      oa.hnccgc.com
Address 1: 172.16.172.101 bogon   <===== successed

原因:

dnsmasq 開啓了rebind protection,也就是反域名劫持保護。由於上級dns返回的地址是個私有局域網地址,所以被看作是一次域名劫持,從而丟棄瞭解析的結果。

解決方法:
關閉掉rebind protection就好了,具體方法是:Network==〉DHCP and DNS ==> Server settings ==> General Settings , 勾選掉 Rebind protection.

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章