0

When I try to add a bridge, it become in UP state without a fe80:: IPv6 address:

$ ip link add br0 type bridge
$ ip link set br0 up
$ ip address show br0
40: br0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether c2:c3:09:08:da:5b brd ff:ff:ff:ff:ff:ff

But when I try to do the same, but inside a network namespace the fe80:: address is assigned normally:

$ ip netns add nsx
$ ip netns exec nsx ip link add br0 type bridge
$ ip netns exec nsx ip link set br0 up
$ ip netns exec nsx ip address show br0
2: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default qlen 1000
    link/ether aa:45:d1:77:37:b3 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::a845:d1ff:fe77:37b3/64 scope link 
       valid_lft forever preferred_lft forever

I also tested in a virtual machine and it has the same problem.

How can I make the newly created interfaces (bridge or tap) to have a fe80:: address when bringing them up?

PS: I'm using NetworkManager, both in host and the virtual machine and my kernel flag net.ipv6.conf.all.autoconf is 1.

10
  • 2
    40: br0: <NO-CARRIER> ... state DOWN serverfault.com/a/1075277/149509
    – gapsf
    Sep 25, 2022 at 4:00
  • superuser.com/questions/1594751/…
    – gapsf
    Sep 25, 2022 at 4:02
  • 1
    Starting a (5.19) Linux system in single user mode and init=/bin/bash makes the host's behavior as usual (ie: UNKNOWN until attached to or the MAC address fixed). So it's something done in host's configuration that makes the host behavior to change. Anyway the behavior with DOWN is a sane behavior.
    – A.B
    Sep 25, 2022 at 15:13
  • 1
    @phantomcraft and I tested with 5.9.11 booted with init=/bin/bash (ie single user without even systemd) and using immediately ip link add ... type bridge: gets UNKNOWN. Booted normally: DOWN. Not so sure.
    – A.B
    Sep 27, 2022 at 6:13
  • 1
    @phantomcraft behavior difference can be explained in this Q/A: unix.stackexchange.com/questions/719379/… that's not because of newer kernels, but of newer systemd (-udev).
    – A.B
    Oct 1, 2022 at 12:01

1 Answer 1

2

If ip reports state DOWN for any interface (you can see a NO-CARRIER among the flags), the kernel won't assign a link-local IPv6 address, because the interface hasn't been completely activated. You are going to notice this behavior with any interface that doesn't have a peer connected (a bridge can essentially be considered as a local interface to the host it is created on, and if no ports are attached, that can be taken as a missing connection).

Now, if you are attaching a cable to a physical interface and turn the remote side on or attach a port to a bridge, that essentially means that you are establishing an active link (ip is goin to report state UP). In this moment the kernel automatically assigns a link-local address to the interface.

If you need to force an IP address even on an interface that is down, you can first assign a value of 1 to net.ipv6.conf.<interface>.addr_gen_mode, then reset it to 0. This forces the kernel to assign an IPv6 link-local address to it without having to plug anything in (please note the tentative flag set for this link-local address, though, as there haven't been any DAD checks so far so it cannot be used).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.