1、防火墙状态
1.1、查看防火墙状态(systemctl status firewalld.service或者 firewall-cmd --state)
systemctl status firewalld.service
1.2、关闭防火墙(systemctl stop firewalld.service)
systemctl stop firewalld.service
1.3、启动防火墙(systemctl start firewalld.service或者重启systemctl restart firewalld.service)
systemctl start firewalld.service
systemctl restart firewalld.service
2、开放端口
2.1 查看防火墙所有开放的端口
firewall-cmd --zone=public --list-ports
2.2 开放
firewall-cmd --zone=public --add-port=3306/tcp --permanent
2.3 关闭
firewall-cmd --zone=public --remove-port=3306/tcp --permanent
2.4 配置立即生效
firewall-cmd --reload
3、查看监听的端口
netstat -lnpt
4、检查端口被哪个进程占用
netstat -lnpt |grep 3306
5、查看进程详细信息
ps 171101
6、中止进程
kill -9 171101