Several VLANs on single virtual LAN in KVM

achekalin

Member
Jun 17, 2011
74
0
6
Hello,

I wonder if it is possible to create some vmbr, attach it to KVM-based VM, and, inside this VM, to use it as eth0.1, eth0.8, so I can see VLAN ID in its name?

See, I use several VLANs in my VM but each of it attached to separate vmbr and from inside VM I see it as separate eth's. Due to number of VLANs I use it result in too much mess, and I'd like to make the picture more clear.

Thank you in advance for any advice!
 
Hello,

Yes. This is possible. I do it on my setup.

Take a look at /etc/interfaces

and modify it to suit!

Rob
 
See this extract

Code:
auto vmbr0
iface vmbr0 inet static
        address  192.168.21.100
        netmask  255.255.255.0
        gateway  192.168.21.1
        bridge_ports eth0
        bridge_stp off
        bridge_fd 0

auto vmbr1
iface vmbr1 inet manual
        bridge_ports eth0.10
        bridge_stp off
        bridge_fd 0

auto vmbr10
iface vmbr10 inet manual
        bridge_ports eth0.19
        bridge_stp off
        bridge_fd 0
 
Oh, good news. As far I used to live with such a setup:

/etc/network/interfaces:

Code:
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
        address  0.0.0.0
        netmask  0.0.0.0

auto eth0.1
iface eth0.1 inet static
        address  0.0.0.0
        netmask  0.0.0.0

auto eth0.5
iface eth0.5 inet static
        address  0.0.0.0
        netmask  0.0.0.0

auto vmbr1
iface vmbr1 inet static
        address  a.b.c.d
        netmask  255.255.255.0
        gateway  a.b.c.1
        bridge_ports eth0.1
        bridge_stp off
        bridge_fd 0

auto vmbr5
iface vmbr5 inet manual
        bridge_ports eth0.5
        bridge_stp off
        bridge_fd 0

etc

so I attach vmbr's to VMs as I need that (I numbered it so vmbr5 = VLAN 5, etc.)

But I'd like to somehow attach only one vmbr to VM, and so I'll set up inside DV something like eth0, eth0.1 etc.
 
Last edited:
I'm afraid that's what I do now. I need to have only one eth0 inside VM and have subinterfaces of it (like eth0.1, eth0.5 etc).

This way I'll know which VLAN is assigned to each subinterface.

As of now, I have a bunch of eth0, eth1, eth2 etc. (represents vmbrs attached to VM) and I have to keep in mind that eth15 is in fact VLAN3 from outside (there is no direct assignment vmbr1 -> eth1). This is pretty messy and leads to mistakes, takes time to understand etc.
 
Oh... I see what you mean now!

It would be good if these could 'match up'.

Unfortuantly the interface actually seems to not like it if the interfaces do not follow a naming convention of VMBRXXX


This means you end up with a weird mapping.

I keep a spreadsheet with all of this in it!

Rob
 
Unfortunately I can not afford myself to test it now, but maybe there is a way to attach whole external eth0 to vmbr (with whatever VLANs in it)? Maybe then I'll see these VLAN's inside VM?

I've tried that long ago, at 1.8, so maybe it is possible to setup that now at 1.9 or 2?
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!