Mac OS X: Clear DNS Cache and the dig utility

Stefan - 6. Juli 2007

Transfering a domain name from one provider to another can sometimes be a hassle. During my last domain name transfer the IP resolution of the transfered domain looked a little bit strange. So what could I do to check the name server preferences?

At first I tried to flush the DNS cache of my MacBook. A quick search on Google revealed, that this is as easy as typing lookupd -flushcache but my domain name still got resolved to this old and strange IP address.

So I decided it’s better to have a closer look into the name server communication. To query a name server the dig utility is very helpful. A simple dig www.example.com shows us this output:

; <<>> DiG 9.3.4 <<>> www.example.com
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 10393 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0 ;; QUESTION SECTION: ;www.example.com. IN A ;; ANSWER SECTION: www.example.com. 76421 IN A 208.77.188.166 ;; Query time: 54 msec ;; SERVER: 192.168.178.1#53(192.168.178.1) ;; WHEN: Fri Jul 6 14:16:54 2007 ;; MSG SIZE rcvd: 49

The bit of information we want to know is within the “ANSWER SECTION”. It tells us that www.example.com resolves to the IP address 208.77.188.166. In my case it told me that my domain name still resolves to the old and strange looking IP.

But which name server does dig query? As a default it uses the name servers listed in /etc/resolv.conf. So this old IP address may got cached by my dial-up name server. But it’s also possible that the name server of my new hosting provider had some strange entries.

Even in this case, dig can help us: dig @name.server.my.provider.com www.example.com shows us the IP address of the host as it is seen by the name server provided with a leading @-sign. So my original question got finally answered. The name server of my new hosting provider has been configured correctly, the strange IP lookup came from the caching of the old address by my access provider’s name server.

The dig utility is a valuable tool for all kind of name server related troubles and questions. Every advanced web worker should really know how to use ist.

Abgelegt in: Apple MacIT Stuff

2 Kommentare:

More like by your Macbook.

That query won’t even go out to your ISP if there’s time left in your box’s cache timeout. So what you did actually tells you nothing..

Romy,
that’s why I did a “lookupd -flushcache” before issuing the dig command. This should have deleted my local cache.

Schreibe einen Kommentar
benötigt
benötigt (wird nicht angezeigt)
optional

Suchen