Centos6查看防火墙状态

service iptables status

Centos6关闭防火墙命令

service iptables stop

Centos6开启防火墙命令

service iptables start

Centos7查看防火墙状态命令

sudo systemctl status firewalld

Centos7关闭防火墙命令

systemctl stop firewalld.service

Centos7开启防火墙命令

sudo systemctl start firewalld

Centos7重启防火墙命令

firewall-cmd --reload

*Centos7查看系统所有已开放的端口

netstat -anp

Centos7查看端口是否开放命令:yes开启,no未开启

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

Centos7开放永久端口命令

firewall-cmd --add-port = 80/tcp --permanent 

Centos7添加需要开放的端口

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

Centos7移除已开放的端口

 firewall-cmd --permanent --remove-port = 80/tcp
Last modification:January 2nd, 2020 at 11:09 am
如果觉得这篇技术文章对你有用,请随意赞赏