在“客户端”模式下通过 WiFi 提供互联网访问的已连接客户端上忽略 DNS 广告拦截

在“客户端”模式下通过 WiFi 提供互联网访问的已连接客户端上忽略 DNS 广告拦截

2019-04-19:我得出的结论是,这可能是dnsmasq日志显示的某些设置或错误配置错误被拒绝。在分析完源代码后,我将在将来的某个时候更新这个问题。


广告拦截是通过“dnsmasq”完成的,它读取一个hosts文件,当登录到 OpenWrt 设备时,拦截会按预期工作:

PING s0.2mdn.net (0.0.0.0): 56 data bytes
64 bytes from 127.0.0.1: seq=0 ttl=64 time=0.268 ms
...

然而,在连接到 OpenWrt 路由器(有线或无线)的计算机上,阻止不起作用。

danielsokolowski@DANDC-OFFICE:~$ ping s0.2mdn.net

Pinging s0-2mdn-net.l.google.com [172.217.1.166] with 32 bytes of data:
Reply from 172.217.1.166: bytes=32 time=22ms TTL=56
..

一些信息:


root@481:~# cat /etc/resolv.conf
search lan
nameserver 127.0.0.1

root@481:~# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.0.1     0.0.0.0         UG    0      0        0 wlan0
10.4.81.0       *               255.255.255.0   U     0      0        0 br-lan
192.168.0.0     *               255.255.255.0   U     0      0        0 wlan0

root@481:~# netstat -lp | grep dnsmasq
tcp        0      0 192.168.0.103:domain    0.0.0.0:*               LISTEN      1890/dnsmasq
tcp        0      0 localhost:domain        0.0.0.0:*               LISTEN      1890/dnsmasq
tcp        0      0 481.lan:domain          0.0.0.0:*               LISTEN      1890/dnsmasq
...
tcp        0      0 localhost:domain        :::*                    LISTEN      1890/dnsmasq
...
udp        0      0 192.168.0.103:domain    0.0.0.0:*                           1890/dnsmasq
udp        0      0 localhost:domain        0.0.0.0:*                           1890/dnsmasq
udp        0      0 481.lan:domain          0.0.0.0:*                           1890/dnsmasq
udp        0      0 0.0.0.0:bootps          0.0.0.0:*                           1890/dnsmasq
...
root@481:~#

danielsokolowski@DANDC-OFFICE:~$ ipconfig

Windows IP Configuration


...

Ethernet adapter Local Area Connection 2:

   Connection-specific DNS Suffix  . : lan
   Link-local IPv6 Address . . . . . : fe80::d940:8d32:8ecf:38b5%13
   IPv4 Address. . . . . . . . . . . : 10.4.81.10
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 10.4.81.1

...

danielsokolowski@DANDC-OFFICE:~$ ping s0.2mdn.net

Pinging s0-2mdn-net.l.google.com [172.217.164.230] with 32 bytes of data:
Reply from 172.217.164.230: bytes=32 time=17ms TTL=56
Reply from 172.217.164.230: bytes=32 time=29ms TTL=56

相关内容