Incorrect DNS resolution result for www.googleapis.com


#1

Hi,

My email client application was failing to download emails from gmail. After troubleshooting, I found that it was dns resolution issue. Here is what I found when I tried to dig.

$ dig @1.1.1.1 www.googleapis.com

; <<>> DiG 9.12.1 <<>> @1.1.1.1 www.googleapis.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 52558
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1536
;; QUESTION SECTION:
;www.googleapis.com.		IN	A

;; ANSWER SECTION:
www.googleapis.com.	922	IN	CNAME	googleapis.l.google.com.
googleapis.l.google.com. 248	IN	A	74.125.24.95

;; Query time: 24 msec
;; SERVER: 1.1.1.1#53(1.1.1.1)
;; WHEN: Mon Apr 30 19:13:19 IST 2018
;; MSG SIZE  rcvd: 97

I tried using google dns which returned correct dns and application started working as well.

$ dig @8.8.8.8 www.googleapis.com

; <<>> DiG 9.12.1 <<>> @8.8.8.8 www.googleapis.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 53375
;; flags: qr rd ra; QUERY: 1, ANSWER: 10, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;www.googleapis.com.		IN	A

;; ANSWER SECTION:
www.googleapis.com.	3504	IN	CNAME	googleapis.l.google.com.
googleapis.l.google.com. 210	IN	A	216.58.196.170
googleapis.l.google.com. 210	IN	A	172.217.163.42
googleapis.l.google.com. 210	IN	A	172.217.163.106
googleapis.l.google.com. 210	IN	A	172.217.163.138
googleapis.l.google.com. 210	IN	A	172.217.163.170
googleapis.l.google.com. 210	IN	A	172.217.166.106
googleapis.l.google.com. 210	IN	A	216.58.197.42
googleapis.l.google.com. 210	IN	A	172.217.31.202
googleapis.l.google.com. 210	IN	A	172.217.160.138

;; Query time: 48 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Mon Apr 30 19:13:36 IST 2018
;; MSG SIZE  rcvd: 225

I’m facing this problem in India since yesterday. Is there any way it can be fixed?


#2

I found the reason for this issue. It was caused due to invalid entry in /etc/resolv.conf file. I was using the resolver in the router it self. The NetworkManager in my computer was automatically updating /etc/resolv.conf with weird entries. I realised it when I tried to repeat the test.

$ dig @8.8.8.8 www.googleapis.com
dig: parse of /etc/resolv.conf failed
$ dig @1.1.1.1 www.googleapis.com
dig: parse of /etc/resolv.conf failed

Then I reconfigured NetworkManager to use custom DNS resolver instead of automatic. Now email client works fine.