Score:0

KVM netplan bridge is not loaded after reboot, but works manually loaded

ky flag
Myk

I have a KVM host running on private network with subnet mask 192.168.62.* The server has 4 ethernet interfaces, 2 of them are connected to the same switch.

I have tried to create a netplan yaml file, which would bond the active interfaces in active-backup mode. After that a bridge should be declared and vritual machines guests are set up to use the bridge.

After reboot the bonding bond0 is created, however bridge br0 is missing. The bond0 gets strange IP, which is not from internal network (169.254.134.221). I am not able to see KVM host nor the VM guests from the internal network: Output of ifconfig after reboot:

bond0: flags=5187<UP,BROADCAST,RUNNING,MASTER,MULTICAST>  mtu 1500
        inet 169.254.134.221  netmask 255.255.0.0  broadcast 169.254.255.255
        ether c6:d4:10:55:da:29  txqueuelen 1000  (Ethernet)
        RX packets 9992  bytes 1419514 (1.4 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 99  bytes 36700 (36.7 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ens10f0: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST>  mtu 1500
        ether c6:d4:10:55:da:29  txqueuelen 1000  (Ethernet)
        RX packets 2843  bytes 232425 (232.4 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device memory 0xce100000-ce1fffff  

ens10f1: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST>  mtu 1500
        ether c6:d4:10:55:da:29  txqueuelen 1000  (Ethernet)
        RX packets 7149  bytes 1187089 (1.1 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 99  bytes 36700 (36.7 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device memory 0xce000000-ce0fffff  

ens10f2: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 68:05:ca:ae:f0:62  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device memory 0xcdf00000-cdffffff  

ens10f3: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 68:05:ca:ae:f0:63  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device memory 0xcde00000-cdefffff  

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 4449  bytes 342390 (342.3 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 4449  bytes 342390 (342.3 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

usb0: flags=-28605<UP,BROADCAST,RUNNING,MULTICAST,DYNAMIC>  mtu 1500
        inet 16.1.15.2  netmask 255.255.255.252  broadcast 16.1.15.3
        inet6 fe80::9077:faff:fe03:9044  prefixlen 64  scopeid 0x20<link>
        ether 92:77:fa:03:90:44  txqueuelen 1000  (Ethernet)
        RX packets 2  bytes 594 (594.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 123  bytes 12694 (12.6 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

virbr0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 192.168.122.1  netmask 255.255.255.0  broadcast 192.168.122.255
        ether 52:54:00:6b:69:17  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

vnet0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 169.254.94.108  netmask 255.255.0.0  broadcast 169.254.255.255
        inet6 fe80::fc54:ff:fe5b:e4c2  prefixlen 64  scopeid 0x20<link>
        ether fe:54:00:5b:e4:c2  txqueuelen 1000  (Ethernet)
        RX packets 30  bytes 6667 (6.6 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 114  bytes 38492 (38.4 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

vnet1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 169.254.85.60  netmask 255.255.0.0  broadcast 169.254.255.255
        inet6 fe80::fc54:ff:fe05:402f  prefixlen 64  scopeid 0x20<link>
        ether fe:54:00:05:40:2f  txqueuelen 1000  (Ethernet)
        RX packets 175  bytes 40412 (40.4 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 114  bytes 38486 (38.4 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

vnet2: flags=-28605<UP,BROADCAST,RUNNING,MULTICAST,DYNAMIC>  mtu 1500
        inet 169.254.182.150  netmask 255.255.0.0  broadcast 169.254.255.255
        inet6 fe80::fc54:ff:feeb:f8c5  prefixlen 64  scopeid 0x20<link>
        ether fe:54:00:eb:f8:c5  txqueuelen 1000  (Ethernet)
        RX packets 153  bytes 38734 (38.7 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 113  bytes 38428 (38.4 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

After "sudo netplan apply" run manually the bridge br0 appers and it gets an IP address from internal network and I am able to rdp the KVM host and also the VM guests running on it.

This is ifconfig output after netplan apply:

bond0: flags=5187<UP,BROADCAST,RUNNING,MASTER,MULTICAST>  mtu 1500
        ether c6:d4:10:55:da:29  txqueuelen 1000  (Ethernet)
        RX packets 16227  bytes 2832614 (2.8 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 4215  bytes 3489876 (3.4 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

br0: flags=-28605<UP,BROADCAST,RUNNING,MULTICAST,DYNAMIC>  mtu 1500
        inet 192.168.62.81  netmask 255.255.255.0  broadcast 192.168.62.255
        inet6 fe80::5870:15ff:fe2b:9ff3  prefixlen 64  scopeid 0x20<link>
        ether 5a:70:15:2b:9f:f3  txqueuelen 1000  (Ethernet)
        RX packets 4322  bytes 798708 (798.7 KB)
        RX errors 0  dropped 228  overruns 0  frame 0
        TX packets 1974  bytes 3268405 (3.2 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ens10f0: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST>  mtu 1500
        ether c6:d4:10:55:da:29  txqueuelen 1000  (Ethernet)
        RX packets 3874  bytes 324402 (324.4 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device memory 0xce100000-ce1fffff  

ens10f1: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST>  mtu 1500
        ether c6:d4:10:55:da:29  txqueuelen 1000  (Ethernet)
        RX packets 12353  bytes 2508212 (2.5 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 4215  bytes 3489876 (3.4 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device memory 0xce000000-ce0fffff  

ens10f2: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 68:05:ca:ae:f0:62  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device memory 0xcdf00000-cdffffff                                                                                
                                                                                                                         
ens10f3: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500                                                                    
        ether 68:05:ca:ae:f0:63  txqueuelen 1000  (Ethernet)                                                             
        RX packets 0  bytes 0 (0.0 B)                                                                                    
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device memory 0xcde00000-cdefffff  

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 5107  bytes 400930 (400.9 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 5107  bytes 400930 (400.9 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

usb0: flags=-28605<UP,BROADCAST,RUNNING,MULTICAST,DYNAMIC>  mtu 1500
        inet 16.1.15.2  netmask 255.255.255.252  broadcast 16.1.15.3
        inet6 fe80::9077:faff:fe03:9044  prefixlen 64  scopeid 0x20<link>
        ether 92:77:fa:03:90:44  txqueuelen 1000  (Ethernet)
        RX packets 2  bytes 594 (594.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 173  bytes 15800 (15.8 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

virbr0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 192.168.122.1  netmask 255.255.255.0  broadcast 192.168.122.255
        ether 52:54:00:6b:69:17  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

vnet0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 169.254.94.108  netmask 255.255.0.0  broadcast 169.254.255.255
        inet6 fe80::fc54:ff:fe5b:e4c2  prefixlen 64  scopeid 0x20<link>
        ether fe:54:00:5b:e4:c2  txqueuelen 1000  (Ethernet)
        RX packets 45  bytes 8440 (8.4 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2315  bytes 418129 (418.1 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

vnet1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 169.254.85.60  netmask 255.255.0.0  broadcast 169.254.255.255
        inet6 fe80::fc54:ff:fe05:402f  prefixlen 64  scopeid 0x20<link>
        ether fe:54:00:05:40:2f  txqueuelen 1000  (Ethernet)
        RX packets 616  bytes 119612 (119.6 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2732  bytes 825570 (825.5 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

vnet2: flags=-28605<UP,BROADCAST,RUNNING,MULTICAST,DYNAMIC>  mtu 1500
        inet 169.254.182.150  netmask 255.255.0.0  broadcast 169.254.255.255
        inet6 fe80::fc54:ff:feeb:f8c5  prefixlen 64  scopeid 0x20<link>
        ether fe:54:00:eb:f8:c5  txqueuelen 1000  (Ethernet)
        RX packets 322  bytes 57349 (57.3 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2420  bytes 428955 (428.9 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

My netplan yaml file:

# This is the network config written by 'subiquity'
network:
  version: 2
  ethernets:
    ens10f0:
      dhcp4: false
      dhcp6: false
      optional: true
    ens10f1:
      dhcp4: false
      dhcp6: false
      optional: true
    ens10f2:
      dhcp4: false
      optional: true
    ens10f3:
      dhcp4: false
      optional: true
  bonds:
    bond0:
      dhcp4: false
      dhcp6: false
      interfaces: [ens10f0,ens10f1]
      parameters:
        mode: active-backup
  bridges:
    br0:
      interfaces: [bond0]
#      addresses: [192.168.62.14/32]
      dhcp4: true
      dhcp6: false
      routes:
      - to: default
        via: 192.168.62.1
        metric: 100
        on-link: true
      nameservers:
        addresses: [192.168.62.11]
      parameters:
        stp: true
        forward-delay: 4

Any idea why the netplan is not loaded correctly after reboot but it works by manual apply?

Why there are virbr0, vnet1, vnet2 and vnet4 created even they are not defined in yaml file and why they get IPs outside of the internal network?

I have tried a workarround which works only if dhcp is allowed on the bridge. Workaround solution works:

Adding

@reboot /sbin/netplan apply

to crontab reloads netplan after reboot and it invokes the bridge if dhcp is allowed on the bridge. If static address is specified on the bridge, the bridge gets the IP, but bonding gets its own IP which is not from internal network and the network is not working.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.