Port Forwarding not working though ports are opened
So I am trying to open a few ports on my Almalinux server (CentOS clone) but when I use a open port checker it still says its closed. All the ports shown as opened are not when looking online. I have reloaded firewalld. I am using Firewalld and here is my output when running "sudo firewall-cmd --zone=public --list-all"
public
target: default
icmp-block-inversion: no
interfaces:
sources:
services: cockpit dhcpv6-client http https ssh
ports: 55555/tcp 8080/tcp 9981/tcp 9982/tcp 9983/tcp 25565/tcp
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
3 Replies
Would you be able to provide some more information? This post – Asking Better Questions – present some helpful ways to present information regarding the problem so that the community can provide more helpful troubleshooting steps. Some helpful things to know would be:
- The port checking tool used
- What services are running on those ports
- Any related errors in the log files
I was able to locate a similar post which suggests restarting the services on those ports as a solution. You can restart the services with the following command where $SERVICE is replaced by the name of the service:
systemctl restart $SERVICE
I'll provide the post here for further information: Unable to connect to server after FirewallD setup
To help determine if this is related to the firewall or not, you could also disable the firewall completely and then see if the port forwarding works. If it does then it is likely a firewall configuration issue, and if not then it'll help eliminate that as an option.
I am using https://www.yougetsignal.com/tools/open-ports/ to check my ports
I am not running any services on ports i've checked other than 22 for SSH.
No errors in my log file.
Ports still closed after disabling FirewallD.
I am not running any services on ports i've checked other than 22 for SSH.
Ports still closed after disabling FirewallD.
These statements seem contradictory. If you’re not running a service on the ports you’re checking, then some online tools will show them as closed - regardless of the firewall state.
interfaces:
sources:
Your public zone has no interfaces or IPs associated with it, so your rules are not going to be hit.
You will need to assign the eth0 (public) adaptor into the public zone for your services/ports to take effect.