bugmenott
V2EX  ›  问与答

请问这个 iptables 命令在 debian 和 ubuntu 中一样吗?

  •  
  •   bugmenott · Jan 9, 2015 · 2328 views
    This topic created in 4175 days ago, the information mentioned may be changed or developed.
    iptables -t nat -A POSTROUTING -s 192.168.7.0/24 -j SNAT --to-source [YOUR VPS IP ADDRESS]
    我在我在ubuntu14.10下能执行,但实际没效果啊
    1 replies    2015-01-09 23:57:42 +08:00
    besto
        1
    besto  
       Jan 9, 2015
    首先,确定一下你的`/etc/sysctl.conf`文件里的`net.ipv4.ip_forward=1`是否打开,没打开请打开之后`sysctl -p` 一下。
    其次,`sudo iptables -L -t nat`查看一下 有没有生效。
    最后推荐使用 MASQUERADE规则而不是SNAT。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2865 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 15:25 · PVG 23:25 · LAX 08:25 · JFK 11:25
    ♥ Do have faith in what you're doing.