On 22/01/28 10:47PM, Charles Polisher wrote:> ...
> 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:
Thank you so much for confirming this!>
> # ---- cut here ----
> #!/bin/bash
> #
> # Yury V. Zaytsev <yury at shurup.com> (C) 2011
> # cf.
http://git.zaytsev.net/?p=anubis-puppet.git;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,
> causes
> # the guests to lose connectivity with the host until their network
> interfaces
> # 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.
> #
> # ZYV
> #
>
> set -e
> set -u
>
> NETWORK_NAME=default
> NETWORK_HOOK=/etc/libvirt/hooks/qemu
>
> 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
"$MACHINE_MAC"
> --model "$MACHINE_MOD"
> ??? set -e
>
> ??? $NETWORK_HOOK "$m" stopped && sleep 3
> ??? $NETWORK_HOOK "$m" start
>
> done
> # ---- cut here ----
>
Thank you so much for sharing your script as well! This is so helpful.
I had my LAN crash yesterday again and I did a few experiments. I tested pinging
the hosts within the LAN from one of my VMs and this wasn't possible (host
unreachable). So, just to clarify, pinging any host within the LAN as well as
outside the LAN was not possible from the VM. The hypervisor WAS able to ping
the VM though and I was able to ssh into the VM from the hypervisor. Hypervisor
could not ping any other computer in the LAN either (same host unreachable
error). Name resolution within the LAN was confirmed to be intact while pinging
both by hostname and IP. Just to test it, I destroyed the libvirt network and
restarted it, however, I didn't use several commands used by this script
such as virsh detach/attach-interface and $NETWORK_HOOK, so looking back, it was
an incomplete attempt. This did not solve the problem. My LAN architecture
starts with cable modem that is connected via ethernet cable to my router, which
is connected to my 24-port switch with the same. All computers that were pinged
and could not be reached are connected to the switch via ethernet cables, just
like the hypervisor itself. Wireless access point is also connected to the
switch via ethernet cable, and the internet access was lost on wireless network
as well. I use one of my VMs in this hypervisor as the primary DNS server for my
lan through pi-hole and unbound. I believe the loss of internet is attributable
to the loss of bridge network on this VM. Internal network between the
hypervisor and the VM seems to have been preserved somehow (see above). The
cable modem seemed OK and connected by interpretation of its lights during the
crash. Rebooting the hypervisor solved the problem and LAN was again restored
without needing to do anything else. I am stumped. For now, I changed my primary
DNS server from the VM to a physical raspberry pi as a first step. Pi used to
be the secondary DNS server, now it is primary. The VM, on the other hand, is
now the secondary DNS server. I am hoping that, if the libvirt network crashes
again(?) I shouldn't lose the whole LAN perhaps by this change. I am not
sure what may be the root cause of this problem. virsh net-info default during
the crash gave the same output as if nothing was wrong with it. Thank you for
your time, I truly appreciate it knowing that it may not be possible to identify
what actually is wrong/failing.
Hakan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL:
<http://listman.redhat.com/archives/libvirt-users/attachments/20220129/8a9eb08e/attachment.sig>