You are not logged in.

#1 2026-09-18 15:08:44

Koda
Member
Registered: 2025-12-30
Posts: 9

Can't open ports with firewalld

Hello, I'm trying to open a port, but I can't get it to work.

I've tried to run these commands:

$ sudo firewall-cmd --zone=public --add-port 50000/tcp
Warning: ALREADY_ENABLED: '50000:tcp' already in 'public'
success
                                                                                                                    
$ sudo firewall-cmd --add-port 50000/tcp                                                               
Warning: ALREADY_ENABLED: '50000:tcp' already in 'public'
success
                                                                                                                     
$ sudo firewall-cmd --reload
success
                                                                                                                     
$ sudo firewall-cmd --list-ports
                                                                                                                     
$ sudo firewall-cmd --zone=public --remove-port 50000/tcp
Warning: NOT_ENABLED: '50000:tcp' not in 'public'
success

I have no idea on where to start to get it to run, any help please? thank you

edit: I don't know what information might be of use for you to see, I will add them to the post  as needed

Last edited by Koda (2026-09-18 15:09:43)

Offline

#2 2026-09-18 15:22:57

csmnn
Member
Registered: 2017-05-10
Posts: 29

Re: Can't open ports with firewalld

Hi! Can't help too much with firewalld zones, but firewalld usually keeps your runtime-changes only until you reload firewalld. That way bogus changes would not automatically be applied on your next reboot/reload.

So

sudo firewall-cmd --reload

is resetting your changes to the last saved state from your config.

You can open the ports with your "--add-port" command and directly check if that did work. If they do, you can use

firewall-cmd --runtime-to-permanent

to make them survive your next call of:

firewall-cmd --reload

The documentation of firewalld lives here if you want to dig deeper into the concepts: https://firewalld.org/documentation/how … rvice.html

Offline

#3 2026-09-18 16:35:37

Koda
Member
Registered: 2025-12-30
Posts: 9

Re: Can't open ports with firewalld

That seems to fix my problem with firewalld. However, when trying to see if they are open (via port checker website) it tells me that the port is closed (I opened it for both TCP and UDP). Do you know why?

Offline

#4 2026-09-18 17:02:48

csmnn
Member
Registered: 2017-05-10
Posts: 29

Re: Can't open ports with firewalld

How is the machine connected to the internet?
Are we talking about a VPS that is directly reachable or is this a machine on a local network that sits behind a router and is not directly reachable from the internet?

If it is a VPS: you could try disabling your firewall temporarily and check if the port is reachable then.
If it is in a local network: you might need to open and forward the port at additional hops in your network.

Offline

#5 2026-09-18 18:00:24

cryptearth
Member
Registered: 2024-02-03
Posts: 2,352

Re: Can't open ports with firewalld

aside from the port scanner failing (are you behind a (cg-)nat router? is there actually some service listening to that port to accept incomming connections?) another way to configure your firewall is the other way around

first, add the new rule to the config only

firewall-cmd --permanent --zone=public --add-port 50000/tcp

note: this does not yet enable that new rule

and then second, reload to apply the config

firewall-cmd --reload

note: this only applies rules already in the config and reverts everything only added to runtime without --permanent and not yet saved to the config via --runtime-to-permanent

it's a "take your poison" approach: either edit the config and then load it - or edit the runtime and then save that to the config

Online

#6 2026-09-18 18:13:11

Koda
Member
Registered: 2025-12-30
Posts: 9

Re: Can't open ports with firewalld

csmnn wrote:

How is the machine connected to the internet?
Are we talking about a VPS that is directly reachable or is this a machine on a local network that sits behind a router and is not directly reachable from the internet?

If it is a VPS: you could try disabling your firewall temporarily and check if the port is reachable then.
If it is in a local network: you might need to open and forward the port at additional hops in your network.

It's in a local network, but I'm not the network's admin

Offline

#7 2026-09-19 05:52:16

cryptearth
Member
Registered: 2024-02-03
Posts: 2,352

Re: Can't open ports with firewalld

then the external port scanner fails at the routers nat firewall - which would need to be opened as well

Online

Board footer

Powered by FluxBB