lookupd can use different agents to lookup hosts: e.g. DNSAgent which consults DNS, FFAgent which consults local files like /etc/hosts, and CacheAgent which will keep a local cache. The trick is to tell lookupd which agents to use in which order.
Read the rest of this article if you'd like the details on making OS X use your local hosts file before it uses the DNS servers.
Here's how I did it. First open a terminal window and become root (you can also use NetInfo mgr if you prefer). type
niutil -create . /locations/lookupd/hosts [hit enter]This means hosts are first looked up in /etc/hosts, if this fails, then DNS is used. Note I did not use the CacheAgent because my local DNS-server/router already keeps a cache.
niutil -createprop . /locations/lookupd/hosts LookupOrder FFAgent DNSAgent [hit enter]
Next you need to restart lookupd. Type
top -l|grep lookupd [enter]to find out the PID for lookupd. Next kill the process with
kill -HUP nnnn [enter]where nnnn is the PID. Lookupd will restart automatically.
Again, a reminder that you need to be root to do all this.
Additional info:
manpage on lookupd (type man lookupd in a terminal session)
article at Stepwise
Using NetInfo as replacement for /etc/hosts
This solved one of the biggest problems I had with integrating OS X into my network. It also seems to have solved the problem of telnet connections taking forever...
Cubist (only likes real cookies)

