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

Linode 的服务器配的 PPTP,为什么每次重启以后都要重新配置一遍 iptables NAT 转发才能用(上网)?

  •  
  •   zq9610 · 2014 年 12 月 18 日 · 3817 次点击
  •   查看本主题需要登录
    这是一个创建于 4049 天前的主题,其中的信息可能已经有所发展或是发生改变。
    13 条回复    2014-12-18 15:48:42 +08:00
    msg7086
        1
    msg7086  
       2014 年 12 月 18 日
    因为没把iptables配置放进启动脚本里?
    luo362722353
        2
    luo362722353  
       2014 年 12 月 18 日 via iPhone
    直接把防火墙关了
    msg7086
        3
    msg7086  
       2014 年 12 月 18 日
    @luo362722353 那就完全废了。没防火墙怎么转发……
    ryd994
        4
    ryd994  
       2014 年 12 月 18 日
    service iptables save
    service iptables enable
    luo362722353
        5
    luo362722353  
       2014 年 12 月 18 日 via iPhone
    service iptables stop
    chkconfig iptables off
    iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
    dianyong
        6
    dianyong  
       2014 年 12 月 18 日
    建议也别 service iptables save 了,debian和rhel的保存方式还不一样。
    直接把规则写进脚本,放在 /etc/rc.local 开机加载就行了。
    spritefly
        7
    spritefly  
       2014 年 12 月 18 日
    imn1
        8
    imn1  
       2014 年 12 月 18 日
    debian 需要用 root 账户(sudo 也不行)执行 iptables-save,不然重启后 iptables 将恢复到上一次 save 的规则
    Nin
        9
    Nin  
       2014 年 12 月 18 日
    vi /etc/network/if-post-down.d/iptables

    #!/bin/bash
    iptables-save > /etc/iptables.rules

    chmod +x /etc/network/if-post-down.d/iptables

    然后用同样的方式修改/etc/network/if-pre-up.d/iptables
    Nin
        10
    Nin  
       2014 年 12 月 18 日
    #!/bin/bash
    iptables-restore < /etc/iptables.rules

    补上...
    sam12321
        11
    sam12321  
       2014 年 12 月 18 日
    直接放rc.local
    TheCure
        12
    TheCure  
       2014 年 12 月 18 日
    要么放rc.local
    要么save 然后在/etc/interfaces里默认加载
    zq9610
        13
    zq9610  
    OP
       2014 年 12 月 18 日
    @luo362722353
    # service iptables stop
    iptables: 未被识别的服务
    # chkconfig iptables off
    在 iptables 服务中读取信息时出错:没有那个文件或目录
    关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   2308 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 01:21 · PVG 09:21 · LAX 17:21 · JFK 20:21
    ♥ Do have faith in what you're doing.