V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
kaminic
V2EX  ›  Linux

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

  •  
  •   kaminic · 2020-05-08 21:17:17 +08:00 · 3023 次点击
    这是一个创建于 1455 天前的主题,其中的信息可能已经有所发展或是发生改变。

    家里一台 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 相关协议数据吗?如何配置?

    1 条回复    2020-05-08 21:53:13 +08:00
    pubby
        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
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2061 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 01:26 · PVG 09:26 · LAX 18:26 · JFK 21:26
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.