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

2014 年 12 月 18 日
 zq9610
4129 次点击
所在节点    问与答
13 条回复
msg7086
2014 年 12 月 18 日
因为没把iptables配置放进启动脚本里?
luo362722353
2014 年 12 月 18 日
直接把防火墙关了
msg7086
2014 年 12 月 18 日
@luo362722353 那就完全废了。没防火墙怎么转发……
ryd994
2014 年 12 月 18 日
service iptables save
service iptables enable
luo362722353
2014 年 12 月 18 日
service iptables stop
chkconfig iptables off
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
dianyong
2014 年 12 月 18 日
建议也别 service iptables save 了,debian和rhel的保存方式还不一样。
直接把规则写进脚本,放在 /etc/rc.local 开机加载就行了。
spritefly
2014 年 12 月 18 日
imn1
2014 年 12 月 18 日
debian 需要用 root 账户(sudo 也不行)执行 iptables-save,不然重启后 iptables 将恢复到上一次 save 的规则
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
2014 年 12 月 18 日
#!/bin/bash
iptables-restore < /etc/iptables.rules

补上...
sam12321
2014 年 12 月 18 日
直接放rc.local
TheCure
2014 年 12 月 18 日
要么放rc.local
要么save 然后在/etc/interfaces里默认加载
zq9610
2014 年 12 月 18 日
@luo362722353
# service iptables stop
iptables: 未被识别的服务
# chkconfig iptables off
在 iptables 服务中读取信息时出错:没有那个文件或目录

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/154748

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX