centos7添加firewalld规则


#允许192.168.142.166访问5432端口
[root@henry ~]# firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="192.168.142.166" port protocol="tcp" port="5432" accept" --permanent 
#允许所有IP访问80端口 --permanent 表示永久生效,不加重启就会失效
[root@henry ~]# firewall-cmd --zone=public --add-port=80/tcp --permanent 
#删除某条规则
[root@henry ~]# firewall-cmd --permanent --remove-rich-rule="rule family="ipv4" source address="192.168.142.166" port protocol="tcp" port="11300" accept"
#查看规则
[root@henry ~]# firewall-cmd --list-all
#每次修改规则之后都要重启firewalld才会生效
[root@henry ~]# systemctl restart firewalld 

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM