KVM trunk to switch

Issues related to configuring your network
Post Reply
atux_null
Posts: 8
Joined: 2017/11/23 11:16:46

KVM trunk to switch

Post by atux_null » 2020/04/10 11:02:34

i have a server with one NIC that i run KVM and it works fine. I have a managed switch that it has vlans and i would like to add it as trunk to the centos KVM server. So each guest machine will have its own vlan. Iam stuck with the configuration of the KVM. how do i assign the trunk and the vlan to each guest, please?

User avatar
jlehtone
Posts: 2774
Joined: 2007/12/11 08:17:33
Location: Finland

Re: KVM trunk to switch

Post by jlehtone » 2020/04/10 21:08:52

There are multiple ways to do that.

You have switch and host. One cable between them. The switch sends traffic of multiple LANs to that cable. Traffic is tagged, so the host can separate the LANs. Trunk is on the cable.

What to do at the host?

If you had SR_IOV support on the NIC, then you could create VFs and assign them to guests. You could do the filtering/tagging in the VF so that the guest receives untagged traffic of one LAN.

You could have a software bridge on the host and attach all the guests to the bridge. Every guest would receive all the tagged traffic. The guest could handle all the VLANs that it is interested in.

You could have a software bridge on the host with vlan filtering per "port" of the bridge. A guest receives untagged traffic of one LAN.

You could create vlan interface on the host for each VLAN. Then create one bridge for each VLAN and attach vlan interface to the bridge. A bridge receives untagged traffic of one LAN. Attach guest to that bridge.

atux_null
Posts: 8
Joined: 2017/11/23 11:16:46

Re: KVM trunk to switch

Post by atux_null » 2020/04/11 16:18:16

hi. thanks for the reply. that's the idea i am looking for, but i am stuck with the config of the Linux host
-to see the trunk to the switch
-assign VLAN to guest machine from the KVM config

User avatar
jlehtone
Posts: 2774
Joined: 2007/12/11 08:17:33
Location: Finland

Re: KVM trunk to switch

Post by jlehtone » 2020/04/11 18:57:53

atux_null wrote:
2020/04/11 16:18:16
-to see the trunk to the switch
What is there to see? Stuff comes from the wire. Every packet hopefully has some vlan tag. The host needs vlan interfaces only if it needs to be a member of some LANs.

I did list four approaches for the guests. At least two of them have nothing about vlans in the KVM config.

Post Reply

Return to “CentOS 8 - Networking Support”