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