1、查看状态。
默认情况下,Centos6 使用的是iptables,Centos7 使用的是firewalld。
systemctl status iptables systemctl status firewalld
2、查看当前端口开放情况
sudo firewall-cmd --list-all
3、添加端口
sudo firewall-cmd --zone=public --permanent --add-port=8080/tcp
4、成功后需要重启服务才能生效
sudo systemctl restart firewalld
本文介绍了在CentOS系统中如何查看和管理防火墙规则,特别是针对CentOS6和CentOS7的区别。默认情况下,CentOS6使用iptables,而CentOS7使用firewalld。通过systemctl status命令检查服务状态,使用firewall-cmd列出所有开放端口,添加端口如8080/tcp,并在添加后重启firewalld服务以使更改生效。
1672

被折叠的 条评论
为什么被折叠?



