pymumu / smartdns

A local DNS server to obtain the fastest website IP for the best Internet experience, support DoT, DoH. 一个本地DNS服务器,获取最快的网站IP,获得最佳上网体验,支持DoH,DoT。
https://pymumu.github.io/smartdns/
GNU General Public License v3.0
8.32k stars 1.07k forks source link

smartdns设置为53端口时,服务无法启动。 #1045

Closed Misaka299 closed 2 years ago

Misaka299 commented 2 years ago

问题现象
smartdns设置为53端口时,服务无法启动。

运行环境 网上找的openwrt镜像,一个插件很多的镜像包。 跑在exsi,64位下。

smartdns是在release页面下载的。 image image 根据上图下载了 luci-app-smartdns.1.2022.08.28-1734.all-luci-all.ipksmartdns.1.2022.08.28-1734.x86_64-openwrt-all.ipk。 重启过后菜单里也没有smartdns一栏。然后卸载重装,把luci的包换成了 luci-app-smartdns.1.2022.08.28-1734.all-luci-compat-all.ipk

[2022-08-31 23:51:07,293][ERROR][     dns_server.c:5038] bind service [::]:53 failed, Address in use
[2022-08-31 23:51:07,293][ERROR][     dns_server.c:5283] create server socket failed.
[2022-08-31 23:51:07,293][ERROR][     dns_server.c:312 ] epoll ctl failed, fd = 6, Invalid argument
[2022-08-31 23:51:07,293][ERROR][       smartdns.c:374 ] start dns server failed.
[2022-08-31 23:51:09,215][ERROR][     dns_server.c:5038] bind service [::]:53 failed, Address in use
[2022-08-31 23:51:09,216][ERROR][     dns_server.c:5283] create server socket failed.
[2022-08-31 23:51:09,216][ERROR][     dns_server.c:312 ] epoll ctl failed, fd = 6, Invalid argument
[2022-08-31 23:51:09,216][ERROR][       smartdns.c:374 ] start dns server failed.
[2022-08-31 23:51:14,319][ERROR][     dns_server.c:5038] bind service [::]:53 failed, Address in use
[2022-08-31 23:51:14,319][ERROR][     dns_server.c:5283] create server socket failed.
[2022-08-31 23:51:14,319][ERROR][     dns_server.c:312 ] epoll ctl failed, fd = 6, Invalid argument
[2022-08-31 23:51:14,319][ERROR][       smartdns.c:374 ] start dns server failed.
[2022-08-31 23:51:19,423][ERROR][     dns_server.c:5038] bind service [::]:53 failed, Address in use
[2022-08-31 23:51:19,423][ERROR][     dns_server.c:5283] create server socket failed.
[2022-08-31 23:51:19,423][ERROR][     dns_server.c:312 ] epoll ctl failed, fd = 6, Invalid argument
[2022-08-31 23:51:19,423][ERROR][       smartdns.c:374 ] start dns server failed.
[2022-08-31 23:51:19,449][ERROR][     dns_server.c:5038] bind service [::]:53 failed, Address in use
[2022-08-31 23:51:19,449][ERROR][     dns_server.c:5283] create server socket failed.
[2022-08-31 23:51:19,449][ERROR][     dns_server.c:312 ] epoll ctl failed, fd = 6, Invalid argument
[2022-08-31 23:51:19,449][ERROR][       smartdns.c:374 ] start dns server failed.
[2022-08-31 23:51:24,553][ERROR][     dns_server.c:5038] bind service [::]:53 failed, Address in use
[2022-08-31 23:51:24,553][ERROR][     dns_server.c:5283] create server socket failed.
[2022-08-31 23:51:24,553][ERROR][     dns_server.c:312 ] epoll ctl failed, fd = 6, Invalid argument
[2022-08-31 23:51:24,553][ERROR][       smartdns.c:374 ] start dns server failed.
[2022-08-31 23:51:27,738][ERROR][      fast_ping.c:461 ] sendto 2001::, id 1, Permission denied
[2022-08-31 23:51:41,143][ERROR][      fast_ping.c:461 ] sendto 2001::, id 1, Permission denied
[2022-08-31 23:52:02,550][ERROR][      fast_ping.c:461 ] sendto 2001::, id 1, Permission denied
[2022-08-31 23:55:09,561][ERROR][     dns_server.c:5038] bind service [::]:53 failed, Address in use
[2022-08-31 23:55:09,561][ERROR][     dns_server.c:5283] create server socket failed.
[2022-08-31 23:55:09,561][ERROR][     dns_server.c:312 ] epoll ctl failed, fd = 6, Invalid argument
[2022-08-31 23:55:09,561][ERROR][       smartdns.c:374 ] start dns server failed.
[2022-08-31 23:55:14,665][ERROR][     dns_server.c:5038] bind service [::]:53 failed, Address in use
[2022-08-31 23:55:14,665][ERROR][     dns_server.c:5283] create server socket failed.
[2022-08-31 23:55:14,665][ERROR][     dns_server.c:312 ] epoll ctl failed, fd = 6, Invalid argument
[2022-08-31 23:55:14,665][ERROR][       smartdns.c:374 ] start dns server failed.
[2022-08-31 23:55:19,769][ERROR][     dns_server.c:5038] bind service [::]:53 failed, Address in use
[2022-08-31 23:55:19,769][ERROR][     dns_server.c:5283] create server socket failed.
[2022-08-31 23:55:19,769][ERROR][     dns_server.c:312 ] epoll ctl failed, fd = 6, Invalid argument
[2022-08-31 23:55:19,769][ERROR][       smartdns.c:374 ] start dns server failed.
[2022-08-31 23:55:24,873][ERROR][     dns_server.c:5038] bind service [::]:53 failed, Address in use
[2022-08-31 23:55:24,873][ERROR][     dns_server.c:5283] create server socket failed.
[2022-08-31 23:55:24,873][ERROR][     dns_server.c:312 ] epoll ctl failed, fd = 6, Invalid argument
[2022-08-31 23:55:24,873][ERROR][       smartdns.c:374 ] start dns server failed.
[2022-08-31 23:55:29,975][ERROR][     dns_server.c:5038] bind service [::]:53 failed, Address in use
[2022-08-31 23:55:29,975][ERROR][     dns_server.c:5283] create server socket failed.
[2022-08-31 23:55:29,975][ERROR][     dns_server.c:312 ] epoll ctl failed, fd = 6, Invalid argument
[2022-08-31 23:55:29,975][ERROR][       smartdns.c:374 ] start dns server failed.
[2022-08-31 23:55:35,081][ERROR][     dns_server.c:5038] bind service [::]:53 failed, Address in use
[2022-08-31 23:55:35,081][ERROR][     dns_server.c:5283] create server socket failed.
[2022-08-31 23:55:35,081][ERROR][     dns_server.c:312 ] epoll ctl failed, fd = 6, Invalid argument
[2022-08-31 23:55:35,081][ERROR][       smartdns.c:374 ] start dns server failed.

netstat -tunlp | grep 53 查询后入下。 image

dnsmasq的占用了。首页文档说是配置53时,smart会自动处理dnsmasq的。不知道咋整了,求助。

jxph1123 commented 2 years ago

这个新版本设置53端口应该还有点稳定,等大佬修复吧。

Misaka299 commented 2 years ago

顺便问一下,上有服务器的协议类型怎么选?这个协议类型指的是什么。 image

Misaka299 commented 2 years ago

这个新版本设置53端口应该还有点稳定,等大佬修复吧。

那,有无手动解决方案?

jxph1123 commented 2 years ago

你的配置感觉也有问题,端口占用,你都翻翻issues吧,我才学习几天,很多也是懵的

PikuZheng commented 2 years ago

dnsmasq的占用了。首页文档说是配置53时,smart会自动处理dnsmasq的。

从8月30日的版本开始,当smartdns配置端口为53时自动修改dnsmasq端口为0。您用的是8月28日的版本,没有这个功能

PikuZheng commented 2 years ago

那,有无手动解决方案?

设置dnsmasq端口不为53即可

上有服务器的协议类型怎么选?这个协议类型指的是什么

协议类型指传送dns查询数据报的方式,常用有 udp,dns-over-tls,dns-over-https。

yyysuo commented 2 years ago

dnsmasq的占用了。首页文档说是配置53时,smart会自动处理dnsmasq的。

从8月30日的版本开始,当smartdns配置端口为53时自动修改dnsmasq端口为0。您用的是8月28日的版本,没有这个功能

才发现最新源码自动设置dnsmasq是默认勾选的,同时重定向的选项没有了。我原来重定向选择的是无,同时自己手动在dhcp中设置了dns转发,请问这个变动会对我自己的dns方案产生影响吗?我应该如何消除这种影响?

jxph1123 commented 2 years ago

image 应该是把这个自动设置dnsmasq不勾选就不会转发了

lvmingye523 commented 2 years ago

我的也是默认6053的地方改成53,就启动不了。。我的是最新编译30号的版本。

那,有无手动解决方案?

设置dnsmasq端口不为53即可

上有服务器的协议类型怎么选?这个协议类型指的是什么

协议类型指传送dns查询数据报的方式,常用有 udp,dns-over-tls,dns-over-https。

我的也是默认6053的地方改成53,就启动不了。。我的是最新编译30号的版本。

yyysuo commented 2 years ago

image 应该是把这个自动设置dnsmasq不勾选就不会转发了

我已经回退到37.2版本了,不知道那个自动设置dnsmasq的选项是不是还会产生影响。

lvmingye523 commented 2 years ago

我按照passwall。官方的教程搞了下第二服务器设置,直接油管都上不去了,真的奇怪了。。

jxph1123 commented 2 years ago

image 应该是把这个自动设置dnsmasq不勾选就不会转发了

我已经回退到37.2版本了,不知道那个自动设置dnsmasq的选项是不是还会产生影响。

我目前设置成6053,勾选自动设置dnsmasq就是和以前一样正常的,如果使用那个最新53端口功能,上不了网了,等大佬修复吧

PikuZheng commented 2 years ago

我的也是默认6053的地方改成53,就启动不了。。我的是最新编译30号的版本。

8月30日到现在更新了三四个版本,据说都有问题 建议回退到29日晚上的版本,也就是这个提交

ghost commented 2 years ago

手动设置,把Dnsmasq的端口从53改成其他的 SmartDNS的端口改为53,不设置重定向

pymumu commented 2 years ago

smartdns.zip 可以验证下看看

yyysuo commented 2 years ago

smartdns.zip 可以验证下看看

能否把自动设置dnsmasq默认设置为不启用呢,毕竟小白们的dns已经折腾得够乱的了,默认启用会造成原有的方案失效。

pymumu commented 2 years ago

原有方案是什么?

当前默认启用的原因是,如果用户启动了smartdns,理论上就是需要smartdns生效。 配置53端口,就是跳过dnsmasq的缓存等机制。 但如果配置了非53端口,就是需要某些dnsmasq的能力,但上游还是用smartdns。

如果有其他分流诉求,可以同时使用第二dns。 默认开启,能确保所有情况下,dns都是正常的。

除非特别熟悉配置修改,才要关闭这个能力。

yyysuo commented 2 years ago

好多套娃的呀,用adguard home占53端口,上游smartdns,虽然意义不大,一升级就冲突了,手动开启就不会有问题。

zxlhhyccc commented 2 years ago

smartdns.zip 可以验证下看看

经验证大佬的此源码: 启用后仍全部断网,需重启一次防火墙可以打开国内网络,但ssrp使用第二服务器为5335端口后国内和国外均不稳定,经常断网,此时需再次重启防火墙,又会正常,但过段时间又断网。。。。 image

lvmingye523 commented 2 years ago

https://github.com/luckyyyyy/blog/issues/57,根据这个passwall的教程做完后,所有外网都贼慢。。不知道为什么。。。这个官方教程也有问题吗。。唉,小白不懂啊

yyysuo commented 2 years ago

smartdns.zip 可以验证下看看

经验证大佬的此源码:

启用后仍全部断网,需重启一次防火墙可以打开国内网络,但ssrp使用第二服务器为5335端口不稳定。。。。 是不是忽略解析文件没勾?

zxlhhyccc commented 2 years ago

smartdns.zip 可以验证下看看

经验证大佬的此源码: 启用后仍全部断网,需重启一次防火墙可以打开国内网络,但ssrp使用第二服务器为5335端口不稳定。。。。 是不是忽略解析文件没勾?

默认不会勾上,不过经测试,勾上忽略解析文件后重启防火墙貌似可以正常。。。。

pymumu commented 2 years ago

先看dns是否正常

nslookup smartdns.
zxlhhyccc commented 2 years ago

先看dns是否正常

nslookup smartdns.

勾上忽略解析文件后重启防火墙后的状态。。。 image image

pymumu commented 2 years ago

注意后面的点。那个要加上。

pymumu commented 2 years ago

另外,最新代码,配置自动设置dnsmasq后,会自动设置忽略解析文件。不需要手工设置

zxlhhyccc commented 2 years ago

注意后面的点。那个要加上。

另外,ssrp里使用第二服务器切换节点后,又要重启一次防火墙才能正常,而且科学上网速度贼慢。。。 image

zxlhhyccc commented 2 years ago

另外,最新代码,配置自动设置dnsmasq后,会自动设置忽略解析文件。不需要手工设置

经测试,最新代码不会自动设置忽略解析文件

pymumu commented 2 years ago

你用的是53端口的话,就不会设置。因为用53端口的时候,dnsmasq的DNS服务已经被关闭了。

zxlhhyccc commented 2 years ago

你用的是53端口的话,就不会设置。因为用53端口的时候,dnsmasq的DNS服务已经被关闭了。

难怪,但是我使用的53端口,需要勾上忽略解析文件后重启防火墙貌似可以正常,不知道什么原因。。。。

pymumu commented 2 years ago

将smartdns改成其他端口看看是否正常

zxlhhyccc commented 2 years ago

将smartdns改成其他端口看看是否正常

改成了6053端口,貌似没啥问题,但使用53端口就不正常。。。。 image image

pymumu commented 2 years ago

那是否是,设置53端口,然后禁用解析文件就能正常?

pymumu commented 2 years ago

系统默认情况下,是不设置noresolv的,这点有点奇怪。

zxlhhyccc commented 2 years ago

那是否是,设置53端口,然后禁用解析文件就能正常?

设置53端口后,需禁用解析然后重启防火墙才能正常,不禁用解析重启防火墙可以正常10分钟左右就断网。。。

pymumu commented 2 years ago

断网后,域名解析是否正常?ping 114.114.114.114是否正常

zxlhhyccc commented 2 years ago

断网后,域名解析是否正常?ping 114.114.114.114是否正常

有个问题请教,启用53端口是不是“自动设置Dnsmasq”要取消勾选?我取消勾选后貌似正常了。。。。

pymumu commented 2 years ago

自动设置dnsmasq在53端口的时候,应该是不生效的。

zxlhhyccc commented 2 years ago

自动设置dnsmasq在53端口的时候,应该是不生效的。

关键是我去掉自动设置Dnsmasq后一切正常,如果不去掉勾选,就像前面我说的出问题 另外,我提两个建议: 1、自动设置Dnsmasq建议去掉默认勾选,现在问题是默认勾选而且默认端口是53,会导致网络不正常; 2、第一和第二服务器均有停止IPV6的解析,此时不能单独取消勾选,必须在两个服务器同时取消勾选才能取消停止IPV6的解析选项。建议对停止IPV6解析予以分离,即:改为单独勾选也可全部勾选。

zxlhhyccc commented 2 years ago

自动设置dnsmasq在53端口的时候,应该是不生效的。

大佬,设置53端口不稳定,又出现断网了。。。。此时停止运行后,dnsmasq不能正常解析,必须重启防火墙。。。

pymumu commented 2 years ago

自动设置dnsmasq在53端口的时候,应该是不生效的。

关键是我去掉自动设置Dnsmasq后一切正常,如果不去掉勾选,就像前面我说的出问题 另外,我提两个建议: 1、自动设置Dnsmasq建议去掉默认勾选,现在问题是默认勾选而且默认端口是53,会导致网络不正常; 2、第一和第二服务器均有停止IPV6的解析,此时不能单独取消勾选,必须在两个服务器同时取消勾选才能取消停止IPV6的解析选项。建议对停止IPV6解析予以分离,即:改为单独勾选也可全部勾选。

第二个问题已经解决。 第一个问题还要看原因,我这边使用53端口,并没有出现你说的问题。

如果断网时间间隔比较固定,有可能是你的固件有软件监控了dnsmasq的工作状态。smartdns替换后,触发了某个软件的监控机制。

PikuZheng commented 2 years ago

如果断网时间间隔比较固定,有可能是你的固件有软件监控了dnsmasq的工作状态。smartdns替换后,触发了某个软件的监控机制。

大佬,设置53端口不稳定,又出现断网了。。。。此时停止运行后,dnsmasq不能正常解析,必须重启防火墙。。。

部分shadowsocks会调用crontab,不断的修改dnsmasq。这个我提过issue,最新版有开关

jxph1123 commented 2 years ago

我是设置53端口后,无论怎样电脑都上不了网,重启路由器、重启电脑、清空DNS缓存,都没用。。。 切换成6053端口,也需要重启路由器才正常。 只安装了SSR,停用了也不行。。

pymumu commented 2 years ago

@jxph1123 是用我最晚的那个版本吗? https://github.com/pymumu/smartdns/files/9462279/smartdns.zip

如果是:无法上网的时候,看一下下面命令的结果

netstat -anp | grep 53
uci show | grep dhcp
cat /var/etc/dnsmasq.conf.*
jxph1123 commented 2 years ago

@jxph1123 是用我最晚的那个版本吗? https://github.com/pymumu/smartdns/files/9462279/smartdns.zip

如果是:无法上网的时候,看一下下面命令的结果

netstat -anp | grep 53
uci show | grep dhcp
cat /var/etc/dnsmasq.conf.*

是用的最新源码编译的,早上才编译。用的lua版本的luci,执行如下:

root@OpenWrt:~# netstat -anp | grep 53
tcp        0      0 0.0.0.0:5355            0.0.0.0:*               LISTEN      6612/wsdd2
tcp        0      0 100.72.99.32:44622      120.53.53.53:443        ESTABLISHED 26020/smartdns
tcp        0      0 100.72.99.32:53470      111.7.73.60:443         ESTABLISHED 26020/smartdns
tcp        0      0 :::5355                 :::*                    LISTEN      6612/wsdd2
udp        0      0 192.168.1.1:5351        0.0.0.0:*                           5057/miniupnpd
udp        0      0 0.0.0.0:5355            0.0.0.0:*                           6612/wsdd2
udp        0      0 :::53                   :::*                                26020/smartdns
udp        0      0 :::5335                 :::*                                26020/smartdns
udp        0      0 :::5355                 :::*                                6612/wsdd2
raw        0      0 ::%4538035:58           :::*                    58          26020/smartdns
raw        0      0 ::%4538035:58           :::*                    58          952/odhcpd
raw        0      0 ::%4538035:58           :::*                    58          2372/odhcp6c
raw        0      0 ::%4538035:58           :::*                    58          1091/odhcp6c
unix  3      [ ]         STREAM     CONNECTED      53088 238/ubusd           /var/run/ubus.sock
unix  3      [ ]         STREAM     CONNECTED       9453 238/ubusd           /var/run/ubus.sock
unix  3      [ ]         STREAM     CONNECTED      17645 6053/logread
root@OpenWrt:~# uci show | grep dhcp
dhcp.@dnsmasq[0]=dnsmasq
dhcp.@dnsmasq[0].localise_queries='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].nonwildcard='1'
dhcp.@dnsmasq[0].localservice='1'
dhcp.@dnsmasq[0].ednspacket_max='1232'
dhcp.@dnsmasq[0].dns_redirect='1'
dhcp.@dnsmasq[0].rebind_protection='1'
dhcp.@dnsmasq[0].domainneeded='1'
dhcp.@dnsmasq[0].port='0'
dhcp.lan=dhcp
dhcp.lan.interface='lan'
dhcp.lan.start='100'
dhcp.lan.limit='150'
dhcp.lan.leasetime='12h'
dhcp.lan.ndp='hybrid'
dhcp.lan.ra_management='1'
dhcp.lan.dhcpv6='server'
dhcp.lan.ra='server'
dhcp.lan.dhcp_option='6,192.168.1.1'
dhcp.wan=dhcp
dhcp.wan.interface='wan'
dhcp.wan.ignore='1'
dhcp.odhcpd=odhcpd
dhcp.odhcpd.maindhcp='0'
dhcp.odhcpd.leasefile='/tmp/hosts/odhcpd'
dhcp.odhcpd.leasetrigger='/usr/sbin/odhcpd-update'
dhcp.odhcpd.loglevel='4'
dhcp.@srvhost[0]=srvhost
dhcp.@srvhost[0].srv='_vlmcs._tcp'
dhcp.@srvhost[0].target='OpenWrt'
dhcp.@srvhost[0].port='1688'
dhcp.@srvhost[0].class='0'
dhcp.@srvhost[0].weight='100'
network.wan6.proto='dhcpv6'
ucitrack.@network[0].affects='dhcp' 'radvd'
ucitrack.@dhcp[0]=dhcp
ucitrack.@dhcp[0].init='dnsmasq'
ucitrack.@dhcp[0].affects='odhcpd'
ucitrack.@odhcpd[0]=odhcpd
ucitrack.@odhcpd[0].init='odhcpd'
ucitrack.@system[0].affects='luci_statistics' 'dhcp'
root@OpenWrt:~# cat /var/etc/dnsmasq.conf.*
# auto-generated config file from /etc/config/dhcp
conf-file=/etc/dnsmasq.conf
dhcp-authoritative
domain-needed
localise-queries
read-ethers
enable-ubus=dnsmasq
expand-hosts
bind-dynamic
local-service
port=0
edns-packet-max=1232
domain=lan
local=/lan/
addn-hosts=/tmp/hosts
dhcp-leasefile=/tmp/dhcp.leases
resolv-file=/tmp/resolv.conf.d/resolv.conf.auto
stop-dns-rebind
rebind-localhost-ok
dhcp-broadcast=tag:needs-broadcast
conf-dir=/tmp/dnsmasq.d
user=dnsmasq
group=dnsmasq

dhcp-ignore-names=tag:dhcp_bogus_hostname
conf-file=/usr/share/dnsmasq/dhcpbogushostname.conf

srv-host=_vlmcs._tcp,OpenWrt,1688,0,100

bogus-priv
conf-file=/usr/share/dnsmasq/rfc6761.conf
dhcp-range=set:lan,192.168.1.100,192.168.1.249,255.255.255.0,12h
dhcp-option=lan,6,192.168.1.1
no-dhcp-interface=pppoe-wan
pymumu commented 2 years ago

看你那个log,smartdns是正常工作的,check下DNS是否能从路由器外部解析。

另外,看一下iptable是不是被设置劫持53端口了。

iptables -t nat -L 
jxph1123 commented 2 years ago

我是光猫桥接,路由器拨号上网,只有这个路由器

root@OpenWrt:~# iptables -t nat -L
Chain PREROUTING (policy ACCEPT)
target     prot opt source               destination
SS_SPEC_WAN_AC  tcp  --  anywhere             anywhere             /* _SS_SPEC_RULE_ */
prerouting_rule  all  --  anywhere             anywhere             /* !fw3: Custom prerouting rule chain */
zone_lan_prerouting  all  --  anywhere             anywhere             /* !fw3 */
zone_wan_prerouting  all  --  anywhere             anywhere             /* !fw3 */
zone_wan_prerouting  all  --  anywhere             anywhere             /* !fw3 */
REDIRECT   udp  --  anywhere             anywhere             /* DNSMASQ */ udp dpt:domain redir ports 0

Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
SS_SPEC_WAN_AC  tcp  --  anywhere             anywhere             /* _SS_SPEC_RULE_ */

Chain POSTROUTING (policy ACCEPT)
target     prot opt source               destination
postrouting_rule  all  --  anywhere             anywhere             /* !fw3: Custom postrouting rule chain */
zone_lan_postrouting  all  --  anywhere             anywhere             /* !fw3 */
zone_wan_postrouting  all  --  anywhere             anywhere             /* !fw3 */
zone_wan_postrouting  all  --  anywhere             anywhere             /* !fw3 */

Chain MINIUPNPD (2 references)
target     prot opt source               destination
DNAT       udp  --  anywhere             anywhere             udp dpt:9221 to:192.168.1.194:16045
DNAT       udp  --  anywhere             anywhere             udp dpt:9396 to:192.168.1.194:16045

Chain MINIUPNPD-POSTROUTING (2 references)
target     prot opt source               destination
MASQUERADE  udp  --  Fx-PC                anywhere             udp spt:16045 masq ports: 9221
MASQUERADE  udp  --  Fx-PC                anywhere             udp spt:16045 masq ports: 9396

Chain SS_SPEC_WAN_AC (2 references)
target     prot opt source               destination
RETURN     all  --  anywhere             anywhere             match-set whitelist dst
SS_SPEC_WAN_FW  all  --  anywhere             anywhere             match-set blacklist dst
RETURN     all  --  anywhere             anywhere             match-set bplan src
SS_SPEC_WAN_FW  all  --  anywhere             anywhere             match-set fplan src
RETURN     tcp  --  anywhere             20.205.12.92         tcp dpt:!domain
RETURN     all  --  anywhere             anywhere             match-set ss_spec_wan_ac dst
RETURN     all  --  anywhere             anywhere             match-set china dst
SS_SPEC_WAN_FW  all  --  anywhere             anywhere             match-set gmlan src ! match-set china dst
SS_SPEC_WAN_FW  all  --  anywhere             anywhere

Chain SS_SPEC_WAN_FW (4 references)
target     prot opt source               destination
RETURN     all  --  anywhere             smartdns/8
RETURN     all  --  anywhere             10.0.0.0/8
RETURN     all  --  anywhere             127.0.0.0/8
RETURN     all  --  anywhere             169.254.0.0/16
RETURN     all  --  anywhere             172.16.0.0/12
RETURN     all  --  anywhere             192.168.0.0/16
RETURN     all  --  anywhere             base-address.mcast.net/4
RETURN     all  --  anywhere             240.0.0.0/4
REDIRECT   tcp  --  anywhere             anywhere             multiport dports ssh,domain,submission,ssmtp,pop3s,imaps,imap2,www,https,853,git redir ports 1234

Chain postrouting_lan_rule (1 references)
target     prot opt source               destination

Chain postrouting_rule (1 references)
target     prot opt source               destination

Chain postrouting_wan_rule (1 references)
target     prot opt source               destination

Chain prerouting_lan_rule (1 references)
target     prot opt source               destination

Chain prerouting_rule (1 references)
target     prot opt source               destination

Chain prerouting_wan_rule (1 references)
target     prot opt source               destination

Chain zone_lan_postrouting (1 references)
target     prot opt source               destination
postrouting_lan_rule  all  --  anywhere             anywhere             /* !fw3: Custom lan postrouting rule chain */

Chain zone_lan_prerouting (1 references)
target     prot opt source               destination
prerouting_lan_rule  all  --  anywhere             anywhere             /* !fw3: Custom lan prerouting rule chain */

Chain zone_wan_postrouting (2 references)
target     prot opt source               destination
MINIUPNPD-POSTROUTING  all  --  anywhere             anywhere
MINIUPNPD-POSTROUTING  all  --  anywhere             anywhere
postrouting_wan_rule  all  --  anywhere             anywhere             /* !fw3: Custom wan postrouting rule chain */
FULLCONENAT  all  --  anywhere             anywhere             /* !fw3 */

Chain zone_wan_prerouting (2 references)
target     prot opt source               destination
MINIUPNPD  all  --  anywhere             anywhere
pymumu commented 2 years ago

你上不了网就是因为这个

REDIRECT   udp  --  anywhere             anywhere             /* DNSMASQ */ udp dpt:domain redir ports 0

这个意思是将所有的dns请求重定向到了0.

这种情况下,是某个软件强制设置了iptable了,要了排查出是那个软件,要了,就是不要用53端口。用dnsmasq上游的方案。

pymumu commented 2 years ago
grep -n "iptables" /etc/init.d/ -R

用这个命令排查下是哪个软件调用了iptables

jxph1123 commented 2 years ago

grep -n "iptables" /etc/init.d/ -R

root@OpenWrt:~# grep -n "iptables" /etc/init.d/ -R
grep: unrecognized option: R
BusyBox v1.30.1 () multi-call binary.

Usage: grep [-HhnlLoqvsriwFE] [-m N] [-A/B/C N] PATTERN/-e PATTERN.../-f FILE [FILE]...

Search for PATTERN in FILEs (or stdin)

        -H      Add 'filename:' prefix
        -h      Do not add 'filename:' prefix
        -n      Add 'line_no:' prefix
        -l      Show only names of files that match
        -L      Show only names of files that don't match
        -c      Show only count of matching lines
        -o      Show only the matching part of line
        -q      Quiet. Return 0 if PATTERN is found, 1 otherwise
        -v      Select non-matching lines
        -s      Suppress open and read errors
        -r      Recurse
        -i      Ignore case
        -w      Match whole words only
        -x      Match whole lines only
        -F      PATTERN is a literal (not regexp)
        -E      PATTERN is an extended regexp
        -m N    Match up to N times per file
        -A N    Print N lines of trailing context
        -B N    Print N lines of leading context
        -C N    Same as '-A N -B N'
        -e PTRN Pattern to match
        -f FILE Read pattern from file