How to open a UDP port in the Centos 7 firewall, firewalld, using firewall-cmd?

5,456

Had the same issue, fixed it by running:

firewall-cmd --permanent --add-port=3000/udp

And then restarted the firewall service

systemctl restart firewalld

Finally restarted my nodjs app and it now worked as expected

Share:
5,456

Related videos on Youtube

kmiklas
Author by

kmiklas

Updated on September 18, 2022

Comments

  • kmiklas
    kmiklas over 1 year

    Centos 7 server. Trying to open port 3000 for UDP, nodejs ws websockets. Any ideas? I'm stuck! I've checked a few other SO posts to no avail. Thx, Keith =)

    • If is stop the firewall, the udp unicast works fine
    • When I start the firewall, websocket connections are getting refused, and I'm getting ERR_CONNECTION_REFUSED
    • default zone is public

    Port looks to be enabled here:

    sh-4.2# firewall-cmd --list-all
    public (default, active)
      interfaces: enp3s0
      sources: 
      services: dhcpv6-client ssh
      ports: 3000/udp 8080/tcp
      masquerade: no
      forward-ports: 
      icmp-blocks: 
      rich rules: 
    

    From a Mac on the same network:

    Mac> nc -uz 192.168.1.101 3000
    Connecion to 192.168.1.101 port 3000 [udp/hbci] succeeded!
    
    • ping to 192.168.1.101 is fine

    The only thing I can find that looks fishy is this:

    enter image description here