On 5/9/22 10:57, hamish@moffatt.email wrote:
On 29/8/22 18:43, Hamish Moffatt wrote:
I've got dnsmasq listening on multiple interfaces (two VLANs), and at least one client that is also on both VLANs at once. The client has the same MAC address on both VLANs. I'd like to assign an IP address on each VLAN via DHCP.

I have the following in my config:

dhcp-host=38:C9:86:40:86:37,192.168.42.18,[::0:18],potoroo
dhcp-host=38:C9:86:40:86:37,192.168.66.18,potoroo-iotlan

dnsmasq (v2.80, in OpenWRT 19.07) seems to allocate the IP addresses ok, but only the most recently leased hostname requested works.


I've now got v2.85 (OpenWRT 21.02) and the behaviour has changed - I now get IPv6 addresses from both subnets returned for the host name. Only the latest IPv4 address leased is returned still though.


Now on v2.86 (OpenWRT 22.03).


So, I got the suggestion off-list to set the DHCP client-id uniquely for each connection. This fixed IPv4, even without matching on the client ID in the config, because dnsmasq is tracking both separately in the leases file. Leases (just IPv4) showed:

1662658086 38:c9:86:40:86:37 192.168.42.18 potoroo ff:b7:b0:95:87:00:03:00:01:83:6d:06:a5:ef:01 1662658067 38:c9:86:40:86:37 192.168.66.18 potoroo-iotlan ff:cc:62:6a:65:00:03:00:01:cb:45:f5:1b:f7:42


However it did not fix IPv6, where the hostnames ended up being associated with the wrong IP sometimes and even shown that way in the log. The fix for this was to match on client ID, but I couldn't get the client ID to match for IPv4 and IPv6, so I ended up with two separate entries for each host:

dhcp-host=,id:ff:b7:b0:95:87:00:03:00:01:83:6d:06:a5:ef:01,192.168.42.18,potoroo
dhcp-host=,id:ff:cc:62:6a:65:00:03:00:01:cb:45:f5:1b:f7:42,192.168.66.18,potoroo-iotlan
dhcp-host=,id:00:03:00:01:83:6d:06:a5:ef:01,[::0:18],potoroo
dhcp-host=,id:00:03:00:01:cb:45:f5:1b:f7:42,[::0:18],potoroo-iotlan


This seems to work as expected. In NetworkManager I had to set the following on each connection to get distinct client IDs:

connection.stable-id:                   "${CONNECTION}"
ipv4.dhcp-client-id:                    ipv6-duid
ipv6.dhcp-duid:                         stable-ll


... although there are many other configurations that would work too.


Hamish

_______________________________________________
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss

Reply via email to