Hello, here is part two of forwarding VLANs to KVM guest.
First part was t forward VLANs via trunk interface using bridges:
Now I will show you how to bond two interfaces using Dynamic Link Agregation and to make it all work with VLANs and bridges. It will give us better network performance and fault tolerant connection.
So let’s start 🙂 Here is drawing that shows how it all should work. I’m connecting serwer with SPS2024 Linksys switch:
First we have to customize kernel modules. To make it we have to create a file /etc/modprobe.d/bond0.conf
alias bond0 bonding
options bond0 mode=4 miimon=100
I’m using mode 4 which is IEEE 802.3ad Dynamic link aggregation. It works well with my switch so I didn’t try other modes. If you want to try the here is description:
Ok so now we have to configure our eth1 and eth2 interfaces to work together as one bond0 interface.
Create ifcfg-eth1 and ifcfg-eth2 ifcfg-bond0 files:
Now we have two interafes bond as one, so we can add VLAN tagging to bond0. You have to make sure that 802.1Q modeule is loaded. This is most easily done with modprobe. So the command:
To forward VLAN to KVM guests we have to create interfaces that are using untagged frames from specific VLANs and add them to bridge interfaces.
We will create interface from VLAN 4 and forward it to bridge4. It can be done by creating files:
And to finish everything restart the network service and now using virt-manager you can connect your guest to VLAN4 by adding br4 network interface.