Lsof -i :22 Knows which process occupies port 22
Netstat LNP | grep 7000 to check 7000 port is occupied by a which process
Open ports
Method 1 1. Enable the firewall
systemctl start firewalld
systemctl stop firewalld
Copy the code
2. Open the specified port
firewall-cmd --zone=public --add-port=1935/tcp --permanent
Copy the code
Description of the command: –zone # scope –add-port=1935/ TCP # Add port. The format is: port/communication protocol –permanent # Permanent
3. Restart the firewall
firewall-cmd --reload
Copy the code
4. Check the port number
Netstat NTLP / / view the current all TCP port netstat ntulp | grep / 1935 / see all 1935 port usageCopy the code
Mode 2 # Open port :8080
/sbin/iptables -I INPUT -p tcp --dport 8080 -j ACCEPT
Copy the code
Methods 3
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
service iptables restart
Copy the code