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.
#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!