0

I have a lot of Raspberry Pi systems which are located at different networks of over which I have no control.

Recently I recognized that at one network sometimes but not always the first DNS lookup fails, but the second one is able to resolve the name:

pi@pi:~ $ ping api.twilio.com
ping: unknown host api.twilio.com

pi@pi:~ $ ping api.twilio.com
PING nlb-api-public-c3207ffe0810c880.elb.us-east-1.amazonaws.com      
(18.211.224.155) 56(84) bytes of data.
...

api.twilio.com was just an example, I also could reproduce it with other domain names like google.com.

I was hoping that nslookup might give me a better hint:

pi@pi:~ $ ping api.twilio.com
ping: unknown host api.twilio.com
pi@pi:~ $ nslookup api.twilio.com
Server:         127.0.0.1
Address:        127.0.0.1#53

** server can't find api.twilio.com: REFUSED

pi@pi:~ $ ping api.twilio.com
PING nlb-api-public-c3207ffe0810c880.elb.us-east-1.amazonaws.com (18.208.54.140) 56(84) bytes of data.
^C
--- nlb-api-public-c3207ffe0810c880.elb.us-east-1.amazonaws.com ping statistics ---
4 packets transmitted, 0 received, 100% packet loss, time 3106ms

pi@pi:~ $ nslookup api.twilio.com
Server:         127.0.0.1
Address:        127.0.0.1#53

Non-authoritative answer:
api.twilio.com  canonical name = virginia.us1.api-lb.twilio.com.
virginia.us1.api-lb.twilio.com  canonical name = nlb-api-public-c3207ffe0810c880.elb.us-east-1.amazonaws.com.
Name:   nlb-api-public-c3207ffe0810c880.elb.us-east-1.amazonaws.com
Address: 18.212.47.248
Name:   nlb-api-public-c3207ffe0810c880.elb.us-east-1.amazonaws.com
Address: 18.211.224.155
Name:   nlb-api-public-c3207ffe0810c880.elb.us-east-1.amazonaws.com
Address: 18.208.54.140

I could reproduce the behavior over various systems but not always. Sometimes the lookup seems to work for some time and then after some time the behavior is there again (my guess at this point is that this could be after the DNS lease time?).

My question is, if there are better ways to investigate why the first lookup sometimes does not work correctly? Or even better, if someone has a hint what might cause the problem?

  • 1
    REFUSED: you seem to be asking a DNS server which does not like your questions. Please try to add to the question which DNS servers are you using if possible. – Rui F Ribeiro Apr 25 at 12:34
0

[Are there] better ways to investigate why the first lookup sometimes does not work correctly?

  • Find out what DNS server is listening on 127.0.0.1.
  • If it has not got logging turned on, turn its logging on and repeat the test case.
  • Look at its logs.

A DNS server software that is worth its salt will log what back-end transactions it is performing (what queries are sent and what responses are received) and what it is pulling from cache. It might also tell you why it is refusing the front-end request the first time.

Read logs when diagnosing problems.

0

DNS works by whichever answers first. So if your first DNS listing cannot find the IP address, it will pass it off to the second one. If it takes too long, it will timeout.

I'd suggest checking that your DNS works by individually adding both DNS server with 0.0.0.0 as your secondary to test which one is failing. Whichever one it is, may be looking at 127.0.0.1 instead of the DNS. OpenDNS agents can do this. Check your manual DNS configurations. ifconfig -a will show you your full IP configuration, or ip ad -a.

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.