王海庆的云笔记

CentOS7查看开放端口命令及开放端口号


开启防火墙

systemctl restart firewalld
systemctl status firewalld
systemctl enable firewalld


查看已开放的端口

firewall-cmd --list-ports


开放单个端口(开放后需要要重启防火墙才生效)

firewall-cmd --zone=public --add-port=8080/tcp --permanent


开放多个端口(开放后需要要重启防火墙才生效) 

firewall-cmd --zone=public --add-port=10000-60000/tcp --permanent


关闭端口(关闭后需要要重启防火墙才生效)

firewall-cmd --zone=public --remove-port=8080/tcp --permanent


查看端口是否打开

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


重启防火墙 (两种方式)

firewall-cmd --reload
systemctl restart firewalld


验证

python -m SimpleHTTPServer 11111
http://172.18.0.117:11111/

python -m SimpleHTTPServer 8888
http://172.18.0.117:8888/


参考

https://www.cnblogs.com/liyhbk/p/13588102.html

文章最后更新时间: 2022-03-23 13:14:56