Score:1

Setting up dnsmasq as a DNS and DHCP server on a LAN

kz flag

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.

in flag
Disable DHCP on the second router. Since this is consumer grade it is of-topic for this site.
Kavish Gour avatar
kz flag
Yep. Works fine now. Thanks Nik.
Score:2
in flag

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.

Kavish Gour avatar
kz flag
Thanks Gerald. Now everything works fine.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.