Site5 - Built For Designers & Developers MENU
Home  ›  Networking  ›  Editing your own Hosts File prior to nameserver propagation

Editing your own Hosts File prior to nameserver propagation

Comments Off on Editing your own Hosts File prior to nameserver propagation

DNS propogation can take up to 24-48 hours. Until it is complete, you may not be able to put your domain name into your browser or SCP/FTP client and have it find the new server properly. To bypass DNS, you can edit the local “hosts” file on your computer. The hosts file contains manual IP address to domain name mappings, replicating the function of a DNS server.

On a Mac or Linux based computer

Open a shell window and run the following command

sudo pico /etc/hosts

You can edit with your favorite text editor.

When you first open the hosts file, you should see an entry that looks like this:

    127.0.0.1 localhost.localdomain localhost

Add a new line in the same format for your domain:

    ip.ad.re.ss www.example.com example.com

Where “ip.ad.re.ss” is the new IP address on our server for your domain, and “example.com” is your actual domain name. (You can find the IP address in Siteadmin under Account Information)

A new entry for site5.com would look like the following:

    74.53.50.50 www.site5.com site5.com

If you need to flush your DNS cache, see the Flushing your DNS Cache article

On Windows computers

In Vista or Windows 7 you will need to open notepad with administrator privileges in order to edit the file. Find the Notepad icon, right click on it and select “Run as Administrator” then open the file.

The hosts file is located at C:\WINDOWS\system32\drivers\etc\hosts

When you first open the hosts file, you should see an entry that looks like this (it may differ slightly based on your Windows version):

    # Copyright (c) 1993-2009 Microsoft Corp.
    #
    # This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
    #
    # This file contains the mappings of IP addresses to host names. Each
    # entry should be kept on an individual line. The IP address should
    # be placed in the first column followed by the corresponding host name.
    # The IP address and the host name should be separated by at least one
    # space.
    #
    # Additionally, comments (such as these) may be inserted on individual
    # lines or following the machine name denoted by a '#' symbol.
    #
    # For example:
    #
    #      102.54.94.97     rhino.acme.com          # source server
    #       38.25.63.10     x.acme.com              # x client host
    # localhost name resolution is handled within DNS itself.
    #	127.0.0.1       localhost
    #	::1             localhost

Add a new line WITHOUT the “#” in front in the same format for your domain:

    ip.ad.re.ss www.example.com example.com

Where “ip.ad.re.ss” is the new IP address on our server for your domain, and “example.com” is your actual domain name. (You can find the IP address in Siteadmin under Account Information)

A new entry for site5.com would look like the following:

    74.53.50.50 www.site5.com
         74.53.50.50 site5.com

This file is a “plain text” file, so use a text editor and not a word processor like Word to edit it.

Remember to remove this entry after a few days, once DNS propogation is complete or you could experience unexpected browsing results in the future should your IP change.

Still have a question? Or need help?
See an error in this article or want to suggest a missing topic? Please leave us a comment below! If you need technical support with your account, please email us, chat live with a representative, or call us!

Comments are closed.

Money Back Guarantees
Click to verify BBB accreditation and to see a BBB report.