[Dnsmasq-discuss] Using cname to alias dhcp-host IDs

john doe johndoe65534 at mail.com
Thu Dec 24 06:09:28 GMT 2020


On 12/23/2020 7:08 PM, Arthur Wiebe wrote:
>  From reading the man page, and my understanding of the statement "Only one
> hostname can be given in a --dhcp-host option, but aliases are possible by
> using CNAMEs. (See --cname )" I've been attempting to implement this
> without any success so far.
>
> My goal is to have two names get assigned the same IP via DHCP. The purpose
> of this is transitioning IPSec IDs as I have strongswan using dnsmasq to
> assign static IPs to mobile clients.
>
> In this example I would like both DEVICE_V1 and DEVICE_V2 to get the same
> IP address 10.1.2.3 and my current attempted configuration is as follows.
>
> /etc/hosts contains:
>
> 10.1.2.3 DEVICE_V1
>
> --
>
> dnsmasq conf file contains:
>
> cname=DEVICE_V2,DEVICE_V1
> dhcp-host=DEVICE_V1,10.1.2.3,infinite
>

Couple of thoughts here and this assumes that DEVICE_V1 is having the
correct IP before fiddling with cnames:

- Does it help if you remove the line from /etc/hosts file and only use
the 'dhcp-host' statement?

With 'dhcp-host' as shown above, the client presenting the hostname
'DEVICE_V1' should get the fixed address shown above.

The cname option that you have, will let DNS resolve  'DEVICEV1' or
'DEVICE_V2'.

So 'host DEVICE_V1' or 'host DEVICE_V2' should show for both the IP of
DEVICE_V1.


- When Dnsmasq starts, is DEVICE_V1 present in the lease file?

Cnames are only created if the hostname is known to Dnsmasq when starting.


--
John Doe



More information about the Dnsmasq-discuss mailing list