我有VPS Debian8杰西x64稳定发布。安装之后,我尝试配置iptables (就像在debian 7中一样)。
apt-get install iptables-persistent
成功执行,安装了一些数据包。但当我试着
service iptables-persistent start
我收到一个错误,显示服务iptables-persistent unrecognized
站住!
发布于 2015-06-14 23:49:19
我也偶然发现了OP的问题(然后是他的问题);在查看package description for iptables-persistent时找到了解决方案。新的接口似乎是netfilter持久化的,即使用:
# invoke-rc.d netfilter-persistent save
至少这对我是有效的。
发布于 2015-10-11 07:13:12
更新8/7/16:这取决于发行版。下面的评论内容是在不知道OP发行版是否有netfilter-persistent包的情况下输入的。我很抱歉。我的笔记本电脑发行版(Mint)不包含netfilter-persistent包,而我的服务器发行版(Ubuntu 15+)包含。
原始答案:正如Oliver所说的那样,netfilter-persistent取代了Ubuntu中的iptables-persistent。Ubuntu 15.04的工作原理如下:
安装它,然后确保它作为服务运行:service --status-all | grep netfilter-persistent
如果不是作为服务运行,请使用:invoke-rc.d netfilter-persistent start
一次性启动它
然后,您必须将脚本放在网络或其接口停止时将运行的某个位置。重要的脚本内容很简单:invoke-rc.d netfilter-persistent save
我将脚本放在/etc/network/if-post-down.d
目录中。不要忘记将其chmod为可执行文件。如果可能出现断电,您可以为save命令创建一个cron条目。
发布于 2019-04-23 10:24:34
iptables-persistent已经在debian wiki上被推荐了很多次。
要安装它,请执行以下操作:
apt install iptables-persistent
iptables-persistent创建配置文件,并使用包netfilter-persistent重新加载或保存iptables规则
iptables配置文件位于文件夹中
/etc/iptables/rules.v4
/etc/iptables/rules.v6
主要的管理工具是:
/usr/sbin/netfilter-persistent # you should be root or call sudo to use it
如果要更改iptable规则,请编辑配置文件,然后重新装载iptables规则
netfilter-persistent reload
或者您可以使用iptables -I输入...首先更改iptables规则,然后将其保存到配置文件
netfilter-persistent save
如果要清除iptables规则,可以使用flush命令
netfilter-persistent flush
https://stackoverflow.com/questions/30818931
复制相似问题