CentOS 防火牆常用基本命令

2021-10-08 19:26:58 字數 1326 閱讀 9087

功能

命令檢視防火牆狀態

firewall-cmd --state 或者systemctl status firewalld

開啟systemctl start firewalld

關閉systemctl stop firewalld

重啟systemctl restart firewalld

開機自啟動

systemctl enable firewalld.service

永久關閉

systemctl disable firewalld.service

檢視防火牆開放的埠

firewall-cmd --permanent --zone=public --list-ports

開放8080埠

firewall-cmd --zone=public --add-port=8080/tcp --permanent

取消8080埠

firewall-cmd --zone=public --remove-port=9200/tcp --permanent

firewall-cmd --reload

驗證新增加埠是否生效

firewall-cmd --zone=public --query-port=8080/tcp

1.檢視防火牆狀態:

firewall-cmd --state 

2.防火牆

systemctl start firewalld    開啟

systemctl stop firewalld    關閉

systemctl restart firewalld  重啟

systemctl status firewalld   狀態

3.檢視防火牆開放的埠

firewall-cmd --permanent --zone=public --list-ports

5.開放8080埠

firewall-cmd --zone=public --add-port=8080/tcp --permanent

6.取消8080埠

firewall-cmd --zone=public --remove-port=9200/tcp --permanent

firewall-cmd --reload

8.驗證新增加埠是否生效

firewall-cmd --zone=public --query-port=8080/tcp

9.防火牆開機自啟動,永久關閉

systemctl enable firewalld.service

systemctl disable firewalld.service

centos 防火牆命令

一 防火牆的開啟 關閉 禁用命令 1 設定開機啟用防火牆 systemctl enable firewalld.service 2 設定開機禁用防火牆 systemctl disable firewalld.service 3 啟動防火牆 systemctl start firewalld 4 關閉...

CentOS 防火牆常用命令

1.檢視防火牆狀態 firewall cmd state 2.啟動防火牆 systemctl start firewalld 3.關閉防火牆 systemctl stop firewalld 4.檢查防火牆開放的埠 firewall cmd permanent zone public list po...

Centos防火牆相關命令

1 開放埠 firewall cmd zone public add port 8080 tcp permanent 開放8080埠 firewall cmd zone public remove port 8080 tcp permanent 關閉8080埠 firewall cmd reload...