coolsnowwolf / lede

Lean's LEDE source
Other
29.85k stars 19.53k forks source link

[luci-app-ssr-plus]在仅代理 TCP 时,ssr-rules 无法正常代理 LAN 流量。 #2024

Closed peter-tank closed 4 years ago

peter-tank commented 5 years ago

尝试加入 Trojan 代理的支持,发现只能代理router自身流量。 各位大佬,要怎么来整 ssr-rules 才可以正常透明代理?

peter-tank commented 5 years ago

目前的主要问题是,从 LAN 访问 gfwlist 里的网址会直接报 "ERR_CONNECTION_REFUSED"。

今天翻出来 firewall restore 的相关配置,虽然不懂 iptables 命令,但从字面上感觉 rules 没问题。 可能是我试图在 LEDE 旧固件(大至是今年9月的 snap shot)上安装模块 iptables-mod-extra, 然后报错内核不匹配,然后就连之前能正常使用的 V2Ray 也出现同样的故障了。

peter-tank commented 5 years ago

1291 忘了,我更新 V2Ray 二进制到 4.20 了,看来我不适合玩 bleeding。

但是只找到去年的 LEDE stable release 17.01.5 而且 OpenWrt 官版一直就没合并那个我需要的大内存补丁(128M nand @ ar71xx for wndr3700 & wndr4300)。 换仓库,找了个最相近内核版本的(kernel 4.9.196, 更老点的 stable release 是 kernel 4.9.152) 然后 opkg install iptables-mod-extra 强制安装这种通用包,应当问题不大吧(当前 kernel 4.9.182 )?


把自己手动编译全版的 V2Ray 二进制(v2ray, 2ctl)放进去,问题依旧,,, 另外,上面这个换仓库安装 iptables-mod-extra 的方式并不可以正常加载进去(iptables-mod-extra_1.6.2),kmodloader 好像会忽略不对内核版的。 要纠结这个模块是想换成 ss-tproxy 来处理,因为另一个路由上我配置成功了,只是没有 LuCI 不太便利。

peter-tank commented 4 years ago

找了个好例子,再来一波。。。 LAN -> router1(192.168.2.0/24) -> router2(192.168.1.0/24) -> ISP ...


LAN nslook pass:

路由 router1 nslook pass:

Name: www.bing.com www.bing.com canonical name = a-0001.a-afdentry.net.trafficmanager.net Name: a-0001.a-afdentry.net.trafficmanager.net a-0001.a-afdentry.net.trafficmanager.net canonical name = cn.cn-0001.cn-msedge.net Name: cn.cn-0001.cn-msedge.net cn.cn-0001.cn-msedge.net canonical name = cn-0001.cn-msedge.net Name: cn-0001.cn-msedge.net Address 1: 202.89.233.100 Address 2: 202.89.233.101 www.bing.com canonical name = a-0001.a-afdentry.net.trafficmanager.net a-0001.a-afdentry.net.trafficmanager.net canonical name = cn.cn-0001.cn-msedge.net cn.cn-0001.cn-msedge.net canonical name = cn-0001.cn-msedge.net Server: router.ip.addr Address: router.ip.addr#53

- `fw3 reload`(mia, adbyby disabled):

Chain INPUT (policy ACCEPT 2041 packets, 117K bytes) num pkts bytes target prot opt in out source destination

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination
1 19 1140 TCPMSS tcp -- wlan1 0.0.0.0/0 0.0.0.0/0 tcp flags:0x06/0x02 / !fw3: Zone wan MTU fixing / TCPMSS clamp to PMTU 2 0 0 TCPMSS tcp -- eth0.2 0.0.0.0/0 0.0.0.0/0 tcp flags:0x06/0x02 / !fw3: Zone wan MTU fixing / TCPMSS clamp to PMTU

Chain OUTPUT (policy ACCEPT 890 packets, 86127 bytes) num pkts bytes target prot opt in out source destination

Chain POSTROUTING (policy ACCEPT 890 packets, 86127 bytes) num pkts bytes target prot opt in out source destination

Chain SS_SPEC_TPROXY (1 references) num pkts bytes target prot opt in out source destination
1 123 6827 RETURN udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:53 2 0 0 RETURN udp -- 0.0.0.0/0 0.0.0.0/8
3 0 0 RETURN udp -- 0.0.0.0/0 10.0.0.0/8
4 120 9312 RETURN udp -- 0.0.0.0/0 127.0.0.0/8
5 0 0 RETURN udp -- 0.0.0.0/0 169.254.0.0/16
6 0 0 RETURN udp -- 0.0.0.0/0 172.16.0.0/12
7 1311 37383 RETURN udp -- 0.0.0.0/0 192.168.0.0/16
8 0 0 RETURN udp -- 0.0.0.0/0 224.0.0.0/4
9 10 1450 RETURN udp -- 0.0.0.0/0 240.0.0.0/4
10 0 0 RETURN udp -- 0.0.0.0/0 113.190.241.173
11 0 0 TPROXY udp -- 0.0.0.0/0 0.0.0.0/0 match-set fplan src TPROXY redirect 0.0.0.0:1234 mark 0x100/0xfff 12 0 0 TPROXY udp -- 0.0.0.0/0 0.0.0.0/0 match-set gmlan src ! match-set china dst TPROXY redirect 0.0.0.0:1234 mark 0x100/0xfff 13 0 0 TPROXY udp -- 0.0.0.0/0 0.0.0.0/0 ! match-set ss_spec_wan_ac dst TPROXY redirect 0.0.0.0:1234 mark 0x100/0xfff

Chain PREROUTING (policy ACCEPT 16 packets, 1810 bytes) num pkts bytes target prot opt in out source destination
1 6 360 SS_SPEC_WAN_AC tcp -- 0.0.0.0/0 0.0.0.0/0 / _SS_SPECRULE / 2 2254 151K REDIRECT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:53 redir ports 53 3 0 0 REDIRECT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:53 redir ports 53 4 566 64132 prerouting_rule all -- 0.0.0.0/0 0.0.0.0/0 / !fw3: Custom prerouting rule chain / 5 334 31432 zone_lan_prerouting all -- br-lan 0.0.0.0/0 0.0.0.0/0 / !fw3 / 6 232 32700 zone_wan_prerouting all -- wlan1 0.0.0.0/0 0.0.0.0/0 / !fw3 / 7 0 0 zone_wan_prerouting all -- eth0.2 0.0.0.0/0 0.0.0.0/0 / !fw3 */

Chain INPUT (policy ACCEPT 10 packets, 630 bytes) num pkts bytes target prot opt in out source destination

Chain OUTPUT (policy ACCEPT 67 packets, 3766 bytes) num pkts bytes target prot opt in out source destination
1 4 240 SS_SPEC_WAN_AC tcp -- 0.0.0.0/0 0.0.0.0/0 / _SS_SPECRULE /

Chain POSTROUTING (policy ACCEPT 64 packets, 3559 bytes) num pkts bytes target prot opt in out source destination
1 1322 77044 postrouting_rule all -- 0.0.0.0/0 0.0.0.0/0 / !fw3: Custom postrouting rule chain / 2 0 0 zone_lan_postrouting all -- br-lan 0.0.0.0/0 0.0.0.0/0 / !fw3 / 3 315 20281 zone_wan_postrouting all -- wlan1 0.0.0.0/0 0.0.0.0/0 / !fw3 / 4 0 0 zone_wan_postrouting all -- eth0.2 0.0.0.0/0 0.0.0.0/0 / !fw3 */

Chain MINIUPNPD (1 references) num pkts bytes target prot opt in out source destination

Chain MINIUPNPD-POSTROUTING (1 references) num pkts bytes target prot opt in out source destination

Chain SS_SPEC_WAN_AC (2 references) num pkts bytes target prot opt in out source destination
1 0 0 RETURN all -- 0.0.0.0/0 0.0.0.0/0 match-set whitelist dst 2 0 0 SS_SPEC_WAN_FW all -- 0.0.0.0/0 0.0.0.0/0 match-set blacklist dst 3 0 0 SS_SPEC_WAN_FW all -- 0.0.0.0/0 0.0.0.0/0 match-set fplan src 4 0 0 RETURN all -- 0.0.0.0/0 113.190.241.173
5 8 480 RETURN all -- 0.0.0.0/0 0.0.0.0/0 match-set ss_spec_wan_ac dst 6 2 120 SS_SPEC_WAN_FW all -- 0.0.0.0/0 0.0.0.0/0

Chain SS_SPEC_WAN_FW (3 references) num pkts bytes target prot opt in out source destination
1 0 0 RETURN all -- 0.0.0.0/0 0.0.0.0/8
2 0 0 RETURN all -- 0.0.0.0/0 10.0.0.0/8
3 0 0 RETURN all -- 0.0.0.0/0 127.0.0.0/8
4 0 0 RETURN all -- 0.0.0.0/0 169.254.0.0/16
5 0 0 RETURN all -- 0.0.0.0/0 172.16.0.0/12
6 0 0 RETURN all -- 0.0.0.0/0 192.168.0.0/16
7 0 0 RETURN all -- 0.0.0.0/0 224.0.0.0/4
8 0 0 RETURN all -- 0.0.0.0/0 240.0.0.0/4
9 2 120 REDIRECT tcp -- 0.0.0.0/0 0.0.0.0/0 redir ports 1234

Chain postrouting_lan_rule (1 references) num pkts bytes target prot opt in out source destination

Chain postrouting_rule (1 references) num pkts bytes target prot opt in out source destination

Chain postrouting_wan_rule (1 references) num pkts bytes target prot opt in out source destination

Chain prerouting_lan_rule (1 references) num pkts bytes target prot opt in out source destination

Chain prerouting_rule (1 references) num pkts bytes target prot opt in out source destination

Chain prerouting_wan_rule (1 references) num pkts bytes target prot opt in out source destination

Chain zone_lan_postrouting (1 references) num pkts bytes target prot opt in out source destination
1 0 0 postrouting_lan_rule all -- 0.0.0.0/0 0.0.0.0/0 / !fw3: Custom lan postrouting rule chain /

Chain zone_lan_prerouting (1 references) num pkts bytes target prot opt in out source destination
1 334 31432 prerouting_lan_rule all -- 0.0.0.0/0 0.0.0.0/0 / !fw3: Custom lan prerouting rule chain /

Chain zone_wan_postrouting (2 references) num pkts bytes target prot opt in out source destination
1 314 20204 MINIUPNPD-POSTROUTING all -- 0.0.0.0/0 0.0.0.0/0
2 315 20281 postrouting_wan_rule all -- 0.0.0.0/0 0.0.0.0/0 / !fw3: Custom wan postrouting rule chain / 3 315 20281 FULLCONENAT all -- 0.0.0.0/0 0.0.0.0/0 / !fw3 /

Chain zone_wan_prerouting (2 references) num pkts bytes target prot opt in out source destination
1 232 32700 MINIUPNPD all -- 0.0.0.0/0 0.0.0.0/0
2 232 32700 prerouting_wan_rule all -- 0.0.0.0/0 0.0.0.0/0 / !fw3: Custom wan prerouting rule chain / 3 232 32700 FULLCONENAT all -- 0.0.0.0/0 0.0.0.0/0 / !fw3 /

peter-tank commented 4 years ago

现在应当是搞清楚了 利益于某人的CI,试图自己拼包,发现的确是不应该从官方的发布来更新netfilter相关的东西。 FULLCONAT相关补丁与官包绝对不相容。

peter-tank commented 4 years ago

Actually, nothing do with iptables and the FULLCONENAT patch. It's my fault, I have forgot the changed listen address to 127.0.0.1, not the desired one 0.0.0.0