How does setting IPv6-Suffix (hex) works?

I am trying to set a static suffix for my device but it is not working properly. Setting 192.168.1.10 also gives it a static ::10 ipv6 address and I want to set a static random IPv6 address chosen by me, I tried be51:07fa:f822:38d7 but suffix only gets be51, then I tried be5107faf82238d7 and that still does not work. Is it limited to first 4 characters? I want to define my own complete suffix for a device, it is possible to set?

Sure it is, but I've seen limited success myself with it.

E.g. in /etc/config/dhcp:

config host
	option name 'mnemosyne'
	option mac 'xxxx:xx:xx:xx:xx'
	option duid '00010001f98caa01274d4356eff08'
	option hostid '25'

This would assign to the client with DUID 00010001f98caa01274d4356eff08 a 25 suffix. I have it working with a few clients, but on others it's not even showing a DUID in the DHCP server's logs or lease files, so it's a bit hit an miss.

The DUID is important to link the suffix you like afaik.

  1. Suffix only works for clients doing stateful DHCPv6, it has no effect on systems not doing DHCP but SLAAC only, e.g. Android
  2. The hostid suffix value is limited to 32bit, so the maximum possible value is ffffffff

That's because scanning the number stops at the first non-digit, so only be51 gets used in this case.

That value is too large to fit into a 32bit integer. be5107fa or f82238d7 would work.

5 Likes

Is there any reason why it is limited to 32bit and not use 64bit integer.

I found this while searching for a solution, looks like the solution would be to use a 64 bit variable and not a 32 bit one. Hopefully it will be implemented soon.

Because that's how it's defined in the RFCs:

https://tools.ietf.org/html/rfc7227#section-5.3

Also (unless I misunderstood), you are aware that if you assigned a 64-bit "suffix"...the proper term wouldn't be "suffix", correct?

1 Like

Prefix would be assigned by ISP I am talking about the last 64 bits set by me for my Raspberry, which would be suffix.

That depends on the length they issued to you.

This is called a "Static IP Address". You set that on the host (i.e. the Raspberry).

(Yes, there's certainly an RFC about that too.)