Debian: Should I add vlan interface into bridge for KVM?

Posted by javano on Server Fault See other posts from Server Fault or by javano
Published on 2012-08-30T17:01:23Z Indexed on 2012/08/31 9:40 UTC
Read the original article Hit count: 357

Filed under:
|
|
|

I am setting up a Debian Squeeze box as a KVM host. I want to add multiple interfaces to each KVM guest so I want them to be on different VLANs.

After reading about this, I believe the best method is to add multiple logical VLAN (sub)-interfaces to the physical NICs and then create a bridge adapter for each VLAN interace, and assign each bridge as a NIC for KVM guests. Does this make good sense, or madness?

Do I have to use bridged interfaces with KVM like this? Can't I just add eth1.xx and eth1.yy to my interfaces config below and then configure those directly as bridged KVM guest NICs? If so, how should this look in the interfaces config file below?

user@host:~$ cat /etc/network/interfaces 
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# Management Interface
auto eth0
iface eth0 inet static
address 172.22.0.31
netmask 255.255.255.0
gateway 172.22.0.1

# Interface for guest VMs
auto eth1

# Guest1 : Use VLAN 117
auto eth1.117
iface eth1.117 inet manual
# Set up br1 for guest 1, bridging with vlan 117
auto br1.117
iface br1.117 inet manual
bridge_ports eth1.117
bridge_stp off

user@host:~$ uname -a
Linux hostname 3.4.9 #1 SMP Wed Aug 22 19:08:46 BST 2012 x86_64 GNU/Linux

UPDATE

I would really like it if someone could clarify the config for me, as I have also seen the above configured with this syntax, so I don't see why one would be preferred over the other;

# Interface for guest VMs
auto eth1
allow-hotplug eth1
iface eth1 inet static

# Vlan 117 for guest 1
auto vlan 117
iface vlan111 inet static
vlan_raw_device eth1

# Guest 1 : NIC 1
auto br1.117
iface br1.117 inet manual
bridge_ports vlan117
bridge_stp off

© Server Fault or respective owner

Related posts about debian

Related posts about kvm-virtualization