- 26 Views
- 20/10/2024
How to open port on firewalld service
To open a port on a system using `firewalld`, which is commonly found on CentOS, Fedora, and other RHEL-based Linux distributions, you need administrative privileges. Below are the steps to open a port on your firewall using `firewalld`:
1. Check the Status of firewalld:
First, ensure that `firewalld` is running. You can check its status with the following command:
2. List Active Zones:
`firewalld` organizes rules into zones. List the active zones with:
3. Open a Port:
To open a port, you need to specify the zone and the port number along with the protocol (TCP or UDP). If you don't specify a zone, the default zone is used. For example, to open TCP port 8080, you would use:
4. Reload firewalld:
After making changes, you need to reload `firewalld` to apply them:
5. Verify the Changes:
Finally, confirm that the port is open by listing the rules in the zone:
Remember to replace `8080/tcp` with your desired port number and protocol, and `public` with the appropriate zone if necessary. Also, using `--permanent` makes the rule persist across reboots. If you want to apply the rule immediately but not permanently, omit `--permanent` from the command.
