请教一个配置 iptables 允许转发 L2tp over ipsec 问题

2020-05-08 21:17:17 +08:00
 kaminic

家里一台 nas 做旁路由用

nas: 192.168.1.66

主路由: 192.168.1.1

nas 的 iptables 配置为:

iptables -t nat -N TP
iptables -t nat -A TP -d 192.168.1.0/16 -j RETURN
iptables -t nat -A TP -d 172.16.0.0/20 -j RETURN
iptables -t nat -A TP -d 10.0.0.0/24 -j RETURN
iptables -t nat -A TP -p tcp -j REDIRECT --to-ports 7892
iptables -t nat -A PREROUTING -p tcp -j TP

PC 上设置网关为 nas 的地址,此时可以正常上网, 但是 PC 上原来正常的 VPN 不能正常连接了,把网关改会主路由的地址就没问题

是需要在 nas 里配置 iptables 转发 l2tp 相关协议数据吗?如何配置?

3087 次点击
所在节点    Linux
1 条回复
pubby
2020-05-08 21:53:13 +08:00
我们一台 VPN 网关用来屏蔽一些不走 ipsec 的 l2tp 客户端,仅供参考:

# drop unencrypted L2TP connection
/sbin/iptables -A INPUT -i eth0 -p udp --dport 1701 -m policy --dir in --pol ipsec -j ACCEPT >>/dev/null 2>&1
/sbin/iptables -A INPUT -i eth0 -p udp --dport 1701 -j DROP >>/dev/null 2>&1

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

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

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

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

© 2021 V2EX