Wednesday, October 23, 2019

CentOS 7開放防火牆端口

CentOS 7使用firewalld代替了原來的iptables。下面記錄如何使用firewalld開放CentOS 7端口:

開放端口(以80端口為例)

firewall-cmd --zone=public --add-port=80/tcp --permanent

命令含義:

–zone #作用域

–add-port=80/tcp #添加端口,格式為:端口/通訊協議

–permanent #永久生效,沒有此參數重啟後失效

重啟防火牆

firewall-cmd --reload

詳細信息可以參考以下資料:

http://stackoverflow.com/questions/24729024/centos-7-open-firewall-port

https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Security_Guide/sec-Using_Firewalls.html

Related Post

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.