Sample Header Ad - 728x90

DNS lookup fails on first time, but second lookup works

0 votes
2 answers
2141 views
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?
Asked by Stefan Wegener (131 rep)
Apr 25, 2019, 11:16 AM
Last activity: Jun 8, 2025, 02:03 AM