開發與維運

CentOS 7 防火牆的系列操作

 1、開啟防火牆(firewall)

systemctl start firewalld

image.gif

2、查看防火牆(firewall)狀態

firewall-cmd --state

image.gif

3、 停止防火牆(firewall)

systemctl stop firewalld.service

image.gif

 4、重啟防火牆(firewall)

firewall-cmd --reload

image.gif

 5、開放指定端口

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

image.gif

 命令含義:

--zone #作用域

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

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

 6、查看端口號

netstat -ntlp //查看當前所有tcp端口·
netstat -ntulp |grep 3306 //查看所有3306端口使用情況·

image.gif

 7、禁止firewall開機啟動

systemctl disable firewalld.service

image.gif

Leave a Reply

Your email address will not be published. Required fields are marked *