[Dnsmasq-discuss] IPv6 dhcp-range and static addresses

Kristof Mattei kristofmattei at outlook.com
Mon Jan 20 21:41:50 GMT 2020


Hello all,

With dhcp6c.conf my internal interface gets a GUA/64.

This means that in order for dnsmasq to correctly distribute addresses in that range my dhcp-range needs to be as follows:

dhcp-range=::0,::ffff,constructor:br0,12h

as it can be basically ANY address in between, this is great, as I don't need to know my IPv6 address! 

Now let's combine that with an ULA that I set on the interface, say fd00:1234:5678:9abc:ef00::/64 

That same dhcp-range still works, but now it's starts to  get more limited.

Ideally I want to distribute starting at ::1000 ending in ::ffff for the ULA. But then I cannot combine my 2 ranges anymore, as I risk that my outside IPV6 address falls out of that range and that dnsmasq stops distributing in that range, because with dhcp-range the range must include the address of the interface. (http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/2013q2/007261.html) 

So this means that I really need 2 ranges, one my ULA, and one for my GUA. No problem, we can script that. 

Let's look at how the IPv4 range was done:
Gateway: 1, static 2->50, DHCP 51->200. 

Doing that in IPv6 gives the following range:

dhcp-range=fd00:1234:5678:9abc:ef00::1000, fd00:1234:5678:9abc:ef00::ffff,12h

as I want to reserve the bottom 1000 address to be static. 

But this doesn't work because of the above-mentioned dhcp-range issue. 

I could do the following:
1) Change the ULA address to ::1000, and allocate static IPs below 
2) Start at ::0, exclude the static ones with dhcp-host
3) Start at ::0, end at ::1000, allocate static IPs above
4) Add the start ip as a second ip on the interface (dirty)


My questions are:
1) am I missing something / is this correct?
2) does dhcp-host ensure that no-one gets that IP except for THAT host? Because dnsmasq calculates IPs based on MAC addresses
3) what are other suggestions combining dhcpv6 and static IPs in the same range? 
4) How does FreshTomato do it? They set ::1 on their internal interface (https://bitbucket.org/pedro311/freshtomato-arm/src/94481a556b875ba4ac1aea5a32a0653ac22591c7/release/src-rt-6.x.4708/router/rc/dhcp.c#lines-615) and start their range at ::2, ending in ::ffff:ffff (https://bitbucket.org/pedro311/freshtomato-arm/src/94481a556b875ba4ac1aea5a32a0653ac22591c7/release/src-rt-6.x.4708/router/rc/services.c#lines-510)
5) what does it mean to start your range at ::2 and end in ::ffff:ffff (in case the answer to 4 doesn't cover this)

Thanks,
-Kristof



--
Kristof Mattei



More information about the Dnsmasq-discuss mailing list