1、查看端口开放 netstat -aptn
2、查看某个端口的应用 lsof -i:3000
3、放行指定端口
#添加指定需要开放的端口:
firewall-cmd --add-port=443/tcp --permanent
#重载入添加的端口:
firewall-cmd --reload
#查询指定端口是否开启成功:
firewall-cmd --query-port=123/tcp
4、放行指定IP
firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="172.16.110.55" accept"
#重新载入 firewall-cmd --reload
查看iptables策略
iptables -L
1
对应文件在/etc/sysconfig/iptables,如果找不到
执行service iptables save,如果上述命令执行失败报出:The service command supports only basic LSB actions (start, stop, restart, try-restart, reload, force-reload, status). For other actions, please try to use systemctl.
解决方法:
#安装或更新
yum install iptables-services
#再执行
service iptables save
执行完毕之后/etc/syscofig/iptables文件就有了
————————————————
版权声明:本文为CSDN博主「掌心里的海-Canace」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/m0_37911384/article/details/101545992