linux open (permanent) port

1. Run the command

firewall-cmd --get-active-zones

Here you can see the name of the zone

2. Run to open port

Here I want to open port is 8090, if you want to open a different port, automatically change the port name.

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

 Command Meaning:

--zone # Scope

--add-port = 80 / tcp # Add port, the format is: port / protocol

--permanent # permanent, this parameter does not restart after failure

 

3. Restart the firewall

End open port is required to restart the firewall

 firewall-cmd --reload

4. Check whether to open

method one

firewall-cmd --query-port=8090/tcp

Yes means the emergence of a successful open

Method Two:

firewall-cmd --list-ports

Below you can see the port number you open.

 

Here, open port on the end of the tutorial

 

 

tips:

firewall-cmd --reload #重启firewall

systemctl stop firewalld.service #停止firewall

systemctl disable firewalld.service #禁止firewall开机启动

firewall-cmd --state #查看默认防火墙状态(关闭后显示notrunning,开启后显示running)

 

 

Published 31 original articles · won praise 4 · Views 2293

Guess you like

Origin blog.csdn.net/weixin_44663188/article/details/100169765