- 查看防火墙所有开放的端口
firewall-cmd --zone=public --list-ports
- 开放/关闭端口
firewall-cmd --zone=public --add-port=8888/tcp --permanent
firewall-cmd --reload
firewall-cmd --zone=public --remove-port=8888/tcp --permanent
firewall-cmd --reload
- 开启/关闭/重启/查看防火墙
systemctl start firewalld.service
systemctl stop firewalld.service
systemctl restart firewalld.service
systemctl status firewalld.service
- 开机自启/禁用防火墙
systemctl enable firewalld
systemctl disable firewalld
- 查看防火墙开关状态
firewall-cmd --state
- 检查端口(例如8888)被哪个进程占用
netstat -lnpt |grep 8888
- 查看某进程(例如1234)的详细信息
ps 1234
- 杀死/中止某进程(例如5678)
kill -9 5678
- centos6和centos7网卡/网络重启
service network restart
systemctl restart network