CentOS 7系統 1. 防火牆操作命令 (1)查看防火牆狀態 systemctl status firewalld (2)重啟防火牆 firewall-cmd --reload (3)關閉防火牆 systemctl stop firewalld (4)啟動防火牆 systemctl start ...
CentOS 7系統
1. 防火牆操作命令
(1)查看防火牆狀態
systemctl status firewalld
(2)重啟防火牆
firewall-cmd --reload
(3)關閉防火牆
systemctl stop firewalld
(4)啟動防火牆
systemctl start firewalld
(5)禁用防火牆開機自啟
systemctl disable firewalld
(6)啟動防火牆開機自啟
systemctl enable firewalld
(7)查看版本
firewall-cmd --version
(8)查看幫助
firewall-cmd --help
2. 埠操作命令
(1)查看所有已開放埠
firewall-cmd --list-port
(2)查看某個埠是否開放
firewall-cmd --query-port=埠號/協議(tcp/udp)
(3)拒絕所有包
firewall-cmd --panic-on
(4)取消拒絕所有包
firewall-cmd --panic-off
(5)查看是否拒絕接收包
firewall-cmd --query-panic
(6)開啟埠
firewall-cmd --zone=public --add-port=埠號/協議(tcp/udp) --permanent
(7)移除埠
firewall-cmd --zone=public --remove-port=埠號/協議(tcp/udp) --permanent
參數含義:
--zone
: 作用域
--add-port=埠號/協議(tcp/udp)
: 添加埠
--remove-port=埠號/協議(tcp/udp)
: 移除埠
--permanent
: 永久生效,重啟後已久生效
3. CentOS 7 下安裝firewall
yum install firewalld