2

I have the need to run a local DNS server for a local (non-routable) domain on my laptop, for development purposes. Simply editing /etc/hosts is not sufficient for my case, because I need certain VMs, which depend on actual DNS, to resolve the local domain.

Configuring bind to serve the local domain is easy. Configuring bind with forwarding addresses is also easy.

The problem lies in that once bind is configured, and resolvconf set to use 127.0.0.1 for name resolution, connections to wireless networks that depend on a web-based authentication breaks, since the local wireless network's DNS servers are no longer used.

Is there some way to dynamically set Bind's forwarding addresses when the network is brought up (perhaps via resolvconf, or some other similar service)?

Alternately, is there some way to use my local bind server only for my local domain name, and use those provided by DHCP for all other name resolution?

  • Do you have resolvconf-update-bind script in /etc/resolvconf/update.d/ directory? – AnFi Sep 20 '17 at 5:16
  • Why don't you drop bind in favour of DNSMasq? – davidgo Sep 20 '17 at 5:53
  • @davidgo: dnsmasq doesn't work as an authoritative name server, so obviously it won't serve my needs. Maybe dnsmasq could be used along side bind, to accomplish my needs--if you think it would, I'd love to see your answer. – Flimzy Sep 20 '17 at 14:26
  • @AndrzejA.Filip: No, I'm not familiar with that file. Is that part of the standard resolvconf distribution? – Flimzy Sep 20 '17 at 14:27
  • @Flimzy AFAIR: Sample script (for bind8) is provided in debian resolvconf package BUT it is not installed in /etc/resolvconf/update.d/. – AnFi Sep 20 '17 at 18:17
1

resolvconf program is capable to reconfigure bind to use per current connection DNS forwarders.

Sample resolvconf-update-bind script for bind8 is provided in debian resolvconf package
BUT it is not automatically installed in /etc/resolvconf/update.d/ directory.

0

Can you add the Wireless DNS's servers to the bind's forwarders ?? Eg. in your /etc/bind/named.conf.options configuration file :

options {
    directory "/var/cache/bind";

    recursion yes;                 # enables resursive queries
    ...
    allow-transfer { none; };      # disable zone transfers by default

    forwarders {
            Wireless DNS's server;
            Other DNS server IP (open dns resolver, ...);
    };
...
};

In that case, bind will forward request the requested domain if it is not present in his configured zone, first to the Wireless DNS server, second to the open DNS server. As you are 'stacking' resolvers, this might induce delay in your DNS reply for domain not served by the wireless DNS server. You should then set up a dns cache server.

EDIT

Source: https://www.digitalocean.com/community/tutorials/how-to-configure-bind-as-a-private-network-dns-server-on-ubuntu-14-04

Specify DNS server for specific domain

Source: https://serverfault.com/questions/391914/is-there-a-way-to-use-a-specific-dns-for-a-specific-domain

This is not possible with resolv.conf. But you can acheive that with dnsmasq:

/etc/dnsmasq.conf:

server=/mydomain.net/X.X.X.X

where X.X.X.X is your local DNS server which is not present in your dhcp filled resolv.conf file.

  • As stated in the question: Configuring bind with forwarding addresses is easy. The problem is that the forwarders I need to use change depending on which network I'm connected to. – Flimzy Sep 20 '17 at 14:23
  • sorry I did not point out that servers are changing – vera Sep 20 '17 at 15:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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