6

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:

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.

Jose Lopez Garcia
  • 972
  • 1
  • 9
  • 21

2 Answers2

8

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

nameserver 8.8.8.8
sumedhe
  • 934
  • 1
  • 13
  • 30
  • 2
    To implement this: Open the command line and type `sudo nano /etc/resolv.conf`. At the editor, after doing what's above, use `CTRL` + `O` to save and `CTRL` + `X` to exit. Reboot at the end – Vasco Cansado Carvalho Dec 16 '20 at 00:04
  • @VascoCansadoCarvalho I feel we can simply do `sudo gedit` instead of nano, it's GUI so I feel it's better – Harsha Oct 27 '21 at 15:36
6

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.

Tey'
  • 961
  • 12
  • 23