如何用 iptables 替換 FirewallD CentOS 7

引導攻擊和 惡意軟件 網站上的信息是每天的訂單, 安全解決方案 盡力跟上並面對日常挑戰。
除複雜的軟件應用程序外,還能夠自動識別,分析和阻止 電腦攻擊 在Web服務器上,還有一些手動解決方案可用來阻止攻擊的IP。

CentOS 7,默認輸入 FirewallD 作為防火牆管理實用系統。
FirewallD是一個完整的防火牆解決方案,可以對其進行配置和運行 命令行 防火牆-cmd。 不是全部 administrator但是,服務器熟悉 FirewallD 語法並喜歡它 iptables的 而不是此實用程序。

如何用 iptables 替換 FirewallD CentOS 7

首先,我們需要訪問 的特權 administrator 在操作系統上。 最好直接使用““以 terminalSSH.

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運行正常 並且可以通過以下方式管理 命令語法 具體。

對技術充滿熱情,我很高興寫 StealthSettings.com 自 2006 年起。我在作業系統方面擁有豐富的經驗: macOS, Windows 對 Linux,而且還包括程式語言和部落格平台(WordPress)和線上商店(WooCommerce、Magento、PrestaShop)。

如何 » Curiosity » 如何用 iptables 替換 FirewallD CentOS 7
發表評論