OSx dns cache
Three in a row... I think this is the first time I write so much in a day.
This is a quick reminder for myself, but you (OSx users) out there should find it pretty interesting too.
In OSx it is posible that you have suffered the following:
1- You access a site, using your favourite protocol/application (ssh, http, ftp, svn, etc), for example, test.e-shell.org. This name points to ip address 192.168.1.1
2- The ip address for test.e-shell.org have change, now it is 192.168.1.2, but (you have no idea why), your OSx still tries to connect to the old ip address.
3- You add an entry to /etc/hosts, with the new ip address, trying to force the system to get the point, but no luck, it still tries to connect to that old ip address
Well, the reason for that, the culprit, is lookupd (dscacheutil if you are using leopard). This little daemon acts as a DNS cache, caching up all the names and related ip addresses.
So, to get the new ip for test.e-shell.org, we will have to refresh the cache, like that:
lookupd -flushcache
(from a Terminal.app, for example)
Note that in leopard, it should be something like:
dscacheutil -flushcache