Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Jul 2020 22:58:54 +0200
From:      Niclas Zeising <zeising+freebsd@daemonic.se>
To:        net@FreeBSD.org
Subject:   Re: Specifying link-local address in rc.conf
Message-ID:  <a6a05909-a11d-42c9-2e62-9fc50b38c9f3@daemonic.se>
In-Reply-To: <713e1f3e-4dd9-8dcf-c6d2-15c684bdce5b@daemonic.se>
References:  <713e1f3e-4dd9-8dcf-c6d2-15c684bdce5b@daemonic.se>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2020-07-06 13:05, Niclas Zeising wrote:
> Hi!
> Is it possible to specify a link-local address in rc.conf, and get only=
=20
> that link-local address?
>=20
> When I add a specific link-local address, such as fe80::1/64, to an=20
> interface from the command line, and then add a global uincast address,=
=20
> 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=3D"inet6 fe80::1/64"
> ifconfig_vtnet0_alias0=3D"2001:6b8::1/64"
> to rc.conf, but when restarting, I get both fe80::1 and a EUI64-based=20
> link-local address assigned to the interface.=C2=A0 It does not matter =
which=20
> order I specify the entries in rc.conf.
> I have tried changing the sysctl net.inet6.ip6.auto_linklocal to 0 in=20
> /etc/sysctl.conf, but that does not work (it seems it takes effect too=20
> late, the interface still has the AUTO_LINKLOCAL flag set according to=20
> ifconfig).
> I tried adding -auto_linklocal to the ifconfig_* lines in /etc/rc.conf,=
=20
> and while this removes the AUTO_LINKLOCAL flag from the interface, a=20
> EUI64 based link-local address is still assigned to the interface.
>=20
> While there might not be much of a problem having mulitple link-local=20
> addresses, this is surprising.=C2=A0 Adding a specific link-local addre=
ss to=20
> an interface, even from rc.conf, shouldn't mean that the EUI64-one is=20
> created.=C2=A0 Perhaps something like ifconfig_IF_linklocal=3D"" should=
 be=20
> added, or this is a bug in rc.network.=C2=A0 I tried looking through=20
> rc.network and related rc files, but I didn't find anything obvious, an=
d=20
> I couldn't really figure out how addresses are added to interfaces=20
> during boot.
>=20
> This is causing issues when I want for instance rtadvd to use the=20
> fe80::1/64 address as source for router advertisements, since it picks=20
> the EUI64 link-local address as source (which means this also ends up i=
n=20
> client routing tables as the default gateway).=C2=A0 I can work around =
this=20
> problem by adding fe80::1/64 with prefer_source, but I would prefer if=20
> there only was one link-local address on an interface.
>=20
> All of this is on FreeBSD 12.1.
>=20
> Perhaps I'm just missing something, but this behavior feels a little=20
> surprising.
>=20
> I can share more detailed configuration, and perhaps the whole virtual=20
> machine I'm testing on, if needed.
>=20
> Regards

I did some more digging.  It only happens when there's also an=20
ifconfig_IF for IPv4 in the /etc/rc.conf.

Not working configuration (/etc/rc.conf)
ifconfig_vtnet0=3D"192.168.0.1/24"
ifconfig_vtnet0_ipv6=3D"inet6 fe80::1/64"
ifconfig_vtnet0_alias0=3D"inet6 2001:6b8::/64"

This configuration creates an EUI64-based link-local addess on vtnet0 as=20
well.

Working configuration (apart from no IPv4)
ifconfig_vtnet0_ipv6=3D"inet6 fe80::1/64"
ifconfig_vtnet0_alias0=3D"inet6 2001:6b8::/64"

Regards
--=20
Niclas



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?a6a05909-a11d-42c9-2e62-9fc50b38c9f3>