How to resolve a domain name from a specific DNS server instead of the configured one in Linux?

Posted on In QA

I would like to check whether the domain name’s IP has changed in the authoritative DNS server. The system’s configured DNS server may still cache the old IP, which is fine. The question is how to query from the authoritative DNS server the new IP?

You can use dig – DNS lookup utility to query the DNS from a specific DNS server.

For example, to query DNS of fclose.com from 8.8.8.8:

dig @8.8.8.8 fclose.com

You will get

; <<>> DiG 9.9.6-P1-RedHat-9.9.6-7.P1.fc21 <<>> @8.8.8.8 fclose.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 5716
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

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

;; ANSWER SECTION:
fclose.com.		13846	IN	A	64.90.49.224

;; Query time: 46 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Wed Mar 04 17:08:51 HKT 2015
;; MSG SIZE  rcvd: 55

The “ANSWER SECTION” shows the IP of the domain:

fclose.com.		13846	IN	A	64.90.49.224

Eric Ma

Eric is a systems guy. Eric is interested in building high-performance and scalable distributed systems and related technologies. The views or opinions expressed here are solely Eric's own and do not necessarily represent those of any third parties.

Leave a Reply

Your email address will not be published. Required fields are marked *