Specifying link-local address in rc.conf

Niclas Zeising zeising+freebsd at daemonic.se
Mon Jul 6 11:05:46 UTC 2020


Hi!
Is it possible to specify a link-local address in rc.conf, and get only 
that link-local address?

When I add a specific link-local address, such as fe80::1/64, to an 
interface from the command line, and then add a global uincast address, 
it works as expected, I do not get an additional link-local address.
When I try to do the same in rc.conf however, it does not work.
I have added the following:
ifconfig_vtnet0_inet6="inet6 fe80::1/64"
ifconfig_vtnet0_alias0="2001:6b8::1/64"
to rc.conf, but when restarting, I get both fe80::1 and a EUI64-based 
link-local address assigned to the interface.  It does not matter which 
order I specify the entries in rc.conf.
I have tried changing the sysctl net.inet6.ip6.auto_linklocal to 0 in 
/etc/sysctl.conf, but that does not work (it seems it takes effect too 
late, the interface still has the AUTO_LINKLOCAL flag set according to 
ifconfig).
I tried adding -auto_linklocal to the ifconfig_* lines in /etc/rc.conf, 
and while this removes the AUTO_LINKLOCAL flag from the interface, a 
EUI64 based link-local address is still assigned to the interface.

While there might not be much of a problem having mulitple link-local 
addresses, this is surprising.  Adding a specific link-local address to 
an interface, even from rc.conf, shouldn't mean that the EUI64-one is 
created.  Perhaps something like ifconfig_IF_linklocal="" should be 
added, or this is a bug in rc.network.  I tried looking through 
rc.network and related rc files, but I didn't find anything obvious, and 
I couldn't really figure out how addresses are added to interfaces 
during boot.

This is causing issues when I want for instance rtadvd to use the 
fe80::1/64 address as source for router advertisements, since it picks 
the EUI64 link-local address as source (which means this also ends up in 
client routing tables as the default gateway).  I can work around this 
problem by adding fe80::1/64 with prefer_source, but I would prefer if 
there only was one link-local address on an interface.

All of this is on FreeBSD 12.1.

Perhaps I'm just missing something, but this behavior feels a little 
surprising.

I can share more detailed configuration, and perhaps the whole virtual 
machine I'm testing on, if needed.

Regards
-- 
Niclas


More information about the freebsd-net mailing list