DNSMasq – Setting Up as DNS and DHCP Server on LAN

dhcpdnsmasqhostnamelocal-area-network

My routers:

Main Router: 192.168.100.1

Second Router: 192.168.101.1

The Main Router is provided by my ISP(a modem/router combo all in one). I don't have control over its settings. Except for changing the WIFI password and SSID.

On the Second Router, I have control over its DNS settings.

My Second Router's WAN port is connected to a LAN port on the Main router.
I have a Debian Server with dnsmasq installed and connected on the Second Router's network with a static IP of 192.168.101.121. For those who don't know, dnsmasq is both a DNS and DHCP server(not enable by default).

On the Second Router's DNS setting, I added the dnsmasq DNS server(debian server) IP as the primary DNS IP and the Main Router's IP as the the secondary DNS IP. It works fine.

Every line in /etc/hosts on the Debian server is accessible on all hosts that is connected on the Second Router's network. That's ok.

The problem is with DHCP. As a DHCP client, you can send your hostname to the DHCP server, and it will be added to the DNS.

As the Second Router is already acting as a DHCP server, I can't just enable DHCP on dnsmasq. If I do enable it, I'll have to provide a different range(other than the second router is providing).

Only the second router is getting the hostnames, not dnsmasq. Has anyone run into the same problem ? Is it possible to pull the hostname entries from the second router to dnsmasq ? Thanks.

Best Answer

That's not a problem, that's expected behavior. It you want to register the DHCP leases in DNS the DHCP server must do so. Your off the shelf router most probably just can't, so you will have to disable DHCP on the router and enable it in Dnsmasq.

Related Topic