DHCP ddns-domainname : Dynamically select domain name based on the subnet.

TomK tomkcpr at mdevsys.com
Fri Mar 15 06:15:20 UTC 2019


Hey All,

Is there a way to dynamically register host names with the DNS server 
(named) based on the subnet from which the client got the IP?

DETAILS
Let's say I have the following subnets defined in DHCP + DNS (named) 
that in turn all run on a single VM that has 3 NIC's:

1) 5.5.1.0/24  ( VLAN 123 ) eth0
2) 5.5.2.0/24  ( VLAN 124 ) eth1
3) 5.5.3.0/24  ( VLAN 125 ) eth2

And I've configured my DNS server authoritative for the following domains:

1) a.dom.abc
2) b.dom.abc
3) c.dom.abc

When using ddns-domainname, I can automatically register each new client 
with the DNS however I can only select a single domain using option:

ddns-domainname

What I want to achieve is the following:

1) Clients that are configured on subnet 1) should be dynamically 
updated in the DNS using domain <HOST>.a.dom.abc .

2) Clients that are configured on subnet 2) should be dynamically 
updated in the DNS using domain <HOST>.b.dom.abc .

3) Clients that are configured on subnet 3) should be dynamically 
updated in the DNS using domain <HOST>.c.dom.abc .


So if I build a CentOS 7 machine on subnet 2) [5.5.2.0/24] and give it a 
hostname such as new-host01, then the DHCP should update the DNS with 
the entry:

new-host01.b.dom.abc		A	5.5.2.13

for example.

How could I achieve this via the DNS / DHCP server configuration?

-- 
Thx,
TK

PS:

I can configure the clients with a custom script in /etc/dhclient.conf 
and use the option:

server fqdn.fqdn <CLIENT FQDN>

however that is more of a hackish solution and not very flexible at all, 
involving customization of clients, templating etc.


More information about the dhcp-users mailing list