大网数据广告活动
服务器运维问答

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

· 52CE 我爱测

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. O…

问题原文

原帖链接 · Kavish Gour · CC BY-SA 4.0

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.

已采纳解答

原帖链接 · Gerald Schneider · CC BY-SA 4.0

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.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2021-10-23)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。