Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I run BIND locally on my OS X machine, to enable wildcard Apache vhosts, which requires setting the DNS server for all network interfaces to 127.0.0.1.

This works great, but means when I am on a network which uses an internal DNS server to route special (i.e. .companyname) URLs to a server on the network, the lookup fails.

I tried adding both 127.0.0.1 and the DHCP provided DNS server, but this doesn't work either.

Is there a way to make BIND use the DHCP DNS server for requests it cannot resolve locally?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

Bind was not designed for this use-case. It was designed to be run on a server where the same sysadmin configures it and the DHCP server. It was not designed to move.

You could hack together a script to change the forwarders in Bind every time your DHCP lease was refreshed but I couldn't recommend this. You will run into caching issues where your .company domains are cached as NXDOMAIN when they shouldn't be or cached as a real IPs when they shouldn't be.

There may be a specialised caching/resolving mame server that has the functionality you're after built in but Bind isn't it.

share|improve this answer

You can configure forwarders to which BIND will forward all requests that it cannot resolve by itself. However, BIND is always able to resolve any name for a domain for which it is authoritative. If you configure a wildcard record *.example.com, you can't make BIND resolve foo.example.com from some other DNS server. You would need to configure those records in the zone hosted by your BIND instance.

share|improve this answer
    
The local instance of BIND is only authoritative for .localhost domains, so that won't be a problem - it's .companyname domains that aren't working. I have done a bit of research on forwarders, but don't know how to set it up to use the DHCP DNS server. –  user81077 Sep 20 '12 at 6:41
    
You can't configure BIND to use forwarders from DHCP. What might work is using a script to discover the DNS servers, change the forwarders in your named.conf and restart BIND. –  Ansgar Wiechers Sep 20 '12 at 8:58

Your Answer

 
discard

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