如何在Ubuntu,CentOS,Fedora,Debian,Kali,Mint中永久保存和恢复Iptables规则?

Iptables is standard and popular firewall provides by Linux distributions like Ubuntu, CentOS, Fedora, Debian etc. Iptables rules are managed in run time where a lot of rules are added, changed and remove. These changes are temporary changes where only running configuration is changed but do not saved temporarily. In this tutorial we will look how to save iptables rules permanently in Linux.

iptables是标准的,由Linux发行版(如Ubuntu,CentOS,Fedora,Debian等)提供的流行防火墙。iptables规则在运行时进行管理,其中添加,更改和删除了许多规则。 这些更改是临时更改,其中仅更改正在运行的配置,但不会临时保存。 在本教程中,我们将研究如何在Linux中永久保存iptables规则。

在Debian,Ubuntu,Mint,Kali中保存Ipv4规则 (Save Ipv4 Rules in Debian, Ubuntu, Mint, Kali)

We can use iptables-save command which will save the current iptables rules into /etc/iptables/rules.v4

我们可以使用iptables-save命令将当前的iptables规则保存到/etc/iptables/rules.v4

$ iptables-save > /etc/iptables/rules.v4

在CentOS,Fedora,RedHat中保存ipv4规则 (Save Ipv4 Rules in CentOS, Fedora, RedHat)

We can use iptables-save command which will save the current iptables rules into /etc/sysconfig/iptables

我们可以使用iptables-save命令将当前的iptables规则保存到/etc/sysconfig/iptables

$ iptables-save > /etc/sysconfig/iptables

在Debian,Ubuntu,Mint,Kali中保存Ipv6规则 (Save Ipv6 Rules in Debian, Ubuntu, Mint, Kali)

We can use iptables-save command which will save the current IPv6 iptables rules into /etc/iptables/rules.v6

我们可以使用iptables-save命令将当前的IPv6 iptables规则保存到/etc/iptables/rules.v6

$ ip6tables-save > /etc/iptables/rules.v6

在CentOS,Fedora,RedHat中保存ipv6规则 (Save Ipv6 Rules in CentOS, Fedora, RedHat)

We can use ip6tables-save command which will save the current IPv6 iptables rules into /etc/sysconfig/ip6tables

我们可以使用ip6tables-save命令将当前的IPv6 iptables规则保存到/etc/sysconfig/ip6tables

$ ip6tables-save > /etc/sysconfig/ip6tables

iptables-persistent软件包,用于Debian,Ubuntu,Mint,Kali (iptables-persistent Package For Debian, Ubuntu, Mint, Kali)

Debian, Ubuntu, Kali and Mint provides package named iptables-persistent. This package will automatically save the iptables rules to the /etc/iptables/rules and also automatically load during boot. The rule names will be rules.v4 for IPv4 and rules.v6 for IPv6

Debian,Ubuntu,Kali和Mint提供了名为iptables-persistent软件包。 该软件包将自动将iptables规则保存到/etc/iptables/rules并在引导过程中自动加载。 该规则的名称将是rules.v4 IPv4和rules.v6对IPv6

在Debian,Ubuntu,Mint,Kali中还原/重新加载Ipv4规则 (Restore/Reload Ipv4 Rules in Debian, Ubuntu, Mint, Kali)

We can restore IPv4 iptables rules with the iptables-restore command from /etc/iptables/rules.v4

我们可以从/etc/iptables/rules.v4使用iptables-restore命令恢复IPv4 iptables规则。

$ iptables-restore < /etc/iptables/rules.v4

在CentOS,Fedora,RedHat中还原/重新加载Ipv4规则 (Restore/Reload Ipv4 Rules in CentOS, Fedora, RedHat)

We can restore IPv4 iptables rules with the iptables-restore command from /etc/sysconfig/iptables

我们可以使用/etc/sysconfig/iptablesiptables-restore命令恢复IPv4 iptables规则

$ iptables-restore < /etc/sysconfig/iptables

在Debian,Ubuntu,Mint,Kali中还原/重新加载Ipv6规则 (Restore/Reload Ipv6 Rules in Debian, Ubuntu, Mint, Kali)

We can restore IPv6 iptables rules with the ip6tables-restore command from /etc/iptables/rules.v6

我们可以从/etc/iptables/rules.v6使用ip6tables-restore命令恢复IPv6 iptables规则。

$ ip6tables-restore < /etc/iptables/rules.v6

在CentOS,Fedora,RedHat中还原/重新加载Ipv6规则 (Restore/Reload Ipv6 Rules in CentOS, Fedora, RedHat)

We can restore IPv6 iptables rules with the ip6tables-restore command from /etc/sysconfig/ip6tables

我们可以从/etc/sysconfig/ip6tables使用ip6tables-restore命令恢复IPv6 iptables规则

$ ip6tables-restore < /etc/iptables/ip6tables
LEARN MORE  How To Start, Stop and Enable, Disable Iptables or Ufw In Ubuntu, Debian, Kali, Mint
了解更多信息如何在Ubuntu,Debian,Kali,Mint中启动,停止和启用,禁用Iptables或Ufw

翻译自: https://www.poftut.com/how-to-save-and-restore-iptables-rules-permanently-in-ubuntu-centos-fedora-debian-kali-mint/

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值