IPv6 suffix for static lease

I have figured out how to create static leases on the LuCI “DHCP and DNS” page but only so far as to provide IPv4 addresses. Given an IPv6 capable device on my LAN how do I figure out what to specify for the “IPv6 Suffix”?

I suppose you have an public IPv6 prefix from your ISP. The IPv6 prefix is assigned to you by your ISP in case the ISP offers IPv6 connectivity option. Prefix is common for all your IPv6 devices.
You may choose and set only a second part of IPv6 address - the suffix. The provider assigns the /64 prefix for home user usually, i.e. 64-bit long part of address. It means that you or your router or DHCP server must assigns 128 - 64 = 64 bit long suffix. (Other example: prefix is 56 bit, suffix can be 128-56=72 bit. But such big network is usually split into 2^8 = 256 IPv6 networks of normal size having /64 suffix. You will select one ore more of this networks for your purposes.) It is completely up to you what is suffix value. You must pay attention to two conditions only. Suffix is unique and 64 bit long. Some methods of dynamic assignment can generate suffix values as a function of MAC addresses.

In case you have no public IPv6 prefix, you can play with IPv6 protocol using site-local (and link-local) IPv6 addresses. But your lab is limited by borders of your LAN and you cannot communicate with other IPv6 devices outside. Addresses are local only.

@netbat That mostly makes sense to me.

My goal is to assign static addresses in such a way that I can interpret them from memory. For instance, I have a mapping for rooms of the house and a mapping for device types. I reserve the 1rd in the final IPv4 octet to such addresses (e.g. if 2 is the master bedroom and 4 is a Nest thermostat then 192.168.1.124 is the Nest in the MBR)

I would like to follow a similar scheme for IPv6 addresses. How can I locate a safe range of address suffices that will not collide with addresses handed out by DHCPv6? Assuming I would like to use a similar mapping scheme in the IPv6 space how would I enter a appropriate suffix on the LuCI page?

I think, this is a question for @Ondrej_Caletka, the biggest IPv6 boss on this forum.

The situation with IPv6 is little bit complicated. There are two different adressing scenarios – SLAAC, which is the most widely supported one and DHCPv6. TurrisOS by default support both and so do most client devices (exception is Android which support only the former). Only DHCPv6 addresses can be controlled in a similar way to IPv4 addresses, by registering the DUID (DHCP unique identifier) and respective suffix. For SLAAC, you cannot assign any particular suffix as such is chosen by the device. General idea is that you should do numbering in the prefix part and leave the suffix for the automatic configuration. So if you have for instance 2001:db8:1234:5600::/56 prefix assigned to your router, you can divide the network into few separate networks like 2001:db8:1234:5610::/60, 2001:db8:1234:5620::/60, etc. and place your computer there. If your devices support DHCPv6, you can make them use some crafted suffix, to have a nice and memorable addresses.

Hello,

DHCPv6 here.

I tried to set IPv6 suffix in Luci (option hostid on /etc/dhcp), but it does not work without DUID. After manual setup in dhcp config:

option duid 'xxx'
option hostid 'yyy'

then it seems to work.

So you must add entry manualy to /etc/dhcp (because luci doesnt have row for DUID), but it works pretty good after that. Luci is good to viewing, but once again proved, that changes better be done manually :slight_smile: