Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Netcat throws a "getnameinfo: Temporary failure in name resolution" error

When I run the following command: nc -luvp 9090, I get the error: getnameinfo: Temporary failure in name resolution

I've scanned the internet in search of an answer, but none of them were valid:

  • https://github.com/bonzini/netcat/issues/2: not answered
  • https://www.reddit.com/r/linuxquestions/comments/fa8l7s/issue_running_netcat_lvp/: not answered

I found this link: https://unix.stackexchange.com/questions/504963/how-to-solve-a-temporary-failure-in-name-resolution-error And tried the most upvoted answer. My results:

netcat_name_resolution_error

I'm using NordVPN, which uses its own DNS servers. But I tried disabling it completely, and I get the same exact result. I'm afraid it messed up with my DNS config file and/or firewall rules.

I'm kinda new to Linux and feel a bit lost.

like image 329
Jose Lopez Garcia Avatar asked Jan 26 '23 02:01

Jose Lopez Garcia


2 Answers

The problem could be with the DNS resolver. Try updating the namespace in /etc/resolv.conf as follows.

nameserver 8.8.8.8
like image 193
sumedhe Avatar answered Jan 27 '23 15:01

sumedhe


You seem to be using systemd-resolved for your DNS resolver, which seems unable to resolve 0.0.0.0:

$ resolvectl query 0.0.0.0
0.0.0.0: resolve call failed: No appropriate name servers or networks for name found

$ host 0.0.0.0 127.0.0.53
Using domain server:
Name: 127.0.0.53
Address: 127.0.0.53#53
Aliases:

Host 0.0.0.0.in-addr.arpa not found: 2(SERVFAIL)

This is the address netcat is trying to resolve and fails (in my tests at least). One solution is to add a static association by adding the following line in /etc/hosts:

0.0.0.0    localhost

netcat should not abort for such a harmless DNS failure (it works when using the -n switch or removing the -v switch) and systemd-resolved should probably not send SERVFAIL when resolving 0.0.0.0.

like image 38
Tey' Avatar answered Jan 27 '23 16:01

Tey'