CentOS7 command to view open ports and open port number

 

View open ports

firewall-cmd --list-ports

Open port (after opening the firewall need to restart to take effect)

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

Restart the firewall

firewall-cmd --reload

Close the port (after turning off the firewall need to restart to take effect)

firewall-cmd --zone=public --remove-port=3338/tcp --permanent

Boot Firewall

systemctl enable firewalld

Open the firewall

systemctl start firewalld

Prohibit the firewall boot

systemctl disable firewalld

Stop firewall

systemctl stop firewalld

View open ports

firewall-cmd --list-ports

Open port (after opening the firewall need to restart to take effect)

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

Restart the firewall

firewall-cmd --reload

Close the port (after turning off the firewall need to restart to take effect)

firewall-cmd --zone=public --remove-port=3338/tcp --permanent

Boot Firewall

systemctl enable firewalld

Open the firewall

systemctl start firewalld

Prohibit the firewall boot

systemctl disable firewalld

Stop firewall

systemctl stop firewalld

Guess you like

Origin www.cnblogs.com/myJuly/p/11810771.html