3

I have setup a DNS server for my department which is running FreeBSD 10.2. It is currently connected to the campus internet and receiving its address via dhcp, so /etc/resolv.conf looks like this:

#Generated by resolvconf
search ttu.edu
nameserver x.x.x.x
nameserver x.x.x.x

I need the first nameserver to be 127.0.0.1. Therefore, I put the following in /etc/dhclient.conf:

interface "igb0" {
    prepend domain-name-servers 127.0.0.1;
}

However, now /etc/resolv.conf gets entirely rewritten and the only thing left is:

#Generated by resolvconf
nameserver 127.0.0.1 

Why did everything else go away and how do I prepend the local dns server without losing everything else?

Chuck
  • 31
  • 2
  • Have you looked at `/etc/resolvconf.conf`. Looking at the man page, it seems to have a similar function that might work for you. – Richard Smith Mar 24 '16 at 18:06
  • Yes, I have. Adding the localhost to resolvconf yields the same result, which is a complete overwrite of resolv.conf instead of just a prepend. – Chuck Mar 24 '16 at 20:06
  • Why would you use every client as their own DNS? By default, `/etc/hosts` gets checked before trying with any DNS server. Unless they all have set up a slave server (which wouldn't be the best way to do it), I would recommend you to just run a script through the whole network when there are changes so you update `/etc/hosts` – sysfiend Apr 15 '16 at 07:40

1 Answers1

0

Have a look at the resolv_conf_local_only option in resolvconf.conf. It says:

If a local name server is configured then the default is just to specify that and ignore all other entries as they will be configured for the local name server. Set this to NO to also list non-local nameservers. This will give you working DNS even if the local nameserver stops functioning at the expense of duplicated server queries.

Since you are configuring a local nameserver, this might be the root of your issue. Try adding resolv_conf_local_only=NO to /etc/resolvconf.conf

Matt Simerson
  • 419
  • 3
  • 9