On 2020-07-07 17:10, Michael Gmelin wrote:
On Tue, 7 Jul 2020 12:08:35 +0200
Michael Gmelin <free...@grem.de> wrote:
On Mon, 6 Jul 2020 22:58:54 +0200
Niclas Zeising <zeising+free...@daemonic.se> wrote:
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 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
I did some more digging. It only happens when there's also an
ifconfig_IF for IPv4 in the /etc/rc.conf.
Not working configuration (/etc/rc.conf)
ifconfig_vtnet0="192.168.0.1/24"
ifconfig_vtnet0_ipv6="inet6 fe80::1/64"
ifconfig_vtnet0_alias0="inet6 2001:6b8::/64"
This configuration creates an EUI64-based link-local addess on
vtnet0 as well.
Working configuration (apart from no IPv4)
ifconfig_vtnet0_ipv6="inet6 fe80::1/64"
ifconfig_vtnet0_alias0="inet6 2001:6b8::/64""
This works:
ifconfig_vtnet0="inet6 -auto_linklocal"
ifconfig_vtnet0_ipv6="up"
ifconfig_vtnet0_aliases="\
inet 192.168.0.1/24 inet6 fe80::1/64 inet6 2001:6b8::/64"
# ifconfig vtnet0
vtnet0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST>
metric 0 mtu 1500 options=80028<VLAN_MTU,JUMBO_MTU,LINKSTATE>
ether 58:9c:fc:0b:99:97
inet 192.168.0.1 netmask 0xffffff00 broadcast 192.168.0.255
inet6 fe80::1%vtnet0 prefixlen 64 scopeid 0x2
inet6 2001:6b8:: prefixlen 64
media: Ethernet 10Gbase-T <full-duplex>
status: active
nd6 options=1<PERFORMNUD>
-m
This works too:
ifconfig_vtnet0="inet"
ifconfig_vtnet0_ipv6="inet6 -auto_linklocal"
ifconfig_vtnet0_aliases="\
inet 192.168.0.1/24 inet6 fe80::1/64 inet6 2001:6b8::/64"
As well as this:
ifconfig_vtnet0="inet"
ifconfig_vtnet0_ipv6="inet6 -auto_linklocal fe80::1/64"
ifconfig_vtnet0_aliases="inet 192.168.0.1/24 inet6 2001:6b8::/64"
Using `ifconfig_vtnet0="inet 192.168.0.1/24"` adds the auto-generated
link-local address (which is what you seem to try to avoid).
Cheers,
Michael
Thank you for these examples.
I've also found out that
ifconfig_vtnet0=""
following what's in your examples also work.
I wonder if this should either be documented better (the manual for
rc.conf even brings up the vtnet0_alias0="fe80::1/64" as an example) or
if the rc scripts dealing with all this should be changed so that if you
have both ifconfig_vtnet0="inet ..." and ifconfig_vtnet0_ipv6="inet6
..." a link-local address isn't automatically created if one is in rc.conf.
The whole handling of network interfaces in rc is (understandably) quite
hairy, and I don't know where this would belong, or how to fix it.
Maybe it's enough to have ipv6 addresses assigned before ipv4 ones, or
perhaps a separate ifconfig_vtnet0_link_local="inet6 ..." should be added.
I can solve my immediate problems, I'm just thinking out loud about if
this is an issue that needs to be solved in a better way, or just be
better documented.
Also thank you for the examples using ifconfig_vtnet0_aliases=, I was
unaware of that option, and have always done _alias0, _alias1 and so on.
This will make things easier for me.
Regards
--
Niclas
_______________________________________________
freebsd-net@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to "freebsd-net-unsubscr...@freebsd.org"