7

In my computer with Ubuntu 14.04 I can do things like this:

$ nc -l 5349 -vvv
Listening on [0.0.0.0] (family 0, port 5349)

or this:

$ nc -vvv -l 192.168.254.96 5349
Listening on [192.168.254.96] (family 0, port 5349)

And a socket is opened to listen entering connections on my local IP address (192.168.254.96). And obviously I can connect from the other side and transmit data.

But in a server behind a NAT with Debian 8.0 Jessie I got this strange error:

$ nc -vvv -l 5349
5349: inverse host lookup failed: Unknown host
nnetfd reuseport failed : Protocol not available
listening on [any] 38541 ... : Protocol not available

or:

$ nc -vvv -l 10.1.6.189 5349
10.1.6.189: inverse host lookup failed: Unknown host
nnetfd reuseport failed : Protocol not available
listening on [any] 52606 ... : Protocol not available

The port is not in use:

$ ss -tnl | grep 5349
(empty)

and it is the correct IP address:

$ ip addr list
...
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 1e:89:93:f1:96:a4 brd ff:ff:ff:ff:ff:ff
    inet 10.1.6.189/19 brd 10.1.31.255 scope global eth0
    inet6 fe80::1c89:93ff:fef1:96a4/64 scope link 
       valid_lft forever preferred_lft forever

What could be the issue? Could be something related with the NAT behind the server is?

6

For netcat in listen mode you should use -p flag to choose listening port, e.g. nc -vvv -l -p 5349.

the second error: nnetfd reuseport failed : Protocol not available is related to SO_REUSEPORT socket option. It was introduced in linux kernel version 3.9 and netcat version using it will not work with earlier kernel release. You can either upgrade your kernel to more recent version or use another variation of netcat. I believe netcat-openbsd should work.

  • with my computer, everything worked perfectly, this is not the issue. – logoff Sep 28 '15 at 13:14
  • anyway, same result: $ nc -vvv -l -p 5349 \ nnetfd reuseport failed : Protocol not available \ listening on [any] 5349 ... : Protocol not available – logoff Sep 28 '15 at 13:21
  • it fixes one of the errors, 'inverse host lookup failed: Unknown host', as for Protocol not available i will edit my answer to add a solution – DukeLion Sep 29 '15 at 3:39
  • my kernel is 3.2.0-4-amd64 #1 SMP Debian 3.2.68-1+deb7u3 in Debian 8.2 Jessie. netcat-openbsd worked. thank you! – logoff Sep 29 '15 at 7:17

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.