nslookup and dig error: connection timed out; no servers could be reached - even when specifying server

I'm on Ubuntu 18.04.3 and my internet suddenly stopped working.

I can ping local and WAN ip addresses and I have already restarted the network:

sudo service network-manager restart

These commands:

nslookup google.com 1.1.1.1
dig google.com @1.1.1.1

both return: connection timed out; no servers could be reached

But dig in tcp mode works perfectly:

dig google.com @1.1.1.1 +tcp

ifconfig looks the usual.

I'm clueless as to what is happening. I don't know what's the service that's causing this that needs to restart. I know for a fact that rebooting fixes this problem since this has happened to me before so I thought I could ask this question to help for the future, so I understand what's going on.

1

1 Answer

It might be not actual anymore but I had very same issue and figured out the reason. The resolver was systemd-resolved and listened on 127.0.0.53. But my iptables has DROP policy on INPUT table and no rule allowing access to lo interface. I added this rule and it started coming!

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like