问题原文
原帖链接 · enpaul · CC BY-SA 4.0
TL;DR: How do I configure the Ubiquiti EdgeRouter, running DNSmasq or DHCPd, and NSupdate, to send its DHCP leases to a central BIND server?
I have a system comprised of a few Ubiquiti EdgeRouter X's all acting as DHCP and DNS servers for a local subnet. Inter-subnet routing between ERXs is handled by a core router. What I would like to do is configure the ERX gateways to update a master DNS server, running BIND, whenever they update their DHCP leases.
Referencing the diagram below: With each ERX serving DHCP and DNS for its local subnet, the clients can only resolve DNS names of other clients behind their local ERX. However, if each ERX sent its records to dns-master whenver a DHCP lease update occurred, and each client used dns-master as its DNS server, then any client could resolve the name of any other client. This is what I am trying to achieve.
router-core
/ | \
/ dns-master \
/ \
erx-1 erx-2
| |
|-- client-1a |-- client-2a
|-- client-1b |-- client-2b
What I've done so far:
- BIND is configured to accept updates via
nsupdateand I confirmed that it works from my local workstation - I've installed
dnsutilson the ERX's using Apt after activating the Debian repo - I've explored the
dhcp-scriptoption from the Dnsmasq config file (better description of that option in the man page), but I can't get my script to execute- Dnsmasq on the EdgeRouter seems to use both
/etc/dnsmasq.confand/etc/dnsmasq.d/dnsmasq-dhcp-config.conf, but adding thedhcp-scriptoption to the former had no effect and adding it to the latter generated a config syntax error - I have tried both modifying the Dnsmasq config files directly and setting options in the ERX config under
set service dhcp-server global-parametersand neither seemed to work (but I'm also not sure if I did them right)
- Dnsmasq on the EdgeRouter seems to use both
[EDIT]: The Edgerouter also supports using Dhcpd as a DHCP server, so I'd accept an answer describing how to configure DHCPd on the ER to do this as well; I'm not married to using DNSmasq
已采纳解答
原帖链接 · enpaul · CC BY-SA 4.0
With a suggestion from @Tom I figured out a way to do this without using a BIND server.
The solution is to configure each ERX as the authoritative DNS server for its local subnet and create server delegations on the core router for each subdomain, then point all clients at the core router. The Edgerouter specific configuration directives are listed below, replacing sub1.local with the proper DNS subdomain, and 192.168.100.5 with the IP address of the ERX:
On the core-router (LAN IP 192.168.100.1):
set service dns forwarding listen-on eth1 set service dns forwarding name-server 8.8.8.8 set service dns forwarding name-server 8.8.4.4 set service dns forwarding options "server=/.sub1.local/192.168.100.5"
On each ERX (Example, WAN IP 192.168.100.5):
set service dns forwarding listen-on eth0 set service dhcp-server shared-network-name [server] subnet [subnet] domain-name sub1.local set service dhcp-server shared-network-name [server] subnet [subnet] dns-server 192.168.100.1
When a client submits a DNS query to the router-core, then one of three things happens:
- If the
router-corecan resolve it, then it does - If the request matches a subdomain, the request is forwarded to the ERX specified for the subdomain
- If the request does not match then it is passed to the upstream DNS servers
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
