I have port 5000 via the firewalld in centos 7 as shown below.

 firewall-cmd --list-all
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: ens32
  services: dhcpv6-client http ssh
  ports: 5000/tcp
  masquerade: no
  rich rules:

Then I check my active zone f

firewall-cmd --get-active-zones

Then I check the port itself

firewall-cmd --zone=public --query-port=5000/tcp

But when I telnet to the port 5000 is not responding what else could be missing in terms of configuration ?

I have checked there is not other firewall cause when I run this systemctl stop firewalld all works fine.

Here is what and how I run the telnet commands

Microsoft Telnet> o *.*.*.*  5000
Connecting To *.*.*.*...Could not open connection to the host, on port  50
00: Connect failed
  • Try firewall-cmd --reload. Is there something listening on port 5000? Commented Jul 20, 2017 at 7:19
  • @val0x00ff yes its listening cause this gives me yes firewall-cmd --zone=public --query-port=5000/tcp Commented Jul 20, 2017 at 7:22
  • @val0x00ff if I off my firewall then it works Commented Jul 20, 2017 at 7:22
  • @user8012596, what give you netstat -an|grep 5000? Commented Jul 20, 2017 at 7:23
  • 1
    @user8012596 did you call firewall-cmd --reload command after adding the port? Also pass --permanent to firewall-cmd to persist the rule otherwise it won't survive reboots. Commented Jul 20, 2017 at 7:33

2 Answers 2


I don't know why, but when I execute this command:

firewall-cmd --zone=public --permanent --add-masquerade
firewall-cmd --reload

It works.


You are not able to connect to the port=5000 because the server is not listing on that port.

You can check on which port server is listing:

sudo lsof -i -P -n | grep LISTEN
sudo netstat -tulpn | grep LISTEN
sudo lsof -i:5000
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Oct 6, 2021 at 17:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .