centos7防火墙firewall指定IP与端口访问
原创
©著作权归作者所有:来自51CTO博客作者运维胡一刀的原创作品,请联系作者获取转载授权,否则将追究法律责任
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、查看配置结果
5、删除规则
firewall-cmd --permanent --remove-rich-rule="rule family="ipv4" source address="192.168.142.166" port protocol="tcp" port="11300" accept"