Debian/Ubuntu上iptables是不会保存已经设置的防火墙规则,即重启之后,之前的iptables规则就丢失了,曾经的心血也就付诸东流了…那么我们就手动让iptables在Debian下也能保存吧!
1)保存iptables现有规则到/etc/iptables.rules
iptables-save > /etc/iptables.rules
2)建立系统启动加载文件/etc/network/if-pre-up.d/iptables
vi /etc/network/if-pre-up.d/iptables
输入以下内容
#!/bin/bash
/sbin/iptables-restore < /etc/iptables.rules
3)让文件具备执行权限
chmod +x /etc/network/if-pre-up.d/iptables
原文链接:http://www.vmvps.com/save-iptables-setting-under-debian-environment.html
站点名称:Sword's Blog 杂货屋
本文链接:http://www.sword.studio/46.html
本博客所有文章除特别声明外,均采用知识共享署名-非商业性使用 4.0 国际许可协议 进行许可
您可以自由的转载和修改,但请务必注明文章来源并且不可用于商业目的