Van: Tom Pusateri <[email protected]> Datum: maandag, 29 september 2025 23:32 Aan: "[email protected]" <[email protected]> Onderwerp: IPv6 accept_rtadv for default route and prefix but force host portion of /64 address?
Is there a way to change the configuration in /etc/rc.conf to get the prefix from the router advertisement but fix the host portion to something like ::123 so that I can change network cards in the server and never have to worry about the IPv6 address changing? I have a DMZ interface on a FreeBSD router with a prefix delegation from my provider I assign to a downstream interface. I have another FreeBSD server on the DMZ network and would like it to have a fixed address allocated out of the assigned prefix from the router. The router (also FreeBSD) is running rtadvd providing SLAAC and router advertisements. The /etc/rc.conf for the DMZ server currently looks like this: ifconfig_igb0_ipv6="inet6 2605:1:2:3::123/64 accept_rtadv” This works fine and manually assigns the address out of the assigned prefix range as configured on the router. It also assigns a second IPv6 address via SLAAC that I don’t use. ifconfig output looks like this: igb0: flags=1008843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST,LOWER_UP> metric 0 mtu 1500 options=4e527bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,TSO4,TSO6,LRO,WOL_MAGIC,VLAN_HWFILTER,VLAN_HWTSO,RXCSUM_IPV6,TXCSUM_IPV6,HWSTATS,MEXTPG> ether ac:1f:6b:1a:04:c0 inet 1.2.3.123 netmask 0xfffffff8 broadcast 1.2.3.127 inet6 fe80::ae1f:6bff:fe1a:4c0%igb0 prefixlen 64 scopeid 0x1 inet6 2605:1:2:3::123 prefixlen 64 inet6 2605:1:2:3:ae1f:6bff:fe1a:4c0 prefixlen 64 autoconf pltime 604800 vltime 2592000 media: Ethernet autoselect (1000baseT <full-duplex>) status: active nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL> I get the correct upstream next hop for a default route: % netstat -nra6 Routing tables Internet6: Destination Gateway Flags Netif Expire ::/96 link#3 URS lo0 default fe80::207:43ff:fe31:7078%igb0 UG igb0 The problem with this is that the IPv6 prefix is configured on the router and configured on the server. Thanks, Tom
Hi, I think DHCPv6 could help you here. In IPv6 the address via DHCP is not connected to the MAC address directly, but to a DUID, which is something similar to the hostuuid. AFAIK it should be stable between hardware changes. The details might be important, read something like this https://metebalci.com/blog/a-note-on-dhcpv6-duid-and-prefix-delegation/. I think in my dhcpv6-client I can hardcode the DUID also if needed. Another option could be a new feature in 16-CURRENT: ifconfig stableaddr which could help in getting a stable address, although I don't know if that is also stable if you change the network card. The author of the feature might be able to explain more about that. See https://cgit.freebsd.org/src/commit/?id=31ec8b6407fdd5a87d70265762457c67ce618283. Regards, Ronald.
