openwrt 中配置了 netbird 并添加了路由 如何使 openwrt 后面的电脑也能直接使用 netbird 创建的路由

161 天前
 ser3w

openwrt 中配置了 netbird 并添加了路由(某些 ip 走 netbird 节点) 如何使 openwrt 后面的电脑也能直接使用 netbird 创建的路由

957 次点击
所在节点    OpenWrt
5 条回复
kirile
161 天前
前段时间玩 netbird 的时候, 好像 op 上装 netbird 不需要什么额外设置, netbird 自动处理好了路由的问题, op 下面的设备直接可以访问到另外的局域网. 不像 zerotier 还要加几行 iptables 命令来处理 NAT 问题. 是不是网关不是 openwrt
ser3w
161 天前
@kirile op 下面的设备直接可以访问到另外的局域网是指可以正常访外网吗,我现在的状态是
开启 netbird
查看系统已经有 netbird 下发的路由了,op 本身可以走路由(netbird 下发的)
但 op
下面的机器访问路由管理的 ip 时直接连不通
关闭 netbird 后可以访问但这回已经不走路由了
现象很像回路 iptables 没有配置对,有点搞不清楚了
kirile
161 天前
@ser3w 那可以在 op 下的机器上 trace 下路由看看路径是否正确, 如果去程正常, 那基本是回程有问题, 就需要做 masquerade. 去程都不正常的话应该在 op 上加静态路由了
ser3w
160 天前
op 不开启 netbird 时

$ tracert 47.110.xxxxx

Tracing route to xx[47.110.xxx]
over a maximum of 30 hops:

1 1 ms <1 ms <1 ms OpenWrt.lan [192.168.11.1]
2 2 ms 1 ms 1 ms 192.168.2.1
3 2 ms 2 ms 1 ms REALTEK [192.168.1.1]
4 21 ms 8 ms 5 ms 115.199.96.1
5 * * * Request timed out.
6

op 开启 netbird 时
$ tracert 47.110.xxxx

Tracing route to xxx[47.110.xxxxx]
over a maximum of 30 hops:

1 1 ms <1 ms 1 ms OpenWrt.lan [192.168.11.1]
2 * * * Request timed out.
3 * * * Request timed out.
4

开启 netbird 的路由表
$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.2.1 0.0.0.0 UG 0 0 0 eth0
10.233.0.0 10.255.251.154 255.255.192.0 UG 0 0 0 wt0
10.233.64.0 10.255.251.154 255.255.192.0 UG 0 0 0 wt0
10.253.250.95 10.255.251.154 255.255.255.255 UGH 0 0 0 wt0
10.255.248.0 0.0.0.0 255.255.252.0 U 0 0 0 wt0
10.255.251.0 0.0.0.0 255.255.255.0 U 0 0 0 wt0
47.110.143.235 10.255.251.154 255.255.255.255 UGH 0 0 0 wt0
172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0
192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
192.168.11.0 0.0.0.0 255.255.255.0 U 0 0 0 br-lan
ser3w
155 天前
iptables -I FORWARD -o br-lan -j ACCEPT #允许 br-lan 端口流量被转发
iptables -I FORWARD -o wt0 -j ACCEPT #允许 wt0 端口流量被转发
iptables -t nat -I POSTROUTING -o wt0 -j MASQUERADE #wt0 出口的流量 SNAT 出去

可加入这 3 条 使 op 后方机器实现透明代理,但是很奇怪,只能代理国内 http 国外的 http 和 https 都行,但 op 本身是可以访问国内代理过的 https 的

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/996569

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX