ecc
V2EX  ›  问与答

iptables 端口映射的问题

  •  
  •   ecc · Nov 5, 2014 · 2448 views
  •   You need to sign in to view this topic
    This topic created in 4213 days ago, the information mentioned may be changed or developed.
    搭了一个VPN, 公网地址为x.x.x.x, 分配了VPN内网地址为10.100.2-10, 现在通过在路由上PPTP直拔VPN, 路由下面连三台主机, 均需要使用3074端口, 能否实现

    如果使用iptables映射给10.100.0.2,
    iptables -t nat -A PREROUTING -d x.x.x.x -p tcp --dport 3074 -j DNAT --to-dest 10.100.0.2:3074
    iptables -t nat -A PREROUTING -d x.x.x.x -p udp --dport 3074 -j DNAT --to-dest 10.100.0.2:3074
    那剩下的两台怎么办
    1 replies    2014-11-05 16:47:55 +08:00
    rungo
        1
    rungo  
       Nov 5, 2014
    如果是三台主机都要bind到公网的3074那估计不行。三台主机只是用3074本地端口连公网,路由器直接nat就可以了吧,
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1934 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 00:01 · PVG 08:01 · LAX 17:01 · JFK 20:01
    ♥ Do have faith in what you're doing.