We need bridge (brX) interface(s) for linux kvm virtualization.
EXAMPLE FOR 3 VLAN-S
VLAN-s must be defined on Cisco switch
VLAN 10 – IT vlan
VLAN 20 – DMZ vlan
VLAN 30 – guest vlan
Define vlan without ip (L2 switch):
switch# conf t switch(config)# vlan 10 switch(config-vlan)# name vlan-it switch(config-vlan)# end switch# write
Define vlan with ip address (L3 switch):
switch# conf t switch(config)# interface vlan 10 switch(config-if)# ip adress 192.168.10.1 255.255.255.0 switch(config-if)# description vlan-it switch(config-if)# end switch# write
INTERFACE CONFIGURATION ON CISCO SWITCH
Connection to network interface eth0 on linux server for vlan 10 and vlan 30 (trunk connection):
interface GigabitEthernet1/0/30 description == kvm server IT switchport trunk encapsulation dot1q switchport trunk allowed vlan 10,30 switchport mode trunk
Connection to network interface eth1 on linux server for vlan 20 (trunk connection):
interface GigabitEthernet1/0/31 description == kvm server DMZ switchport trunk encapsulation dot1q switchport trunk allowed vlan 20 switchport mode trunk
NETWORK CONFIGURATION ON LINUX SERVER (Debian)
linux-server:~# cat /etc/network/interfaces # The loopback network interface auto lo iface lo inet loopback # VLAN 10 (IT vlan) auto eth0.10 iface eth0.10 inet manual up ifconfig eth0.10 up # KVM bridge , VLAN 10, via eth0 (management interface) auto br10 iface br10 inet static address xx.xy.xz.10 netmask xx.xy.xz.0 network xx.xy.xz.0 broadcast xx.xy.xz.255 gateway xx.xy.xz.1 dns-nameservers 8.8.8.8 4.4.4.4 dns-search local.domain.com bridge_ports eth0.10 bridge_maxwait 5 bridge_fd 1 bridge_stp on # VLAN 20 (DMZ vlan) auto eth1.20 iface eth1.20 inet manual up ifconfig eth1.20 up # KVM bridge, VLAN 20, via eth1 auto br20 iface br20 inet manual bridge_ports eth1.20 bridge_maxwait 5 bridge_fd 1 bridge_stp on # VLAN 30 (guest vlan) auto eth0.30 iface eth0.30 inet manual up ifconfig eth0.30 up # KVM bridge, VLAN 30, via eth0 auto br30 iface br30 inet manual bridge_ports eth0.30 bridge_maxwait 5 bridge_fd 1 bridge_stp on