Scalable mobile testing without the hosts file fuss

It's pretty customary this day in "mobile" age to test your website on mobile devices. There are a plethora of emulators available that make testing possible right from your desktop and will give you the ability to edit your hosts file. But what options do you have if you want to test on a real device? A good example is testing mobile device redirects. Good luck, because you cannot edit the hosts file on your real device without hacking it. But, if you keep reading I will teach you how to setup a mobile testing lab using a Linksys WRT54G router and DD-WRT -- a custom ROM that replaces your stock Linksys router firmware.

One of my favorite home routers is the Linksys WRT54G. It's an older router, but they often can be found at a garage sale anywhere from $5-$10 in good working condition. The earlier revisions (< 5.0; see have more flash RAM available so you can run the larger ROMs. However, there are smaller ROMs available that classify as "mini" ROMs and should still work, although I cannot vouch for that. What I recommend is a WRT54G v1.1 - v4.0. There are other routers you can use; for compatibility see

With a capable router in hand, you will want to follow instructions for your router VERY carefully. If you don't you will risk "bricking" your router at which point, without serious intervention, it's rendered useless. Once you have flashed your router upon going to it's default IP address ( in a browser you should see something like this:

Once you have DD-WRT installed on your router (as pictured above) you can proceed to setup DNSMasq. DNSMasq is what allows us to define DNS A records (A records are what maps names to IPs) so you can point your dev, test or live URLs to particular IP addresses. If you click on the Services tab you should see something like this:


When you enable DNSMasq it's like turning your router into a DNS server. In the textarea named "Additional DNSMasq Options" you enter addresses in the format:

address=/<hostname>/<ip address>

In the example above I want to configure and to have an IP address of, which points to my local Drupal server. Once you connect to this router with a wireless device, as long as you configure the router with DHCP it will assign each clients DNS server to be the router. Please remember to secure your wireless networks and comply with any IT policies your company may have! What is nice about setting up a router is you can enlist anybody with a wireless device in your company to test just by giving them your wireless SSID and credentials; no need for them to fuss with an emulator.

I hope you found this article helpful and inspiring to explore DD-WRT more. Do you have something else to share about this setup? Please comment and share your thoughts!