CentOS8防火牆配置

2021-10-09 05:58:50 字數 1359 閱讀 7566

1. 檢視防火牆(firewalld)服務的狀態

# systemctl status firewalld

● firewalld.service - firewalld - dynamic firewall daemon

loaded: loaded (

/usr/lib/systemd/system/firewalld.service; disabled; vendor >

active: inactive (dead)

docs: man:

firewalld(1

)# service firewalld start

redirecting to /bin/systemctl start firewalld.service

# systemctl enable firewalld

systemctl status firewalld    # 檢視firewalld服務狀態

systemctl enable firewalld # 設定firewalld服務開機啟動

systemctl disable firewalld # 禁止firewalld服務開機啟動

service firewalld start # 開啟

service firewalld restart # 重啟

service firewalld stop # 關閉

2. 檢視防火牆的狀態
# firewall-cmd --state

running

# 檢視防火牆規則 注意:ssh的22埠預設開啟,且不在該列表中

firewall-cmd --list-all

# 開放某個埠 如80

firewall-cmd --permanent --add-port=

80/tcp

# 開放某個範圍內的埠 如10000

-11000

firewall-cmd --permanent --add-port=

10000

-11000

/tcp

# 移除某個埠 如80

firewall-cmd --permanent --remove-port=

80/tcp

# 移除某個範圍內的埠 如10000

-11000

firewall-cmd --permanent --remove-port=

10000

-11000

/tcp

firewall-cmd --reload

3. 外部網路設定

centos8防火牆配置

1 安裝 yum install iptables services 安裝iptables 2 systemctl使用 systemctl unmask firewalld 執行命令,即可實現取消服務的鎖定 systemctl mask firewalld 下次需要鎖定該服務時執行 systemct...

centos8禁用防火牆

輸入 systemctl status firewalld.service檢視防火牆狀態 框中 active running 顯示防火牆處於啟用狀態 輸入 systemctl stop firewalld.service執行停止執行防火牆命令 輸入 systemctl status firewall...

CentOS8的基礎防火牆配置

yum install iptables services 安裝iptables systemctl unmask firewalld 執行命令,即可實現取消服務的鎖定 systemctl mask firewalld 下次需要鎖定該服務時執行 systemctl start firewalld.s...