[pve-devel] new idea for vlan (with example)
Alexandre DERUMIER
aderumier at odiso.com
Thu Mar 15 08:42:37 CET 2012
Hi Dietmar,
I have think yesterday about an easy implementation which doesn't break current network config and pve-manager.
I think this can work with kvm and openvz.
Simply, keep our current network configuration with bridge without vlans defined.
example :vmbr0,vmbr1
/etc/network/interface (define bridges without vlans)
------------------------------------------------------
without bonding
---------------
auto eth0
iface eth0 inet manual
auto eth1
iface eth1 inet manual
auto vmbr0
iface vmbr0 inet manual
bridge_ports eth0
bridge_stp off
bridge_fd 0
auto vmbr1
iface vmbr1 inet manual
bridge_ports eth1
bridge_stp off
bridge_fd 0
with bonding
------------
auto eth0
iface eth0 inet manual
auto eth1
iface eth1 inet manual
auto eth2
iface eth1 inet manual
auto eth3
iface eth1 inet manual
auto bond0
iface bond0 inet manual
slaves eth0 eth1
bond_miimon 100
bond_mode active-backup
pre-up ifup eth0 eth1
post-down ifdown eth0 eth1
auto bond1
iface bond1 inet manual
slaves eth2 eth3
bond_miimon 100
bond_mode active-backup
pre-up ifup eth2 eth3
post-down ifdown eth2 eth3
auto vmbr0
iface vmbr0 inet manual
bridge_ports bond0
bridge_stp off
bridge_fd 0
auto vmbr1
iface vmbr1 inet manual
bridge_ports bond1
bridge_stp off
bridge_fd 0
then in guest network config, add an optionnal vlan option
vm network config
-----------------
bridge=vmbr0
bridge=vmbr0,vlan=2
bridge=vmbr0,vlan=3
bridge=vmbr1,vlan=3
bridge=vmbr1,vlan=5
then
dynamic bridge and vlan creation
--------------------------------
/var/lib/qemu-server/pve-bridge
if(!$vlan){
system ("/usr/sbin/brctl addif $bridge $iface") == 0 ||
die "can't add interface to bridge\n";
}
else {
$interface=find_interface_in_brige($bridge)
add_bridge($bridge.'v'.$vlan);
if($interface = bond) {
create_bond($bond.'v'.$vlan)
interfaces=find_interfaces_in_bond($interface)
foreach interface{
add_vlan_to_interface ("vconfig add interface $vlan" #(eth0->eth0.X ,eth0-> eth1.x ))
add_interface_to $bond.'v'.$vlan
}
brctl addif $bridge.'v'.$vlan $bond.'v'.$vlan
}
else {
add_vlan_to_interface ("vconfig add interface $vlan")
brctl addif $bridge.'v'.$vlan $bond
}
"/usr/sbin/brctl addif $bridge.'v'.$vlan $iface " #finaly add tap to bridge
}
without bonding
---------------
eth0 --- vmbr0 --- tap
eth1 --- vmbr1 --- tap
eth0.2 ---- vmbr0v2 --- tap
eth0.3 ---- vmbr0v3 --- tap
eth1.3 ---- vmbr1v3 --- tap
eth1.5 ---- vmbr1v5 --- tap
bonding
-------
eth0--
|--bond0----vmbr0----tap
eth1--
eth2--
|--bond1----vmbr0----tap
eth3--
eth0.2--
|--bond0v2----vmbr0v2----tap
eth1.2--
eth0.3--
|--bond0v3----vmbr0v3----tap
eth1.3--
eth2.3--
|--bond1v3----vmbr1v3----tap
eth3.3--
eth2.5--
|--bond1v5----vmbr1v5----tap
eth3.5--
What do you think about it ?
More information about the pve-devel
mailing list