Port not open (ufw disabled)

On the server, running Ubuntu 22.04

sudo netstat -tnlp | grep :4000

tcp        0      0 0.0.0.0:4000            0.0.0.0:*               LISTEN      10690/nxd           
tcp6       0      0 :::4000                 :::*                    LISTEN      10690/nxd           

The service responds to HTTP request:

curl localhost:4000
curl: (52) Empty reply from server

ufw is disabled

sudo ufw status
Status: inactive

From client (same subnet) machine:

nc -zv 192.168.1.111 4000
nc: connect to 192.168.1.111 port 4000 (tcp) failed: No route to host

SSh is enabled

nc -zv 192.168.1.111 22
Connection to 192.168.1.111 22 port [tcp/ssh] succeeded!

Ping works:

ping 192.168.1.111
PING 192.168.1.111 (192.168.1.111) 56(84) bytes of data.
64 bytes from 192.168.1.111: icmp_seq=1 ttl=64 time=309 ms
Asked By: Jasmeet Singh

||

I don’t have enough rep to be able to post a comment – so an answer will have to do…

You’ve checked ‘ufw’ but you could have a different firewall configured. Try the following :

sudo firewall-cmd --state
sudo firewall-cmd --list-all

If the state is enabled ("running") you can add port 4000 with :

sudo firewall-cmd --add-port 4000/tcp
sudo firewall-cmd --permanent --add-port 4000/tcp
Answered By: Rich Sedman