2025-03-12 Custom IPv6 addresses with Prefix Delegation on NetBSD

From Wikistix

I'd always wondered how I could get a "short" IPv6 address, like, say Google's DNS service (2001:4860:4860::8888) for my machine, which gets a prefix delegated by my ISP over PPPoE. Google's DNS address has 64 bits worth of zeros implied by the :: - how can I do that? It also means that my IPv6 address doesn't change when I change my hardware. I had been using ancient wide-dhcpv6 from pkgsrc, which didn't seem to allow what I wanted - explicitly setting the suffix.

Switching to the builtin dhcpcd, I found this was remarkably easy - my dhcpcd.conf currently contains:

ipv6only
nohook resolv.conf, hostname, ntp.conf
allowinterfaces pppoe0
interface pppoe0
  ia_pd 0 rge0/0/0/1
  persistent
ipv6only
we only care about ipv6
nohook
I don't want dhcpcd mucking with resolv.conf, the hostname, or ntp.conf.
allowinterfaces
probably unnecessary, but I only care about the pppoe0 interface
interface
options tied to pppoe0
ia_pd
Request a DHCPv6 Delegated Prefix for iaid "0", add an address to interface "rge0", with an sla_id of "0", a prefix length of "0", and a suffix of "1".
persistent
Don't remove the addresses on reconfiguration.

With all that, my IPv6 is now 2001:44b8:3158:7e00::1.