Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have no idea where to start from so sorry in advance if this topic has already been discussed.

I usually develop web sites using my laptop as a development server, and recently I needed to test a web site using various mobile devices that can connect via wifi. Having no real AP, I set up a ad-hoc network using my laptop's wireless card and the devices can correctly browse the Internet and access the laptop's web server. The setup is as follows:

  • subnet:
  • gateway to the Internet (wired adsl router/modem):
  • laptop: (eth0, wired if connected to the gateway) and (eth1, wifi if somewhat bridged to eth0)
  • mobile devices (same for all, I only use one of them at any time for simplicity): with default gw

Now, if I open either or from the mobile devices, I correctly get the default host of my Apache configuration. However I usually work with virtual hosts for many practical reasons, one of which being Drupal's peculiar implementation of multi-sites. For those who don't know how this works, Drupal takes the request's hostname and searches into its sites/ subdirectories for an appropriate configuration file. So, for example, suppose I request, then Drupal would search for a config file in the following directories:


So I decided to adopt the following style of virtual hosts: if the website I'm working on will be accessible using I set up a sites/ directory and create a virtual host for so Drupal have no trouble finding it. I've been told this is suboptimal from a dns point of view since I'd have to create an authoritative entry for and turn Bind on only when I'm supposed to access the local copy, which is weird. However, if this is the only path I can follow, I still have some problems with Bind's configuration, as I couldn't find any guide that tells me in a clear, noob-friendly way, how to set up such an entry. On the other hand, I was wondering if I could set up an authoritative entry for local, so I could access and tell in some way (which I don't even know if this is possible) Apache to put instead of in the relevant environment variable.

Anyway, I have a last problem, sort of: when I launch Bind in debug mode with high verbosity, and make as the primary dns for the devices, the output doesn't say anything about requests being made from the devices to Bind, so I'm not even sure it comes into play.

As you can see, I'm a complete noob at these matters, but I'm eager to learn, so any help/pointer will be appreciated.

share|improve this question
What kind of mobile devices? Do you have access to system configuration? I usually handle this by editing /etc/hosts (or equivalent) on my desktop, laptop, and virtual machine. I use the convention for my names so they don't conflict with anything "real". Bind is wide and deep, but if you have to go this way, I would suggest investigating an application or service that does the DNS work for you, like or maybe, then it would be a matter of configuring the devices to use a specific DNS server. – bogeymin Jan 29 '11 at 11:53
You can safely assume I don't have access to the configurations of the devices, as they are an iPod touch and various smartphones, like Symbian, Blackberry and so on... so you can easily see that /etc/hosts is not an option (which, however, I locally use in the laptop itself, and it works... for the laptop only) – Morpheu5 Jan 29 '11 at 21:53
It is possible to edit /etc/hosts on an iPod or iPhone. Also, I think you should tone down your responses a little if you want help. Making us all feel like idiots is not going to get you the help you need. – bogeymin Feb 4 '11 at 12:34
First of all, it is true you can edit the hosts file on the iPod/iPhone... after jailbreaking it, which is a thing I didn't do and I do not intend to do. Second, while it is technically possible to do that, I'm not working on iPhones only, I come across all kind of devices, and frankly the burden of researching the ad-hoc solution for all of them greatly surpasses that of setting up a local dns -- not to mention that I can at any time find one device that can't be configured. Third, I never treated anyone like an idiot and you definitely misread my words and are overreacting. – Morpheu5 Feb 6 '11 at 17:23
@morpheu5 - you should post your answer as an actual answer and mark it as such – Ben Pilbrow Feb 6 '11 at 17:33
up vote 1 down vote accepted

sorry for the delay, I finally found a solution after lots of experiments. First of all, here's the zone file I use for the local. domain:

$TTL 1800

@       IN      SOA     local. root.porto.local. (
                        2010061500      ; serial
                        7200            ; refresh
                        3600            ; retry
                        604800          ; expire
                        1800            ; default_ttl

                NS      porto.local.

$ORIGIN local.

porto   IN      A
www             IN      A

to which I can add lines like IN      A

which results in the ability to query for, and that's one thing.

In order to take into account of Drupal's weird behaviour, I actually found a solution that doesn't prevent me from working with the real remote while working on a local copy, except that I had to set a zone for and the host line for www which results in the odd and long frankly a bit too much to keep my mental health. I'll go for the local. way and s/.local// the database dump I'm going to deploy to the production server.

Thanks to everyone that replied.

share|improve this answer

One other solution is to setup a little proxy on your desktop machine (where you develop and host your sites with your multiple virtual hosts). For example, on Windows you could use Fiddler. If you are running Mac OS X or Linux, you can give a try to Charles (but it's not free).

Under Fiddler, you have to activate the option "Allow remote computers to connect" on the "Connections" tab of the options window.

Then you have to configure your mobile device to use the proxy. This can easily be done in the WiFi settings of the mobile device.

I expect that when you create your VirtualHost on your local web server you also edit your hosts file so that you can browse your sites locally. Now, you would like your mobile device to do the same.

This is where the proxy comes into place. The proxy is able to read your local hosts file (C:\Windows\System32\drivers\etc\hosts or /etc/hosts) so this means that your mobile device will be automatically routed to your local web server.

What is also interesting with this solution, is that you can simulate slow traffic networks and clearly see what your mobile device actually downloads (quite useful when using media queries and responsive images).

I found this article that very well explains how to do it : Testing a Mac OS X web site using a local hostname on a mobile device

share|improve this answer

Well honestly you may have overcomplicated your situation, you don't really need bind as you can just enter into your host file. If you want to learn how to use bind though try seeing what happens when you lookup that domain in NSlookup and see what it tells you, that can help a lot.

share|improve this answer
See, if I could do something like that, I'd already have done it. Infact I did exactly that in the laptop, and it works... for the laptop. As I don't have access to the other devices' configuration, I can't apply the same principle. I'm left with needing some kind of dsn or something like that. – Morpheu5 Jan 29 '11 at 21:55
try seeing what happens when you lookup that domain in NSlookup and see what it tells you, that can help a lot – Jacob Jan 29 '11 at 21:58
I can only do this with the laptop, which has the entry configured in /etc/hosts... obviously it'll resolve to or something like that. I have no way to use nslookup on, say, an ipod touch, a symbian or a blackberry device, in general. Especially the ipod, I guess. – Morpheu5 Jan 29 '11 at 22:01
Well, you could drop the hosts line and ask it to query it's self. – Jacob Jan 29 '11 at 22:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.