2

I started a tcp listener using nc -l 127.0.0.1 900 and then attempted to connect to it using nc 127.0.0.1 900 when I got the connection refused error. The same happens when connecting using telnet. ufw is disabled. I don't understand how this could happen. Please throw some light onto this issue. Thanks in advance.

1 Answers1

3

Some versions of nc has strange behavior, related with specifying of listening port and listening address. Try to run nc with -v (verbosity) option:

~# nc -v -l 127.0.0.1 900
listening on 0.0.0.0:36915 ...
^C

~# nc -v -l 127.0.0.1 -p 900
listening on 0.0.0.0:900 ...
^C

Other way to troubleshoot similar issues is checking of the listened sockets:

~# ss -tlnp | grep nc
LISTEN     0      1            *:43395   *:*      (("nc",pid=2210,fd=3))