Vlans
From Proxmox VE
Introduction
This is a basic Howto on setting up VLANs using ProxMox VE. This documentation assumes that you have already setup your VLANs before hand.
Network Interfaces Setup
It's actually quite easy to setup VLAN support.
- Note: It is probably best to have a console connection or be prepared to change your switch interface after making the changes and restarting the PVE interface.
First step after setting up the VLANS you want on your switch is to edit your /etc/network/interfaces file. It will probably look similar to the one below depending on how many interfaces you have:
# network interface settings auto lo iface lo inet loopback iface eth0 inet manual iface eth1 inet manual auto vmbr0 iface vmbr0 inet static address 192.168.0.2 netmask 255.255.255.0 gateway 192.168.0.1 bridge_ports eth0 bridge_stp off bridge_fd 0 auto vmbr1 iface vmbr1 inet static address 10.10.10.2 netmask 255.255.255.0 bridge_ports eth1 bridge_stp off bridge_fd 0
The first step we need to do is to create the bonded interfaces for each of the vlans. In this example I am adding Vlans 5 and 9.
auto bond0
iface bond0 inet manual
slaves eth0 eth1
bond_miimon 100
bond_mode 4
auto bond0.5
iface bond0.5 inet manual
vlan-raw-device bond0
auto bond0.9
iface bond0.9 inet manual
vlan-raw-device bond0
The next step is to edit your bridge_ports interfaces to match the vlans you are using for management.
auto vmbr0 iface vmbr0 inet static address 192.168.0.2 netmask 255.255.255.0 gateway 192.168.0.1 bridge_ports bond0.5 bridge_stp off bridge_fd 0 auto vmbr1 iface vmbr1 inet static address 10.10.10.2 netmask 255.255.255.0 bridge_ports bond0.9 bridge_stp off bridge_fd 0
So now, your interfaces file should look similar to this (Be sure that you have indented properly):
# network interface settings
auto lo
iface lo inet loopback
iface eth0 inet manual
iface eth1 inet manual
auto bond0
iface bond0 inet manual
slaves eth0 eth1
bond_miimon 100
bond_mode 4
auto bond0.5
iface bond0.5 inet manual
vlan-raw-device bond0
auto bond0.9
iface bond0.9 inet manual
vlan-raw-device bond0
auto vmbr0
iface vmbr0 inet static
address 192.168.0.2
netmask 255.255.255.0
gateway 192.168.0.1
bridge_ports bond0.5
bridge_stp off
bridge_fd 0
auto vmbr1
iface vmbr1 inet static
address 10.10.10.2
netmask 255.255.255.0
bridge_ports bond0.5
bridge_stp off
bridge_fd 0
You should be able to rename your vmbr devices so that they reflect your vlan.
You can now restart your interface. You will want to now make sure that your switch port that is plugged into the PVE machine is trunked using dot1q encapsulation.
/etc/init.d/networking restart
Ignoring all the warnings but verify everything is correct using:
ifconfig
Reboot your PVE and login to the web interface. You should see your interfaces listed. To add a VM to a specific vlan simply add the proper vmbrX as a network interface and enjoy.
