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
| improve this question | | | | |
  • Try firewall-cmd --reload. Is there something listening on port 5000? – Valentin Bajrami Jul 20 '17 at 7:19
  • @val0x00ff yes its listening cause this gives me yes firewall-cmd --zone=public --query-port=5000/tcp – user8012596 Jul 20 '17 at 7:22
  • @val0x00ff if I off my firewall then it works – user8012596 Jul 20 '17 at 7:22
  • @user8012596, what give you netstat -an|grep 5000? – Romeo Ninov Jul 20 '17 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. – Valentin Bajrami Jul 20 '17 at 7:33

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

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

It works.

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.