Setting up DNS to get LAN addresses from DHCP

I have a small LAN getting addresses via DHCP. I want to be able to resolve LAN addresses. I have only one NIC.

I have used named (bind?) and unbound. I don't remember how to configure either to get their DNS addresses from a DHCP server. I have looked and dnsmasq, but it seems that I have to build a host file with my LAN addresses. It does not seem to have support for changing DHCP assignments.

Google has not been my friend. Is there a way for DNS to get my LAN addresses from DHCP?

TIA.

-JJ
 
Yes, but you have it backwards. You have to allow DHCP to update DNS. I've implemented this using ISC BIND and Dhcpd.

In my named.conf I have
Code:
include "/usr/local/etc/namedb/rndc.key";
controls {
        inet 127.0.0.1 port 953 allow { 127.0.0.1/32; ::1/128; } keys { "rndc-key"; };
};
And in my dhcpd.conf
Code:
include "/usr/local/etc/namedb/rndc.key";
# Dynamic DNS update
ddns-update-style interim;

The rndc.key looks something like this:
Code:
key "rndc-key" {
    algorithm hmac-md5;
    secret "someverylongstring";
};

I probably generated the key using something like this:

I don't remember. It's been years. Also, you should use ddns-update-style standard; nowadays.
 
I have nothing against the ISC products and have used them often for more than 25 years. They are the benchmarks.

However, I believe that dns/dnsmasq has a lot to offer in the context of the home network (simple, easy, well supported, and well behaved).

I run dnsmasq on my firewall as the name server and DHCP server for the local LAN. Here is the entire configuration:
Code:
[pi3b.638] # grep -v "^#" /etc/dnsmasq.conf | sed -e '/^$/d'
domain-needed
bogus-priv
server=8.8.8.8
local=/my.first.domain/
local=/my.second.domain/
listen-address=127.0.0.1
listen-address=192.168.1.254
dhcp-range=192.168.1.221,192.168.1.240,255.255.255.0,12h
dhcp-host=00:18:dd:11:01:68,hdhr-1110168b
dhcp-host=00:18:dd:25:1c:d0,hdhr-1251cd09
dhcp-host=08:00:27:af:d6:62,d10
dhcp-host=08:00:27:b6:77:aa,f12
dhcp-host=08:00:27:c7:d0:76,f13
cache-size=10000
no-negcache
log-queries
log-dhcp
dhcp-mac=set:client_is_a_pi,B8:27:EB:*:*:*
dhcp-reply-delay=tag:client_is_a_pi,2
min-cache-ttl=900
dhcp-name-match=set:wpad-ignore,wpad
dhcp-ignore-names=tag:wpad-ignore
The default gateway for my internal network is 192.168.1.254, which is the address of the firewall on the LAN.
Dnsmasq will read, and use, the local /etc/hosts by default. You generally want this, but you can disable that easily if you want ("no-hosts").
There are two HD Homeruns (hdhr-*) and three VMs (d10, f12, and f13) that have their MAC addresses tied to fixed IP addresses (enumerated in /etc/hosts)
Everything else asking for an IP address gets a lease in the range 192.168.1.221/24 to 192.168.1.240/24.
You can ignore the "client_is_a_pi" unless you are running on a Raspberry Pi.
The "wpad" stuff is a bug fix.
The rest is pretty much well explained in /usr/local/etc/dnsmasq.conf.sample.
 
Back
Top