Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
kaminic
V2EX  ›  Linux

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

  •  
  •   kaminic · May 8, 2020 · 3967 views
    This topic created in 2207 days ago, the information mentioned may be changed or developed.

    家里一台 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 replies    2020-05-08 21:53:13 +08:00
    pubby
        1
    pubby  
       May 8, 2020
    我们一台 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
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   4009 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 44ms · UTC 10:17 · PVG 18:17 · LAX 03:17 · JFK 06:17
    ♥ Do have faith in what you're doing.