Overcome DNS Propagation Time with Hosts File Hacks

Many new sites joined the MetaZaku Network and many of them migrated servers. Standard migration routine: Copy all files and change the nameservers.

Unfortunately, DNS propagation recommends at least fourty-eight hours (two days) before the changes are seen by all regular visitors. Developers won’t be productive for two days. Fortunately, we can quicken the propagation process with the hosts file

Introduction to the Hosts File

For Windows, you’ll find the hosts file under %SystemRoot%\system32\drivers\etc\hosts where %SystemRoot% is usually WINDOWS.

On a Unix or POSIX operating system including Mac, you’ll find the hosts file under /etc/hosts.

Syntax and Grammar

The hosts file manually maps IP addresses to hostnames. Hash characters # denote comments.

# comment example
127.0.0.1  localhost

127.0.0.1 localhost is the most common entry available on all computers that is used for local web development by using http://localhost/. Fortunately, we can also use this to map domain names to their current server IP.

Defeating DNS Propagation

Because we can manually map an IP to a hostname, we can add an entry that maps the host name to it’s current server.

# old server
66.228.51.44 giocc.com www.giocc.com

The above entry will map my domain name to my current server’s IP so that I’m able to view the website. Hypothetically, if I migrate to a server with an IP of 173.255.255.249, then instead of waiting two days, I could change my hosts file entry to:

# new server
173.255.255.249 giocc.com www.giocc.com

Conclusion

The next time I visit the website with the URL, it will automatically show me the proper server so that I can continue my development or browsing. This is especially useful for server migrations to overcome DNS propagation time.

Good luck with successful migrations, you’ll need it.

This entry was posted in Ingenuity and tagged , , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

2 Comments

  1. Posted October 8, 2011 | Permalink

    I am not sure where you are getting your info, but good topic. I needs to spend some time learning much more or understanding more. Thanks for wonderful info I was looking for this information for my mission.

    • Posted November 20, 2011 | Permalink

      Well I guess I don’t have to spend the weenked figuring this one out!

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

  • About Gio

    I am a torrent of ingenuity (or insanity) with a myriad of innovations (sometimes fallacies) and a wealth of inspiration (possibly naiveté). My name is Gio Carlo Cielo Borje and I like puffer fish because they're just cooltalkin', highwalkin' and fastlivin'.

    I'm also nineteen and a current student at UC Irvine for Computer Science.