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'm running apache and bind9 on the same server. I would like to set a master zone to route back to this very machine's IP address without explicitly specifying it. Is this possible?

If I use for the A record, then when another computer on the network does an nslookup for mydomain.local, bind of course just returns the loopback ip ( -- not the IP of the server.

Is there to way to tell it to just return the network IP address for the server itself, as defined in /etc/network/interfaces?

share|improve this question
up vote 2 down vote accepted

So here's my newly formatted reply.

You can do several things for a changing local IP address.

Option 1 - dnsmasq + hosts + subzone

You can define all your other names do a CNAME on this subzone which you could configure from dnsmasq in the same server.

With this you can just have some ssh script triggered on the event of an IP change that'll automatically change the hosts file on the remote server and restart dnsmasq

Option 2 - DNS dynamic zones

You can use dns dynamic update to configure your local zone to accept changes from authorized clients, do the same as in option one with the CNAMEs and have a dynamic entry for your server with a very low TTL, then create a script in your machine that checks your IP and if different proceed to update.

I much rather like option 2,it's a lot cleaner and it uses a feature in bind that is underused and quite awesome.

share|improve this answer
Ah sorry Greg, I'll reformat my answer :) – lynxman Feb 1 '11 at 14:38
Hope that is better! – lynxman Feb 1 '11 at 14:51
Makes sense -- thank you much. – Greg Feb 1 '11 at 14:58
I think you misunderstood me. I should have probably warned ahead of time that I'm an ignorant dolt when it comes to servers, so I have a hard time explaining things - sorry. I don't need to make the results of the lookup 'different' for the server -- just for bind to return the server's local IP (which is static, but may be subject to change later). Unfortunately, I don't think I can get away with a simple edit to the hosts file, as I absolutely need wildcard subdomains in this case. (deleted / reposted: meant to say "AM an ignorant dolt, etc..") – Greg Feb 3 '11 at 4:56

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.