DHCP via DNSmasq in 25.1.6: IPv6 OK, IPv4 not working properly

Started by dinguz, May 08, 2025, 09:25:37 PM

Previous topic - Next topic
Heres some context I found, I might add this to the documentation later as there are requests to explain it better.

# Do Router Advertisements, BUT NOT DHCP for this subnet.
#dhcp-range=1234::, ra-only

# Do Router Advertisements, BUT NOT DHCP for this subnet, also try and
# add names to the DNS for the IPv6 address of SLAAC-configured dual-stack
# hosts. Use the DHCPv4 lease to derive the name, network segment and
# MAC address and assume that the host will also have an
# IPv6 address calculated using the SLAAC algorithm.
#dhcp-range=1234::, ra-names

# Do Router Advertisements, BUT NOT DHCP for this subnet.
# Set the lifetime to 46 hours. (Note: minimum lifetime is 2 hours.)
#dhcp-range=1234::, ra-only, 48h

# Do DHCP and Router Advertisements for this subnet. Set the A bit in the RA
# so that clients can use SLAAC addresses as well as DHCP ones.
#dhcp-range=1234::2, 1234::500, slaac

# Do Router Advertisements and stateless DHCP for this subnet. Clients will
# not get addresses from DHCP, but they will get other configuration information.
# They will use SLAAC for addresses.
#dhcp-range=1234::, ra-stateless

# Do stateless DHCP, SLAAC, and generate DNS names for SLAAC addresses
# from DHCPv4 leases.
#dhcp-range=1234::, ra-stateless, ra-names

# Do router advertisements for all subnets where we're doing DHCPv6
# Unless overridden by ra-stateless, ra-names, et al, the router
# advertisements will have the M and O bits set, so that the clients
# get addresses and configuration from DHCPv6, and the A bit reset, so the
# clients don't use SLAAC addresses.
#enable-ra
Hardware:
DEC740

Thank you. Then just setting "slaac" is the right choice for stateful DHCP + SLAAC. "ra-names" is optional, but a good choice to generate DNS names for SLAAC from DHCPv4 leases, if needed.

As I understood it, ra-names does the DNS entries for the DHCPv6 leases, not the DHCPv4 ones. I do not use them, as I only use "unmanaged" RAs. I found that when you use the "dns-search [24]" DHCPv6 option and enable RA with DNSmasq, it also sends DNSSL.

That being said, I am aware of not all types of clients support DNS settings via RA, which is the reason for people using "assisted" mode, however: there is no clear-cut indication what a client should use when dual-stack is in use. What settings take precedence? DHCPv4 or DHCPv6?
That is why I do not use DHCPv6 in presence of DHCPv4 and stay mostly with IPv4 on my LANs. IPv6 is mostly used for internet access. Also, as many others, I only have dynamic IPv6 prefixes, so using DNS on that would be a hassle, anyway.
Intel N100, 4 x I226-V, 16 GByte, 256 GByte NVME, ZTE F6005

1100 down / 800 up, Bufferbloat A+

Quote from: Vexz on May 13, 2025, 05:55:28 PMStrange. I just tried it again without changing anything of the dnsmasq settings and it works now (IPv4 and IPv6). Obtaining an IP address takes much longer than with ISC DHCP though.

Edit:
Anything I can do to fix these warnings in the logs? Sounds like something isn't quite right with my IP reservation for this host.
not giving name Gaming-Server.home to the DHCP lease of XXXX:XX:XXXX:7c00::3 because the name exists in /var/etc/dnsmasq-hosts with address ::3(I censored the IPv6, because it's a valid lease.)

Thanks for this report, I think the fix might emerge from here now:

https://github.com/opnsense/core/issues/8642
https://github.com/opnsense/core/pull/8653
Hardware:
DEC740