centos7 firewall指定IP与端口、端段访问(实测有效)
文章原址:https://www.cnblogs.com/xiaohanlin/p/11641273.html
centos7 firewall指定IP与端口、端段访问(常用)
1、启动防火墙
systemctl start firewalld.service
2、指定IP与端口
firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="192.168.142.166" port protocol="tcp" port="5432" accept"
3、重新载入,使配置生效
systemctl restart firewalld.service
4、查看配置结果
firewall-cmd --list-all
5、删除规则
firewall-cmd --permanent --remove-rich-rule="rule family="ipv4" source address="192.168.142.166" port protocol="tcp" port="11300" accept"