1

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?

2 Answers2

1

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.

Ansgar Wiechers
  • 4,247
  • 2
  • 18
  • 26
  • 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. –  Sep 20 '12 at 06:41
  • You can't configure BIND to use forwarders from DHCP. What might work is using a script to [discover](http://nmap.org/nsedoc/scripts/dhcp-discover.html) the DNS servers, change the forwarders in your `named.conf` and restart BIND. – Ansgar Wiechers Sep 20 '12 at 08:58
1

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.

Ladadadada
  • 26,337
  • 7
  • 59
  • 90