In firewalld, you can define which ports to allow through using the following methods:
To allow a specific port (e.g., TCP port 8080), run:
sudo firewall-cmd --zone=public --add-port=8080/tcp --permanent |
Then reload the firewall to apply changes:
sudo firewall-cmd --reload |
For a range of ports (e.g., 5000-5100), use:
sudo firewall-cmd --zone=public --add-port=5000-5100/tcp --permanent sudo firewall-cmd --reload |
If the service you need is predefined in firewalld, you can allow it by name instead:
sudo firewall-cmd --zone=public --add-service=http --permanent sudo firewall-cmd --reload |
To list available services:
firewall-cmd --get-services |
To verify which ports are open:
sudo firewall-cmd --list-ports |