5

I'm on a Raspbian, I've tried to receive data with:

nc -4 -l -v -k -p 5004 

which result in:

Listening on [0.0.0.0] (family 2, port 5004)
nc: getnameinfo: Temporary failure in name resolution

route command return this:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         10.11.10.1      0.0.0.0         UG    0      0        0 00c0caaaeb87
10.11.10.0      0.0.0.0         255.255.255.0   U     0      0        0 00c0caaaeb87

Gateway is reachable:

PING 10.11.10.1 (10.11.10.1) 56(84) bytes of data.
64 bytes from 10.11.10.1: icmp_seq=1 ttl=64 time=4.03 ms

This are the ip:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
    link/ether b8:27:eb:4b:46:37 brd ff:ff:ff:ff:ff:ff
3: intwifi0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether b8:27:eb:1e:13:62 brd ff:ff:ff:ff:ff:ff
4: 00c0caaaeb87: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 2304 qdisc mq state UP group default qlen 1000
    link/ether 00:c0:ca:aa:eb:87 brd ff:ff:ff:ff:ff:ff
    inet 10.11.10.10/24 brd 10.11.10.255 scope global 00c0caaaeb87
       valid_lft forever preferred_lft forever

Instead if I connect eth0 and do: dhclient eth0. Nc start work fine. What I'm missing?

This is the content of /etc/resolv.conf for both states is the same:

# Generated by resolvconf
nameserver 10.11.10.1

This is the strace output of the nc process:

strace: Process 1780 attached
accept(3, {sa_family=AF_INET, sin_port=htons(41250), sin_addr=inet_addr("10.11.10.11")}, [128->16]) = 4
socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 5
connect(5, {sa_family=AF_UNIX, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
close(5)                                = 0
socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 5
connect(5, {sa_family=AF_UNIX, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
close(5)                                = 0
open("/etc/nsswitch.conf", O_RDONLY|O_CLOEXEC) = 5
fstat64(5, {st_mode=S_IFREG|0644, st_size=497, ...}) = 0
read(5, "# /etc/nsswitch.conf\n#\n# Example"..., 4096) = 497
read(5, "", 4096)                       = 0
close(5)                                = 0
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 5
fstat64(5, {st_mode=S_IFREG|0644, st_size=104908, ...}) = 0
mmap2(NULL, 104908, PROT_READ, MAP_PRIVATE, 5, 0) = 0x76f45000
close(5)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/arm-linux-gnueabihf/libnss_files.so.2", O_RDONLY|O_CLOEXEC) = 5
read(5, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\240\31\0\0004\0\0\0"..., 512) = 512
lseek(5, 37440, SEEK_SET)               = 37440
read(5, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1120) = 1120
lseek(5, 37088, SEEK_SET)               = 37088
read(5, "A.\0\0\0aeabi\0\1$\0\0\0\0056\0\6\6\10\1\t\1\n\2\22\4\23\1\24"..., 47) = 47
fstat64(5, {st_mode=S_IFREG|0644, st_size=38560, ...}) = 0
mmap2(NULL, 127744, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 5, 0) = 0x76d98000
mprotect(0x76da1000, 61440, PROT_NONE)  = 0
mmap2(0x76db0000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 5, 0x8000) = 0x76db0000
mmap2(0x76db2000, 21248, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x76db2000
close(5)                                = 0
mprotect(0x76db0000, 4096, PROT_READ)   = 0
munmap(0x76f45000, 104908)              = 0
getpid()                                = 1780
open("/etc/resolv.conf", O_RDONLY|O_CLOEXEC) = 5
fstat64(5, {st_mode=S_IFREG|0644, st_size=48, ...}) = 0
read(5, "# Generated by resolvconf\nnamese"..., 4096) = 48
read(5, "", 4096)                       = 0
close(5)                                = 0
uname({sysname="Linux", nodename="rx", ...}) = 0
open("/etc/host.conf", O_RDONLY|O_CLOEXEC) = 5
fstat64(5, {st_mode=S_IFREG|0644, st_size=9, ...}) = 0
read(5, "multi on\n", 4096)             = 9
read(5, "", 4096)                       = 0
close(5)                                = 0
open("/etc/hosts", O_RDONLY|O_CLOEXEC)  = 5
fstat64(5, {st_mode=S_IFREG|0644, st_size=119958, ...}) = 0
read(5, "127.0.0.1\tlocalhost\n::1\t\tlocalho"..., 4096) = 4096
close(5)                                = 0
open("/etc/hosts", O_RDONLY|O_CLOEXEC)  = 5
fstat64(5, {st_mode=S_IFREG|0644, st_size=119958, ...}) = 0
read(5, "127.0.0.1\tlocalhost\n::1\t\tlocalho"..., 4096) = 4096
read(5, "0.1 wbc\n127.0.0.1 wbc\n127.0.0.1 "..., 4096) = 4096
read(5, "1 wbc\n127.0.0.1 wbc\n127.0.0.1 wb"..., 4096) = 4096
read(5, "1 wbc\n127.0.0.1 wbc\n127.0.0.1 wb"..., 4096) = 4096
read(5, "\n127.0.0.1 groundpi\n127.0.0.1 wb"..., 4096) = 4096
read(5, "\n127.0.0.1 wbc\n127.0.0.1 wbc\n127"..., 4096) = 4096
read(5, "127.0.0.1 wbc\n127.0.0.1 wbc\n127."..., 4096) = 4096
read(5, "127.0.0.1 wbc\n127.0.0.1 wbc\n127."..., 4096) = 4096
read(5, "bc\n127.0.0.1 wbc\n127.0.0.1 wbc\n1"..., 4096) = 4096
read(5, "0.1 wbc\n127.0.0.1 wbc\n127.0.0.1 "..., 4096) = 4096
read(5, "bc\n127.0.0.1 wbc\n127.0.0.1 groun"..., 4096) = 4096
read(5, ".1 wbc\n127.0.0.1 wbc\n127.0.0.1 w"..., 4096) = 4096
read(5, ".0.0.1 wbc\n127.0.0.1 wbc\n127.0.0"..., 4096) = 4096
read(5, ".0.0.1 wbc\n127.0.0.1 wbc\n127.0.0"..., 4096) = 4096
read(5, "0.0.1 groundpi\n127.0.0.1 wbc\n127"..., 4096) = 4096
read(5, ".0.0.1 wbc\n127.0.0.1 wbc\n127.0.0"..., 4096) = 4096
read(5, "7.0.0.1 wbc\n127.0.0.1 wbc\n127.0."..., 4096) = 4096
read(5, "127.0.0.1 wbc\n127.0.0.1 wbc\n127."..., 4096) = 4096
read(5, "0.1 wbc\n127.0.0.1 wbc\n127.0.0.1 "..., 4096) = 4096
read(5, "0.1 wbc\n127.0.0.1 wbc\n127.0.0.1 "..., 4096) = 4096
read(5, ".0.1 wbc\n127.0.0.1 wbc\n127.0.0.1"..., 4096) = 4096
read(5, "1 wbc\n127.0.0.1 groundpi\n127.0.0"..., 4096) = 4096
read(5, "c\n127.0.0.1 wbc\n127.0.0.1 ground"..., 4096) = 4096
read(5, "1 wbc\n127.0.0.1 wbc\n127.0.0.1 wb"..., 4096) = 4096
read(5, "\n127.0.0.1 wbc\n127.0.0.1 wbc\n127"..., 4096) = 4096
read(5, ".0.0.1 wbc\n127.0.0.1 wbc\n127.0.0"..., 4096) = 4096
read(5, "127.0.0.1 wbc\n127.0.0.1 wbc\n127."..., 4096) = 4096
read(5, "\n127.0.0.1 rx\n127.0.0.1 wbc\n127."..., 4096) = 4096
read(5, "0.0.1 wbc\n127.0.0.1 wbc\n127.0.0."..., 4096) = 4096
read(5, "1 rx\n127.0.0.1 wbc\n127.0.0.1 wbc"..., 4096) = 1174
read(5, "", 4096)                       = 0
close(5)                                = 0
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 5
fstat64(5, {st_mode=S_IFREG|0644, st_size=104908, ...}) = 0
mmap2(NULL, 104908, PROT_READ, MAP_PRIVATE, 5, 0) = 0x76f45000
close(5)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/arm-linux-gnueabihf/libnss_dns.so.2", O_RDONLY|O_CLOEXEC) = 5
read(5, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\220\n\0\0004\0\0\0"..., 512) = 512
lseek(5, 16892, SEEK_SET)               = 16892
read(5, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1120) = 1120
lseek(5, 16540, SEEK_SET)               = 16540
read(5, "A.\0\0\0aeabi\0\1$\0\0\0\0056\0\6\6\10\1\t\1\n\2\22\4\23\1\24"..., 47) = 47
fstat64(5, {st_mode=S_IFREG|0644, st_size=18012, ...}) = 0
mmap2(NULL, 82080, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 5, 0) = 0x76d83000
mprotect(0x76d87000, 61440, PROT_NONE)  = 0
mmap2(0x76d96000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 5, 0x3000) = 0x76d96000
close(5)                                = 0
mprotect(0x76d96000, 4096, PROT_READ)   = 0
munmap(0x76f45000, 104908)              = 0
stat64("/etc/resolv.conf", {st_mode=S_IFREG|0644, st_size=48, ...}) = 0
open("/etc/resolv.conf", O_RDONLY|O_CLOEXEC) = 5
fstat64(5, {st_mode=S_IFREG|0644, st_size=48, ...}) = 0
read(5, "# Generated by resolvconf\nnamese"..., 4096) = 48
read(5, "", 4096)                       = 0
close(5)                                = 0
uname({sysname="Linux", nodename="rx", ...}) = 0
socket(AF_INET, SOCK_DGRAM|SOCK_NONBLOCK, IPPROTO_IP) = 5
connect(5, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("10.7.208.3")}, 16) = 0
poll([{fd=5, events=POLLOUT}], 1, 0)    = 1 ([{fd=5, revents=POLLOUT}])
send(5, ".\242\1\0\0\1\0\0\0\0\0\0\00211\00210\00211\00210\7in-addr"..., 42, MSG_NOSIGNAL) = 42
poll([{fd=5, events=POLLIN}], 1, 5000)  = 0 (Timeout)
poll([{fd=5, events=POLLOUT}], 1, 0)    = 1 ([{fd=5, revents=POLLOUT}])
send(5, ".\242\1\0\0\1\0\0\0\0\0\0\00211\00210\00211\00210\7in-addr"..., 42, MSG_NOSIGNAL) = 42
poll([{fd=5, events=POLLIN}], 1, 5000)  = 0 (Timeout)
close(5)                                = 0
write(2, "nc: ", 4)                     = 4
write(2, "getnameinfo: Temporary failure i"..., 49) = 49
write(2, "\n", 1)                       = 1
exit_group(1)                           = ?
+++ exited with 1 +++
2
  • contents of /etc/resolv.conf in the working and non-working state please.
    – icarus
    Jun 10 '20 at 15:31
  • From the strace log, the DNS lib is trying to resolve your IP using the DNS server at 10.7.208.3 which does not answer, hence the failure. Why does netcat abort for a simple DNS failure instead of just showing a warning is out of my mind though...
    – Tey'
    Mar 22 '21 at 15:25
9
nc -n

-n numeric-only IP addresses, no DNS

With this I've solved

1

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.