Static IPv6 address allocation based on MAC



  • Searched around first and couldn't find an answer, though I'm sure SOMEONE must have asked about this before.

    Is it possible to allocate addresses via PfSense/DHCPv6 based on just the Mac address? I need to allocate a consistent address to a device regardless of whether it's booted into another OS, or if the OS has been reinstalled.

    It seems this might be possible with DUID-EN, however, I'm unsure if it's possible for DHCPv6 to insist on DUID-EN.

    While I have worked with IPv6 in the past somewhat, this is my first experience with DHCPv6.



  • @hiryu

    If you want addresses based on the MAC, you don't need DHCPv6. It happens automagically with SLAAC. However, depending on the configuration, a consistent random number might be used instead. The details for changing that depend on the operating system.



  • This would require some manual tuning of multiple OS's to result in an identical OS.

    At this point, it's probably easier/faster to just assign the same static address across them... Which means each time there's a new install on any of these machines, manual intervention in terms of network configuration will be necessary...

    Which I suppose isn't the end of the world and probably faster than recreating the static mappings for the update DUID's, and OS installs aren't going to be super common.

    In theory, my prefix is supposed to be static as well.



  • @hiryu said in Static IPv6 address allocation based on MAC:

    In theory, my prefix is supposed to be static as well.

    Mine virtually is. In my experience, the MAC is used with Linux, at least openSUSE, but Windows uses a random number, However, that might be one of the things that can be changed with policies on the domain controller, but I don't know, as I don't work with that sort of thing.

    Regardless, while I haven't tried it on IPv6, pfSense does support static mapping for it, just as it does for IPv4.



  • Yeah, that's the issue... Each OS seems to do its own thing, and then I'm given a different address per OS per machine.

    Interestingly, Ubuntu seems to provide the same DUID/IAID/etc for each interface and I get the same IP for Ethernet as I do for WiFi on my laptop... Which is pretty great and exactly what I want there. I'll have to have different IP's for my laptop in windows, but I'm in linux about 98% (or more) of the time.

    This leaves 3 machines where I'll have to do some manual configuration each time an OS is reinstalled... The rest of the stuff on my network is pretty static as far as changes go. I guess I can live with that.

    I wish there was an option to handle things by mapping IP's directly to MAC addresses like with DHCPv4 as I think this makes sense in some situations, but the above is workable and it is what it is.

    As it stands right now, IPv6 support for my network is beginning to shape up nicely.

    Thanks for the help!


  • LAYER 8 Global Moderator

    I believe the duid for windows would be here

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\TCPIP6\Parameters\Dhcpv6DUID

    You should be able to change it there to match what you want it to be so it gets the same IP as when you boot your other OSes.



  • @hiryu said in Static IPv6 address allocation based on MAC:

    Interestingly, Ubuntu seems to provide the same DUID/IAID/etc for each interface and I get the same IP for Ethernet as I do for WiFi on my laptop... Which is pretty great and exactly what I want there.

    I use openSUSE, but get different addresses for WiFi and Ethernet. However, given that the addresses are MAC based, they'd have to be. However, when connected via Ethernet, the WiFi address is reachable, unlike with Windows.



  • @johnpoz Thanks! This may prove useful!


Log in to reply