Restarting bridge with running VM's

klowet

Active Member
Jun 22, 2018
43
1
28
Hi

When restarting a bridge via ifdown and ifup, the VM's on it don't come back online. Because ifup doesn't know which links were active on the bridge, I guess?

What is the best method to make changes to a bridge and don't impact the running guests?
Here is my current network config - a part of. Any tips on this?

Code:
iface enp179s0f0 inet manual
    bond-master bond0
    bond-primary enp179s0f0
#Member interface bond0

iface enp179s0f1 inet manual
    bond-master bond0
    bond-primary enp179s0f0
#Member interface bond0

auto bond0
iface bond0 inet manual
    bond-mode active-backup
    bond-slaves enp179s0f0 enp179s0f1
    bond-miimon 100
#TRUNK uplink bonding

auto vmbr1
iface vmbr1 inet manual
    bridge_ports bond0.100
    bridge_stp off
    bridge_fd 0


Thanks
 
Because ifup doesn't know which links were active on the bridge, I guess?
The problem is the tab dev (guest nic endpoint) will not connect to the new vmbr and the old is gone.
You can add it manually with the brctl command.
On the GUI you can do this with changing the bridge in the vnic configuration.
 
How can I manually add all the tab devices together? With +40 VM's it is not that fast to do it one by one.
 
Should you maybe suggest to make the switch to Open vSwitch?
I didn't used OVS yet, so for me it is still a unknown world. Does OVS has the same bridge problem like the traditional Linux components?
 
Should you maybe suggest to make the switch to Open vSwitch?
No.

Does OVS has the same bridge problem like the traditional Linux components?
This is not related to the bridge type.

A normal setup looks like this.

LAN <-> HOST NIC <-> VMBR <-> tab dev <-> vnic of the guest

The problem if you restart the network the VMBR will be destroyed and a new one with the same name will create.
But this is not the same one and the tab dev still try to use the old one, what does not exist anymore.

This is the reason why the if you change the IP in the GUI you have to reboot the node.

see man brctl

How can I manually add all the tab devices together? With +40 VM's it is not that fast to do it one by one.

You do not change the Ip every day?
 
Okay thanks, that makes it clear.

You do not change the Ip every day?
No. But now I had this problem when adding a bridge port for a extra vlan bond0.101.
 
No. But now I had this problem when adding a bridge port for a extra vlan bond0.101.
If you do not need this VLAN in the guest you can do this on the other layer like bond or direct on the nic.
 
what I did to resolve this was basically switch the interface to another bridge temporarily (from vmbr1 to vmbr0) and then change it back to vmbr1 again:

Bash:
#!/bin/bash

[ "$IFACE" == "vmbr1" ] || exit 0

while read vmid _ status _; do
  [[ "$status" == "running" ]] &&
  while read net conf; do
    tempconf=`echo $conf | sed s/vmbr1/vmbr0/`
    sudo qm set $vmid --${net:0:-1} ${tempconf}",link_down=1"
    sudo qm set $vmid --${net:0:-1} ${conf}
  done <<< $(sudo qm config $vmid | grep "^net" | grep -v "link_down=1")
done <<< $(sudo qm list | tail -n +2)

Save this file in /etc/network/if-up.d/vm_net_restart and make it executable, so that every time your network stack gets restarted, your VM network is reattached to the bridges automatically.

Note 1: the code does nothing for vmbr0 itself and needs a fix if you really care about that bridge too.
Note 2: If you want to call it manually, do not put in the if-up.d folder, and remove the line
Code:
[ "$IFACE" == "vmbr1" ] || exit 0
 
Last edited:

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!