← All posts

IPv6 is here (and how it screwed me)

June 6, 2012

In case you’ve been living under a rock, you might like to know that IPv6 is actually turning into a real thing. Google and many others are officially turning on IPv6 support for good. Yay! If you’re not sure what this means or why, check out Google’s write up on the transition. They explain it much better (and prettier) than I could.

IPv6 brings with it a lot of changes for the better, but recently it really threw me for a loop. I was starting a new job and had to setup my work computer starting from ground zero. At first, everything was great. I loaded up the PHP application, started tinkering with it, even built out a module for the shipping department that connected with USPS and UPS. Eventually though, I started noticing that I was having freakishly slow page load times. I pulled up Chrome’s developer tools and realized that it was taking exactly 5 seconds to resolve the domain name. Yes, 5 full seconds to resolve a domain name that was in my /etc/hosts file pointing back home.

I spent several days adjusting settings and talking to our in house system admins just trying to get an idea that I could use. Finally, exasperated, I decided to reinstall the entire operating system and start over. Since I had never seen this problem before I assumed I had jacked up my config somewhere in the setup process and this would fix it. Right? No. Suddenly, it was taking an exact 10 seconds to resolve the domain name!

Add in about two more weeks of frustration and I’ll skip to the solution here. For the past several years I’ve used .dev as my localhost TLD of choice. (e.g. example.dev) My new company was using .local on just about everything so without giving it a second thought I adopted it for my own setup. Apparently though, OS X using the .local TLD for Bonjour and attempts to resolve those domains against IPv6 before it moves on to IPv4.

127.0.0.1 example.local
::1 example.local

The solution? Include an IPv6 reference back to your localhost and everything works great. Happy IPv6ing!