ipv6 duplicate address prevents interface configuration

Bug #2000325 reported by Ryan Harper
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
systemd (Ubuntu)
New
Undecided
Unassigned
Focal
New
Undecided
Unassigned

Bug Description

1) # lsb_release -rd
Description: Ubuntu 20.04.5 LTS
Release: 20.04

2) # apt-cache policy systemd
systemd:
  Installed: 245.4-4ubuntu3.19
  Candidate: 245.4-4ubuntu3.19
  Version table:
 *** 245.4-4ubuntu3.19 500
        500 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages
        100 /var/lib/dpkg/status
     245.4-4ubuntu3.15 500
        500 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages
     245.4-4ubuntu3 500
        500 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages

3) Interface should be configured with all addresses and routes
4) Interface is missing ipv4 and ipv6 static addresses and associated routes

ProblemType: Bug
DistroRelease: Ubuntu 20.04
Package: systemd 245.4-4ubuntu3.19
ProcVersionSignature: Ubuntu 5.4.0-135.152-generic 5.4.212
Uname: Linux 5.4.0-135-generic x86_64
ApportVersion: 2.20.11-0ubuntu27.25
Architecture: amd64
CasperMD5CheckResult: skip
Date: Thu Dec 22 16:13:11 2022
Lsusb: Error: command ['lsusb'] failed with exit code 1:
Lsusb-t:

Lsusb-v: Error: command ['lsusb', '-v'] failed with exit code 1:
MachineType: QEMU Standard PC (i440FX + PIIX, 1996)
ProcEnviron:
 TERM=vt220
 PATH=(custom, no user)
 LANG=C.UTF-8
 SHELL=/bin/bash
ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-5.4.0-135-generic root=LABEL=cloudimg-rootfs ro console=tty1 console=ttyS0
SourcePackage: systemd
UpgradeStatus: No upgrade log present (probably fresh install)
dmi.bios.date: 04/01/2014
dmi.bios.vendor: SeaBIOS
dmi.bios.version: 1.13.0-1ubuntu1.1
dmi.chassis.type: 1
dmi.chassis.vendor: QEMU
dmi.chassis.version: http://192.168.14.1:4444/register.html
dmi.modalias: dmi:bvnSeaBIOS:bvr1.13.0-1ubuntu1.1:bd04/01/2014:svnQEMU:pnStandardPC(i440FX+PIIX,1996):pvrpc-i440fx-focal:cvnQEMU:ct1:cvrhttp//192.168.14.14444/register.html:
dmi.product.family: cisco
dmi.product.name: Standard PC (i440FX + PIIX, 1996)
dmi.product.version: pc-i440fx-focal
dmi.sys.vendor: QEMU

Revision history for this message
Ryan Harper (raharper) wrote :
Revision history for this message
Ryan Harper (raharper) wrote :

To reproduce what happens on physical systems I create two VMs with nics in the same bridge on the host. Booting the first VM up and allowing the network config to apply, and then when booting the second VM up layer, as it applies the IPv6 address to the interface in the bridge, the kernel detects a duplicate IPv6 address and networkd fails to configure the interface.

This happens on Focal systemd-networkd, but works fine on Jammy; that is the network configuration is applied (including the duplicate V6) but critically the v4 address and routes are as well.

Revision history for this message
Ryan Harper (raharper) wrote :
Download full text (4.3 KiB)

# Create a bridge and add two ports

$ sudo ip link add name atx-fabric0 type bridge
$ sudo ip link set up dev atx-fabric0
$ sudo ip tuntap add atx-fabric0i1p1 user $USER group $USER
$ sudo ip tuntap add atx-fabric0i2p1 user $USER group $USER

# create two focal VM images from focal daily server
$ qemu-img create -f qcow2 -b focal-server-cloudimg-amd64.img focal-net1.img 100G
$ qemu-img create -f qcow2 -b focal-server-cloudimg-amd64.img focal-net2.img 100G

# create cloud-init seed

$ cat >user-data <<EOF
#cloud-config
password: passw0rd
chpasswd: { expire: False }
ssh_pwauth: True
ssh_import_id: lp:raharper
EOF
$ echo "i-abcdefg" > meta-data
$ cloud-localds seed.img user-data meta-data

# Launch VM1 (need sudo for bridge access)

BOOT=focal-net1.img
SEED=seed.img
sudo qemu-system-x86_64 -smp 2 -m 2048 --enable-kvm \
  -global pc35.no_floppy=1 \
  -name "${1}" \
  -drive id=disk0,if=none,format=qcow2,file=${BOOT} \
  -device virtio-blk-pci,drive=disk0,bootindex=0 \
  -drive id=cdrom0,if=none,media=cdrom,file=$SEED \
  -device virtio-blk-pci,drive=cdrom0,bootindex=1 \
  -netdev user,id=net0,hostfwd=tcp::22222-:22 \
  -device e1000,bootindex=2,netdev=net0,mac=52:54:00:a2:34:c0 \
  -netdev tap,id=net1,ifname=atx-fabric0i1p1 \
  -device virtio-net,bootindex=4,netdev=net1,mac=b8:38:61:bc:60:f5 \
  -nographic \
  -object rng-random,filename=/dev/urandom,id=rng0 \
  -device virtio-rng-pci,rng=rng0 \
  -serial mon:stdio

# Login and replace netplan config
cat > 50-cloud-init-vm1.yaml << EOF
network:
  version: 2
  ethernets:
    ens5:
      match:
        macaddress: "52:54:00:a2:34:c0"
      accept-ra: false
      dhcp4: true
      dhcp6: false
      mtu: 1500
    eth2-1:
      optional: true
      match:
        macaddress: b8:38:61:bc:60:f5
      set-name: eth2-1
      accept-ra: false
      dhcp4: false
      dhcp6: false
      mtu: 1500
      addresses:
      - 6.1.6.1/24
      - 2006:1:6::1/116
      routes:
      - from: 6.1.6.1
        scope: link
        to: 6.1.6.254
      - from: 2006:1:6::1
        scope: link
        to: 2006:1:6::254
      - to: default
        via: 2006:1:6::254
        metric: 32
      - to: default
        via: 6.1.6.254
        metric: 32
    eth2-2:
      match:
        macaddress: b8:38:61:bc:60:f6
      set-name: eth2-2
      accept-ra: false
      dhcp4: false
      dhcp6: false
      mtu: 1500
EOF
scp -P 22222 50-cloud-init-vm1.yaml ubuntu@localhost:
ssh -P 22222 'sudo cp /home/ubuntu/50-cloud-init-vm1.yaml /etc/netplan/50-cloud-init.yaml'
ssh -P 22222 'sudo netplan apply'

# Launch VM2 (need sudo for bridge access)

BOOT=focal-net2.img
SEED=seed.img
sudo qemu-system-x86_64 -smp 2 -m 1024 --enable-kvm \
  -global pc35.no_floppy=1 \
  -name "${1}" \
  -drive id=disk0,if=none,format=qcow2,file=${BOOT} \
  -device virtio-blk-pci,drive=disk0,bootindex=0 \
  -drive id=cdrom0,if=none,media=cdrom,file=$SEED \
  -device virtio-blk-pci,drive=cdrom0,bootindex=1 \
  -netdev user,id=net0,hostfwd=tcp::22223-:22 \
  -device e1000,bootindex=2,netdev=net0,mac=52:54:00:ef:88:a2 \
  -netdev tap,id=net1,ifname=atx-fabric0i2p1 \
  -device virtio-net,bootindex=4,netdev=net1,mac=b8:38:61:bc:60:f6 \
  -nographic \
  -object rng-rando...

Read more...

Revision history for this message
Ryan Harper (raharper) wrote :
Revision history for this message
Ryan Harper (raharper) wrote :
Revision history for this message
Ryan Harper (raharper) wrote :
Download full text (3.1 KiB)

There are two scenarios: Applying to VM the first time, on subsequent boots.

On first boot without the updated netplan config, when you first add it

root@ubuntu:/home/ubuntu# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth2-2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether b8:38:61:bc:60:f6 brd ff:ff:ff:ff:ff:ff
3: ens5: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 52:54:00:ef:88:a2 brd ff:ff:ff:ff:ff:ff
    inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic ens5
       valid_lft 86177sec preferred_lft 86177sec
    inet6 fe80::5054:ff:feef:88a2/64 scope link
       valid_lft forever preferred_lft forever

After a reboot initially the addresses are assigned.
root@ubuntu:/home/ubuntu# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth2-2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether b8:38:61:bc:60:f6 brd ff:ff:ff:ff:ff:ff
    inet 6.1.6.1/24 brd 6.1.6.255 scope global eth2-2
       valid_lft forever preferred_lft forever
    inet6 2006:1:6::1/116 scope global dadfailed tentative
       valid_lft forever preferred_lft forever
    inet6 fe80::ba38:61ff:febc:60f6/64 scope link
       valid_lft forever preferred_lft forever
3: ens5: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 52:54:00:ef:88:a2 brd ff:ff:ff:ff:ff:ff
    inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic ens5
       valid_lft 85262sec preferred_lft 85262sec
    inet6 fe80::5054:ff:feef:88a2/64 scope link
       valid_lft forever preferred_lft forever

However, if the addresses are cleared from the interface, networkd cannot
reapply the config and leaves the interface unconfigured

root@ubuntu:/home/ubuntu# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth2-2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether b8:38:61:bc:60:f6 brd ff:ff:ff:ff:ff:ff
3: ens5: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 52:54:00:ef:88:a2 brd ff:ff:ff:ff:ff:ff
    inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic ens5
       valid_lft 86177sec preferred_lft 86177sec
    inet6 fe80::5054:ff:feef:88a2/64 scope link
       valid_lft forever prefe...

Read more...

Revision history for this message
Ryan Harper (raharper) wrote :

root@ubuntu:/home/ubuntu# networkctl status eth2-2 --no-pager
● 2: eth2-2
             Link File: /run/systemd/network/10-netplan-eth2-2.link
          Network File: /run/systemd/network/10-netplan-eth2-2.network
                  Type: ether
                 State: carrier (failed)
                  Path: pci-0000:00:06.0
                Driver: virtio_net
                Vendor: Red Hat, Inc.
                 Model: Virtio network device
            HW Address: b8:38:61:bc:60:f6 (Cisco Systems, Inc)
                   MTU: 1500 (min: 68, max: 65535)
  Queue Length (Tx/Rx): 1/1
      Auto negotiation: no
                 Speed: n/a
     Activation Policy: up
   Required For Online: yes

Dec 22 16:53:58 ubuntu systemd-networkd[552]: eth2-2: Configuring route: dst: 6.1.6.254/32, src: n/a, gw: n/a, prefsrc: 6.1.6.1, scope: link, table: main, proto: static, type: unicast
Dec 22 16:53:58 ubuntu systemd-networkd[552]: eth2-2: Configuring route: dst: n/a, src: n/a, gw: 6.1.6.254, prefsrc: n/a, scope: global, table: main, proto: static, type: unicast
Dec 22 16:53:58 ubuntu systemd-networkd[552]: eth2-2: Configuring route: dst: n/a, src: n/a, gw: 2006:1:6::254, prefsrc: n/a, scope: global, table: main, proto: static, type: unicast
Dec 22 16:53:58 ubuntu systemd-networkd[552]: eth2-2: Setting routes
Dec 22 16:53:58 ubuntu systemd-networkd[552]: eth2-2: State changed: pending -> configuring
Dec 22 16:53:58 ubuntu systemd-networkd[552]: eth2-2: Forgetting route: dst: 2006:1:6::/116, src: n/a, gw: n/a, prefsrc: n/a, scope: global, table: main, proto: kernel, type: unicast
Dec 22 16:53:58 ubuntu systemd-networkd[552]: eth2-2: Setting address genmode done.
Dec 22 16:53:58 ubuntu systemd-networkd[552]: eth2-2: Could not set route: Invalid source address. Invalid argument
Dec 22 16:53:58 ubuntu systemd-networkd[552]: eth2-2: Failed
Dec 22 16:53:58 ubuntu systemd-networkd[552]: eth2-2: State changed: configuring -> failed

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.