1、查看防火墙状态
firewall-cmd –state
2、放行指定端口(–permanent永久生效)
firewall-cmd –zone=public –add-port=端口号/tcp –permanent
eg:
firewall-cmd –zone=public –add-port=80/tcp –permanent # http
firewall-cmd –zone=public –add-port=443/tcp –permanent # https
3、放行范围端口
firewall-cmd –zone=public –add-port=8000-9000/tcp –permanent
4、删除防火墙端口
firewall-cmd –zone=public –remove-port=8000-8888/tcp –permanent
5、在放行端口或者是关闭端口后,都要对防火墙进行刷新
firewall-cmd –reload
6、查看防火墙某个端口是否开放
firewall-cmd –query-port=端口号/tcp
7、查看开放的端口列表
firewall-cmd –zone=public –list-ports
原创文章,作者:端木书台,如若转载,请注明出处:https://blog.ytso.com/tech/aiops/269689.html