On 12/8/23 10:48 AM, Marc Haber wrote:
[very detailed description of a network setup, the important point
being that there is a bridge created outside of libvirt]
I can attach a VM to that vlan in virt-manager by selecting the
virtual
NIC, network source: bridge device, device name: int188. This works and
results in the following XML snippet:
<interface type="bridge">
<mac address="52:54:00:af:fd:f8"/>
<source bridge="int188"/>
<model type="virtio"/>
<address type="pci" domain="0x0000" bus="0x01"
slot="0x00" function="0x0"/>
</interface>
[more details]
So far so good, this is useable. However, I need to document a list of
available interfaces since the interface name "int188" needs to be
entered in a text area in virt-manager.
The dialog in virt-manager also has a list box that is pre-filled with
"Virtual Network 'default'", "Bridge Device..." and
"Macvtap device...",
and the text area for the bridge device name shows up once "Bridge
device" is selected.
Can I configure somewhere (may it be in libvirt, may it be in
virt-manager) a list of network interfaces, so that this list box has
like "Bridge Device int181", "Bridge Device int188" etc in addition
to
the three entries that are already present, to give my users a hint
about which interfaces might be available?
So you have a host bridge created outside libvirt that you want to be
listed in the potential connections in virt-manager (rather than needing
to type the name of the bridge).
You can do that by creating a libvirt virtual network with <forward
mode='bridge'/> - this type of virtual network expects that the bridge
device will have already been created and attached to the world by
someone other than libvirt:
https://libvirt.org/formatnetwork.html#using-an-existing-host-bridge
Create a temporary file (call it /tmp/xyz.xml for example) with the text
of that example, but replace "br0" with "int188", and
"host-bridge" with
whatever name you want to use (it could be "int188", or it could be,
e.g. "engineering-support" or something equally descriptive). define and
start this network with:
virsh net-define /tmp/xyz.xml
virsh net-start engineering-support
virsh net-autostart engineering-support
Now "engineering-support" should show up as a potential connection in
virt-manager's list of virtual networks.
If you look at the domain XML, you'll find that
<interface type='bridge'>
<source bridge='int188'/>
...
has been replaced with
<interface type='network'>
<source network='engineering-support'/>
...
but the result will be the same - the guest's tap interface will be
connected to the bridge int188.