Google Chrome and the /etc/hosts file 

I’ve switched to using Chrome recently as my browser of choice but recently came across a rather annoying problem with it.

I was writing a new chapter of a story on Protagonize and didn’t notice that the server migration they were doing happened to star during the course of my writing. I click submit and pow, my work was gone as the site didn’t exist any more. I thought I might have lost it but luckily Chrome still had it and tried to repost it every time I did a refresh. However, I had no way of getting the text out of Chrome as it would not display the original text entry form. Crap. I had two choice, either wait until the migration was complete or lose my work.

I decided to wait and the migration went through fine but one last problem! The server had changed IP address and none of the DNS had updated yet! I set up an entry in my hosts file expecting Chrome to honour it but it ignored it. Oh noes!

So, I did what any self-respecting geek would do, set up my own DNS server, changed my computer to use that as it’s primary DNS and had that DNS server use my hosts file. That way Chrome was unknowingly using my hosts file and all was well. I saved my story chapter and got it posted. Geek solutions for the win!

Here is how I did it (obviously this is only applicable to Linux, Ubuntu Karmic in my specific case):

I also decided I wanted to keep using dnsmasq as a local DNS cache (for faster DNS queries and dealing with evil issues like this) so I added an entry to my

file (which controls what happens when your computer gets new network details automatically via DHCP, which is what I use on my network) to ensure it updated the

with the entry for the local DNS cache. I did this by adding the line