Debian下保存iptables防火墙规则

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

Last modification:August 19th, 2018 at 04:32 pm
If you think my article is useful to you, please feel free to appreciate

Leave a Comment