linux open port command

王林
王林Original
2021-04-15 14:38:2432278browse

The Linux command to open a port is [firewall-cmd --zone=public --add-port=1935/tcp --permanent]. It should be noted that we need to restart the firewall after opening the specified port.

linux open port command

#The operating environment of this article: centos 7 system, thinkpad t480 computer.

1. Open the firewall

systemctl start firewalld

2. Open the specified port

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

Command meaning:

--zone #scope

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

--permanent #Permanently effective, it will be invalid after restarting without this parameter

3. Restart the firewall

firewall-cmd --reload

4. Check the port number

netstat -ntlp   //查看当前所有tcp端口·
netstat -ntulp |grep 1935   //查看所有1935端口使用情况

Free video tutorial: linux video tutorial

The above is the detailed content of linux open port command. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn