Home > Support > HOWTO List > Bypassing DNS server lookups by using /etc/hosts

Bypassing DNS server lookups by using /etc/hosts

By setting up host entries in /etc/hosts, you can bypass doing DNS lookups for that host.

This is especially helpful for testing your site before DNS changes are made (or have been seen by your local PC).

On Linux/Unix systems, this file is /etc/hosts. On Windows XP it is located in c:\windows\system32\drivers\etc\hosts.

Example /etc/hosts file:


127.0.0.1 localhost.localdomain localhost
10.0.0.2 localpc
10.0.3.5 mydomain.com

In this example, browsing to http://mydomain.com would take you to 10.0.3.5 regardless of any existing DNS records for 'mydomain.com'.