阿里雲服務器、CentOS7開啓、關閉防火牆命令

CentOS7使用的是firewall防火牆,不再是原來的iptables

1:查看firewall防火牆狀態

firewall-cmd --state

或者

systemctl status firewalld

2:打開防火牆

systemctl start firewalld

3:關閉防火牆

systemctl stop firewalld

4:重啓防火牆

firewall-cmd --relaod

或者

systemctl reload firewalld

5:開機自啓動防火牆

systemctl enable firewalld

6:禁止開機啓動防火牆

systemctl disable firewalld

6:查看已打開的端口

firewall-cmd --list-ports

7:打開端口

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

其中permanent表示永久生效,public表示作用域,8080/tcp表示端口和類型

8:關閉端口

firewall-cmd --permanent --zone=public --remove-port=8080/tcp
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章