It’s useful to change /etc/hosts, specially with protections requesting online keys.
After editing /etc/hosts, you need to refresh OS X NetInfo Database.
Just run the following command:
sudo niload -v -m hosts . < /etc/hosts
And then flush cache with:
For Snow Leopard the command has changed. It is now:
And that’s it!