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

Simon Hobson dhcp1 at thehobsons.co.uk
Fri Mar 15 10:31:48 UTC 2019


TomK <tomkcpr at mdevsys.com> wrote:

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

That will happen automagically if you define ddns-domainname within each subnet declaration. Along these lines :

subnet 5.5.1.0 ... {
  ...
  ddns-domainname a.dom.abc ;
}
subnet 5.5.2.0 ... {
  ...
  ddns-domainname b.dom.abc ;
}
subnet 5.5.3.0 ... {
  ...
  ddns-domainname c.dom.abc ;
}

When a client requests a lease, it will automagically be associated with the appropriate subnet, and will be given the options that are in-scope for that subnet. So in this case, the ddns-domainname will come from the value defined in that subnet, over-riding any global declaration. The inheritance chain would go global scope -> shared subnet -> subnet -> pool and an option can be re-defined in any of those scopes. This makes it easy to define most options globally, and over-ride them for specific subnets or even pools.



More information about the dhcp-users mailing list