How do you open ports in firewalld on Linux?
To open a port in Linux using firewalld, you can follow the steps below:
- Verify if firewalld is installed and running. You can use the following command to check:
- Show the status of the firewalld service.
- If firewalld is not installed, you can use the following command to install:
- Install firewalld using the sudo yum command.
- Start the firewalld service:
- Start the firewalld service using sudo systemctl.
- Check the default firewall rules.
- Show all firewall settings.
- Open port:
- Add a port with the specified number to the public zone in the firewall configuration permanently.
- “Among them,
is the specific port number you want to open.” - Reload the firewall rules to make the changes take effect.
- Please reload the firewall using the command sudo firewall-cmd –reload.
You have now successfully opened the specified port. You can verify if the port is open by running the following command:
sudo firewall-cmd --zone=public --list-ports