VLAN trunk to VM

E

eg1l

Guest
Hi.

I have tried searching, but could not find anything useful (or get it to work).
I'm trying to forward a full vlan trunk to a VM, and let the VM itself do the vlan tagging.

My current network setup:

switch(allowed vlan 1,2,3, etc) -> proxmox hypervisor (vmbr0) -> VM

As I understand, a bridge (vmbr0) acts as a dumb switch, so this drops all vlan tagged traffic.
What should I do to make this work, if even possible?
 
If your proxmox node is in a "Trunk mode" switch port you should be able to tag the VLANs within the Network Adaptors.

VM > Hardware > VLAN Tag

In my setup I have:

Proxmox Node into a Trunk Port.. its PVID is 10 here and my node sits on my 10.10.1.*/24 subnet.

I have tagged on this port VLAN 100, and any other VLANs i require... In my KVM Virtual Machine I have set my VLAN Tag to 100 and this VM picks an IP up on my VLAN 100 subnet.

Hope this helps?

If you are still having difficulties could you explain a little more?

E.
 
If you are using OpenVZ container you will have to search around these forums as I believe its been discussed before but is a little different to set up...
 
You can also check ifconfig and see what interfaces you have.. you will see in my config here I have some VLANed interfaces that are assigned to VMs.

root@proxnode1:~# ifconfig
eth0 Link encap:Ethernet HWaddr 00:26:9e:b5:e1:f0
inet6 addr: fe80::226:9eff:feb5:e1f0/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3824275042 errors:0 dropped:0 overruns:0 frame:0
TX packets:2354747594 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:4913902848464 (4.4 TiB) TX bytes:589531379944 (549.0 GiB)


eth0.100 Link encap:Ethernet HWaddr 00:26:9e:b5:e1:f0
inet6 addr: fe80::226:9eff:feb5:e1f0/64 Scope:Link
UP BROADCAST RUNNING PROMISC MULTICAST MTU:1500 Metric:1
RX packets:102261867 errors:0 dropped:0 overruns:0 frame:0
TX packets:191968852 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:31323999321 (29.1 GiB) TX bytes:41789408415 (38.9 GiB)


eth0.1100 Link encap:Ethernet HWaddr 00:26:9e:b5:e1:f0
inet6 addr: fe80::226:9eff:feb5:e1f0/64 Scope:Link
UP BROADCAST RUNNING PROMISC MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:7526 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:496788 (485.1 KiB)


lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:353599 errors:0 dropped:0 overruns:0 frame:0
TX packets:353599 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1707689822 (1.5 GiB) TX bytes:1707689822 (1.5 GiB)


vmbr0 Link encap:Ethernet HWaddr 00:26:9e:b5:e1:f0
inet addr:10.10.1.51 Bcast:10.10.1.255 Mask:255.255.255.0
inet6 addr: fe80::226:9eff:feb5:e1f0/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3719838866 errors:0 dropped:0 overruns:0 frame:0
TX packets:1968332007 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:4828573145976 (4.3 TiB) TX bytes:534759683578 (498.0 GiB)


vmbr0v100 Link encap:Ethernet HWaddr 00:26:9e:b5:e1:f0
inet6 addr: fe80::3cbc:8fff:fedc:bb93/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:6246155 errors:0 dropped:0 overruns:0 frame:0
TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:413301492 (394.1 MiB) TX bytes:640 (640.0 B)


vmbr0v1100 Link encap:Ethernet HWaddr 00:26:9e:b5:e1:f0
inet6 addr: fe80::f825:a0ff:fef4:5a4e/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:9 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:726 (726.0 B)


root@proxnode1:~#


Hope this helps?
 
Extcee, you are only forwaring one VLAN to your VM right?

I have noe issues tagging the VLAN on the proxmox node, that works quite well.
However, that is not my goal. What I want, is to be able to change VLAN tagging on the VM, on the fly.

The use case here would be a VM that is used as a router, and routing between multiple VLANs.

My switch port does have a native vlan 1, and allowed VLANs 2,3 etc.
The setup looks like this:

switch(native VLAN1, allowed VLAN 2,3 etc) -> (proxmox node) vmbr0 (VLAN1) -> VM

Tagging VLAN2 on proxmox node will give the VM an ip address on VLAN2.
No tagging on proxmox node (only bridging VM to vmbr0), and tagging VLAN2 on VM does not work.
 
Extcee, you are only forwaring one VLAN to your VM right?

I have noe issues tagging the VLAN on the proxmox node, that works quite well.
However, that is not my goal. What I want, is to be able to change VLAN tagging on the VM, on the fly.

The use case here would be a VM that is used as a router, and routing between multiple VLANs.

My switch port does have a native vlan 1, and allowed VLANs 2,3 etc.
The setup looks like this:

switch(native VLAN1, allowed VLAN 2,3 etc) -> (proxmox node) vmbr0 (VLAN1) -> VM

Tagging VLAN2 on proxmox node will give the VM an ip address on VLAN2.
No tagging on proxmox node (only bridging VM to vmbr0), and tagging VLAN2 on VM does not work.

I run my router in this fashion. VLAN1 (native) is bridged to VMBR1, modem is connected to my switch on untagged VLAN2, all my other VLANs pass through a pair of interfaces and I tag them through the router, with trunks on the switch
 
Can you guys post your /etc/network/interfaces on both proxmox node and VM?
 
auto lo
iface lo inet loopback
iface enxc025e92e5610 inet manual
iface enp2s0 inet manual
auto bond0
iface bond0 inet manual
slaves enxc025e92e5610
bond_miimon 100
bond_mode balance-rr
auto bond1
iface bond1 inet manual
slaves enp2s0
bond_miimon 100
bond_mode balance-rr
auto bond0.251
iface bond0.251 inet manual
vlan_raw_device bond0
auto vmbr0
iface vmbr0 inet static
address 10.25.4.71
netmask 255.255.255.0
gateway 10.25.4.1
bridge_ports bond0
bridge_stp off
bridge_fd 0
auto vmbr1
iface vmbr1 inet static
address 172.16.5.71
netmask 255.255.255.0
bridge_ports bond1
bridge_stp off
bridge_fd 0
auto vmbr251
iface vmbr251 inet manual
bridge_ports bond0.251
bridge_stp off
bridge_fd 0
bridge_vlan_aware yes
 

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!