Score:1

Centos 8 stream, KVM & multiple vlans

id flag

For my local environment i'm trying to add multiple vlans to my KVM server. I want to use one nic for management and the other for vlan tagging.

Initial installation was made by following https://www.cyberciti.biz/faq/how-to-install-kvm-on-centos-8-headless-server/

Afterwards I tried to add new vlan by this guide https://fardog.io/blog/2020/11/08/centos-and-kvm-single-interface-multiple-vlans-for-guests/

Have tried several nmcli commands to connect cards to correct vlan, no matter what it seems that vlan are not accessible on my server.

Using macvtap is possible and works for the most, I also need to have access between virtual maskines and that seems to not work on macvtap.

Anyone that has configured KVM with multiple vlans on centos 8 that can help me?

Michael Hampton avatar
cz flag
Exactly how did you configure your virtual networks?
id flag
I used eno2 instead of eno1 when configuring them, first I tried exactly as the on in the first link, but changed to my local IP.
id flag
I used eno2 instead of eno1 when configuring them, first I tried exactly as in the first link, but changed to my local IP. Made a br0 config file, and changed eno2 to be using br0 as bridge So I got the br0 up and running, and could ping my br0 interface, but not my br0.20 that I made for vlan 20. Then I removed all of the configuration that was made manually, and then tried as the second link to see if it worked as it was described but nothing better luck there. The last test was with nmcli commands, similarly made the same as the first step. Ended up with eno2.xx config files only
djdomi avatar
za flag
@thborge83 update your question instead of repeating your self.
Score:0
kr flag

Frankly, I'm not a fan of NM, especially since the regular RHEL config files do the job (at least in this particular case) quite well.

The idea is as follows:

[NIC] -> [VLAN X] -> [bridgeX] -> [VM]
 L-----> [VLAN Y] -> [bridgeY] -> [VM]

In RHEL/CentOS/etc this would look as follows:

The base NIC eth0 (can also be a bond) /etc/sysconfig/network-scripts/ifcfg-eth0:

TYPE=Ethernet
BOOTPROTO=none
NAME=eth0
DEVICE=eth0
ONBOOT=yes
NM_CONTROLLED=no

The VLAN tagged interface: /etc/sysconfig/network-scripts/ifcfg-eth0.100

DEVICE=eth0.100
BOOTPROTO=none
ONBOOT=yes
VLAN=yes  #this is the VLAN setting really
BRIDGE=br100 #the bridge we will attach on top of this tagged interface

You can repeat this one for any VLAN tag just changing the tag number.

The bridge setup for each VLAN: /etc/sysconfig/network-scripts/ifcfg-br100

DEVICE=br100
TYPE=Bridge
DELAY=0 #important if you intend to live migrate VMs between multiple hosts
STP=off
ONBOOT=yes
IPADDR=1.2.3.4 #IP in the VLAN 100
NETMASK=x.x.x.x
GATEWAY=x.x.x.x
BOOTPROTO=none
MTU=1500
NM_CONTROLLED=no
DNS1=x.x.x.x

Now any VM that uses the br100 bridge will have all it's traffic tagged with tag 100.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.