CentOS 7开放端口和关闭防火墙

- 1 min

开放端口

永久地开放需要的端口

$ sudo firewall-cmd --zone=public --add-port=3000/tcp --permanent
$ sudo firewall-cmd --reload

之后检查新的防火墙规则

$ sudo firewall-cmd --list-all

关闭防火墙

临时关闭防火墙,重启后会重新自动打开

$ systemctl restart firewalld

检查防火墙状态

$ firewall-cmd --state
$ firewall-cmd --list-all

Disable firewall

$ systemctl disable firewalld
$ systemctl stop firewalld
$ systemctl status firewalld

Enable firewall

$ systemctl enable firewalld
$ systemctl start firewalld
$ systemctl status firewalld

Dawson Lee

A man who loves to watch Korean dramas

rss facebook twitter github gitlab youtube mail spotify lastfm instagram linkedin google google-plus pinterest medium vimeo stackoverflow reddit quora quora