frequent network collapse possibly due to bridging

Charles Polisher chas at
Sat Jan 29 06:47:24 UTC 2022

On 1/24/22 17:29, Hakan E. Duran wrote
> Then due to its inactive status, I thought it would be a good idea to
> start it with:
> $sudo virsh net-start default
> Network default started
> Of note, even though the default network was marked as inactive as
> above, it was working. In other words, I was able to reach the VMs,
> which are part of that network, even before the `virsh net-start
> default` command. Nothing seemed to break with the command either, and
> everyting still seemed to work afterwards.
> $sudo virsh net-info default
> Name:           default
> UUID:           some-number
> Active:         yes
> Persistent:     yes
> Autostart:      yes
> Bridge:         virbr0
> I would really appreciate if you can confirm that this is the desired
> state for my network for the purposes I discussed previously. I
> apologize if I am oversimplifying things here, it is because of my lack
> of in-depth understanding the appropriate set up.

Seeing as there are no other replies yet, for what it's worth,
on my hypervisor I see similar results for a working system,
and to my knowledge it's all running correctly:

     # virsh net-info default
     Name:           default
     UUID:           32ecb497-5a0b-46fd-9786-df4a6ceec9ce
     Active:         yes
     Persistent:     yes
     Autostart:      yes
     Bridge:         virbr0

Also, this from my library of scripts:

# ---- cut here ----
# Yury V. Zaytsev <yury at> (C) 2011
# cf.;a=blob;f=manifests/files/common/network-restart
# This work is herewith placed in public domain.
# Use this script to cleanly restart the default libvirt network after its
# definition have been changed (e.g. added new static MAC+IP mappings) 
in order
# for the changes to take effect. Restarting the network alone, however, 
# the guests to lose connectivity with the host until their network 
# are re-attached.
# The script re-attaches the interfaces by obtaining the information 
about them
# from the current libvirt definitions. It has the following dependencies:
#   - virsh (obviously)
#   - tail / head / grep / awk / cut
#   - XML::XPath (e.g. perl-XML-XPath package)
# Note that it assumes that the guests have exactly 1 NAC each attached 
to the
# given network! Extensions to account for more (or none) interfaces 
etc. are,
# of course, most welcome.

set -e
set -u


virsh net-define /opt/config/libvirt/network-$NETWORK_NAME.xml
virsh net-destroy $NETWORK_NAME
virsh net-start $NETWORK_NAME

MACHINES=$( virsh list | tail -n +3 | head -n -1 | awk '{ print $2; }' )

for m in $MACHINES ; do

     MACHINE_INFO=$( virsh dumpxml "$m" | xpath 
/domain/devices/interface[1] 2> /dev/null )
     MACHINE_MAC=$( echo "$MACHINE_INFO" | grep "mac address" | cut -d 
'"' -f 2 )
     MACHINE_MOD=$( echo "$MACHINE_INFO" | grep "model type" | cut -d 
'"' -f 2 )

     set +e
     virsh detach-interface "$m" network --mac "$MACHINE_MAC" && sleep 3
     virsh attach-interface "$m" network $NETWORK_NAME --mac 
     set -e

     $NETWORK_HOOK "$m" stopped && sleep 3
     $NETWORK_HOOK "$m" start

# ---- cut here ----

More information about the libvirt-users mailing list