Well I finally got my VLANs up and running, in the process I had to put some linux skills to use, as I had to delve into Proxmox and learn a little bit about Bridging and Bonding. This is a topic I am not too familiar with although I have had a lecture on an older linux guru who designed the lab for our room. He used a pentium 3 machine with only a couple (if not only one) interface to do the routing for our lab. He did this with a variety of BSD likely using Bridging and Bonding, maybe VLANs, and maybe something like iptables?
Anyway I have this functional now, and I followed this to get it done:
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.
No comments:
Post a Comment