How to add a port to the CentOS firewall?

To add firewall ports in CentOS system, you can use the Firewalld firewall management tool. Here is how to add ports using Firewalld in CentOS system.

  1. Ensure that the Firewalld service has been started and is running. You can use the following command to check the status of the Firewalld service:
sudo systemctl status firewalld
  1. Add the port you want to open using the following command, for example, to add port 80.
sudo firewall-cmd --zone=public --add-port=80/tcp --permanent

This will permanently open TCP port 80 in the public area.

  1. Reload the Firewalld configuration to apply the changes.
sudo firewall-cmd --reload
  1. You can use the following command to view the list of open ports:
sudo firewall-cmd --list-ports

By following the steps above, you can use the Firewalld firewall management tool to add ports on a CentOS system.

 

More tutorials

How can I change the firewall port in CentOS 7?(Opens in a new browser tab)

How to enable and disable the firewall on CentOS 7(Opens in a new browser tab)

What is the method for reloading the network interface card in Linux?(Opens in a new browser tab)

How to check the SSH status in CentOS?(Opens in a new browser tab)

What are the steps for configuring environment variables in CentOS 7?(Opens in a new browser tab)

Leave a Reply 0

Your email address will not be published. Required fields are marked *


广告
Closing in 10 seconds
bannerAds