如何用 iptables 替换 FirewallD CentOS 7

引导攻击和 恶意软件 网站上的信息是每天的订单, 安全解决方案 尽力跟上并面对日常挑战。
除复杂的软件应用程序外,还能够自动识别,分析和阻止 电脑攻击 在Web服务器上,还有一些手动解决方案可用来阻止攻击的IP。

开始 CentOS 7,默认输入 FirewallD 作为防火墙管理实用程序。
FirewallD是一个完整的防火墙解决方案,可以对其进行配置和运行 命令行 防火墙-cmd。 不是全部 administrator但是,服务器熟悉 FirewallD 语法并喜欢它 iptables的 而不是此实用程序。

如何用 iptables 替换 FirewallD CentOS 7

首先,我们需要访问 的特权 administrator 在操作系统上。 最好直接使用““中 terminal 或通过 SSH的.

1.停止运行FirewallD服务 CentOS 7 执行命令行:

sudo systemctl stop firewalld

2、禁止FirewallD在系统重启后自动启动:

sudo systemctl disable firewalld

3.我们屏蔽了FirewallD服务,以防止它被另一个进程启动:

sudo systemctl mask --now firewalld

完成此步骤后,FirewallD服务被关闭并完全关闭 CentOS 7.

安装和运行 iptables CentOS 7

第一步是安装iptables服务 CentOS 7.

1.运行命令行进行安装 iptables服务:

sudo yum install iptables-services

2.我们启动用于IPv4和IPv6的iptables服务:

sudo systemctl start iptables
sudo systemctl start ip6tables

3.在启动操作系统时激活iptables服务的自动启动:

sudo systemctl enable iptables
sudo systemctl enable ip6tables

4.我们检查iptables服务是否正常运行:

sudo systemctl status iptables
sudo systemctl status ip6tables

上面的命令应该返回结果:

● iptables.service - IPv4 firewall with iptables
   Loaded: loaded (/usr/lib/systemd/system/iptables.service; enabled; vendor preset: disabled)
   Active: active (exited) since Thu 2020-07-09 07:02:51 UTC; 21min ago
 Main PID: 13765 (code=exited, status=0/SUCCESS)

Jul 09 07:02:51 server.name systemd[1]: Starting IPv4 firewall with iptables...
Jul 09 07:02:51 server.name iptables.init[13765]: iptables: Applying firewall rules: [  OK  ]
Jul 09 07:02:51 server.name systemd[1]: Started IPv4 firewall with iptables.

5.我们使用命令行检查iptables中的规则:

sudo iptables -nvL
sudo ip6tables -nvL

如果您达到了这一点,就可以使用该服务 关闭防火墙D,取而代之的是 安装的iptables运行正常 可以通过 命令语法 具体。

作为科技爱好者,我从2006年开始在StealthSettings.com上愉快地撰写文章。我在操作系统方面有丰富的经验,包括macOS、Windows和Linux,还熟悉编程语言和博客平台(WordPress),以及在线商店平台(WooCommerce、Magento、PrestaShop)。

如何以 » Curiosity » 如何用 iptables 替换 FirewallD CentOS 7
发表评论