V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
bugmenott
V2EX  ›  问与答

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

  •  
  •   bugmenott · 2015-01-09 23:40:57 +08:00 · 1907 次点击
    这是一个创建于 3403 天前的主题,其中的信息可能已经有所发展或是发生改变。
    iptables -t nat -A POSTROUTING -s 192.168.7.0/24 -j SNAT --to-source [YOUR VPS IP ADDRESS]
    我在我在ubuntu14.10下能执行,但实际没效果啊
    1 条回复    2015-01-09 23:57:42 +08:00
    besto
        1
    besto  
       2015-01-09 23:57:42 +08:00
    首先,确定一下你的`/etc/sysctl.conf`文件里的`net.ipv4.ip_forward=1`是否打开,没打开请打开之后`sysctl -p` 一下。
    其次,`sudo iptables -L -t nat`查看一下 有没有生效。
    最后推荐使用 MASQUERADE规则而不是SNAT。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1995 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 01:26 · PVG 09:26 · LAX 18:26 · JFK 21:26
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.