天天看點

CentOS 7 防火牆的系列操作

 1、開啟防火牆(firewall)

systemctl start firewalld      
CentOS 7 防火牆的系列操作

2、檢視防火牆(firewall)狀态

firewall-cmd --state      
CentOS 7 防火牆的系列操作

3、 停止防火牆(firewall)

systemctl stop firewalld.service      
CentOS 7 防火牆的系列操作

 4、重新開機防火牆(firewall)

firewall-cmd --reload      
CentOS 7 防火牆的系列操作

 5、開放指定端口

firewall-cmd --zone=public --add-port=3306/tcp --permanent      
CentOS 7 防火牆的系列操作

 指令含義:

--zone #作用域

--add-port=3306/tcp #添加端口,格式為:端口/通訊協定

--permanent #永久生效,沒有此參數重新開機後失效

 6、檢視端口号

netstat -ntlp //檢視目前所有tcp端口·
netstat -ntulp |grep 3306 //檢視所有3306端口使用情況·      
CentOS 7 防火牆的系列操作

 7、禁止firewall開機啟動

systemctl disable firewalld.service      
CentOS 7 防火牆的系列操作

繼續閱讀