# =============== Топология ========================= # # В нашем конкретном случае (этот файл): gateway+DNS = 192.168.0.40 (192.168.0.0/16 или 24) # # LAN <-----> eth0 <-----| |---------------------> br0 <---> 192.168.0.80 (host) + vnets (VMs = 192.168.1.0/24 = Zone1 ) # LAN <-----> eth1 <-----|-----> bond0 <----|------> bond0.101 <--> br0-101 <---> 192.168.0.81 (host) + vnets (VMs = 192.168.2.0/24 = Zone2 ) # |------> bond0.102 <--> br0-102 <---> 192.168.0.82 (host) + vnets (VMs = 192.168.3.0/24 = Zone3 ) # # Вариант №2 # # LAN <-----> eth0 <-----| |---------------------> br0 <---> 192.168.0.80 (host) # LAN <-----> eth1 <-----|-----> bond0 <----|------> bond0.101 <--> br0-101 <---> vnets (VMs = 192.168.1.0/24 = Zone1 ) # |------> bond0.102 <--> br0-102 <---> vnets (VMs = 192.168.2.0/24 = Zone2 ) # |------> bond0.103 <--> br0-103 <---> vnets (VMs = 192.168.3.0/24 = Zone3 ) # # Мне кажется, что (с точки зрения производительности) 1й вариант лучше.... # # В общем случаем этот файл можно использовать для топологии: # #[LAN]<--->[eth0] <---> | | |<---------------->[host-OS] #.... ...... |[bond0]|<------------> [br0] |<---> [vnet0]<---> [VM0] #[LAN]<--->[ethX] <---> | | |<---> [vnetX]<---> [VMx] # | # | |<---------------->[host-OS] # |<->[vLAN0] <-> [br0-1]|<---> [vnetX]<---> [VMX] # | |<---> [vnetX]<---> [VMx] # ..... # | |<---------------->[host-OS] # |<->[vLANX] <-> [br0-X]|<---> [vnetX]<---> [VMX] # | |<---> [vnetX]<---> [VMx] # # #===================================================== # BONDING+VLANS+BRIDGES: Ubuntu 10.04 and newer #File: /etc/network/interfaces #Дополнительно чистаем: #http://www.itassist.net.ua/e-book/aghrieghirovaniie-bonding-portov-na-ubuntu-linux-1004 #http://www.howtoforge.com/network_bonding_ubuntu_6.10 #http://www.debianadmin.com/linux-ethernet-bonding-configuration.html #http://www.linuxhorizon.ro/bonding.html #РЕКОМЕНДУЮ !!!! >> http://floatingatoll.posterous.com/ganeti-and-ubuntu-1004-lucid-configuring-brid-brid #===================================================== # This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # See also: # [1] https://help.ubuntu.com/community/UbuntuBonding # [2] http://www.linux-foundation.org/en/Net:Bonding # [3] http://www.linux-foundation.org/en/Net:Bridge # [4] vlan-interfaces(5) # [5] https://bugs.launchpad.net/ubuntu/+bug/559090 # [6] https://bugs.launchpad.net/ubuntu/+bug/482419 # Notes: # - "inet manual", "post-up"/"pre-down" are required for interfaces with no IP. # - Bridge interface names MUST NOT contain ".", use "-" instead. # - Don't assign an IP to a bonded interface if it's bound to a bridged interface. # - If you don't have an untagged VLAN, remove "br0" below. # - You'll probably want at least one interface configured for dhcp or a static IP. # - "bond-slaves none" is mandatory. # - There are uncorrected errors in /usr/share/doc/ifenslave2.6/README.Debian. # - You can specify bonding modes by name instead of by number. [2] # Packages required: # - ifenslave2.6 # - vlan # - bridge-utils ####### INTERFACE LOOPBACK ####### auto lo iface lo inet loopback ####### BONDING FOR eth0 & eth1 ###################################################################$ # Configure the primary bonding interface that will be used for NIC1/NIC2 pairing. auto bond0 # The IP will be assigned to the associated bridging interface. iface bond0 inet manual # Force the interface to up/down automatically without an IP. post-up ifconfig $IFACE up pre-down ifconfig $IFACE down # This option must always be 'none'; use "bond-master" on each interface. bond-slaves none # Common modes are active-backup and 802.3ad [1] # or mode "rr-mode" => i like this!!!! bond-mode 0 # MII link monitoring frequency in ms [2] bond-miimon 100 # Wait this long in ms before disabling an interface after MII failure [2] bond-downdelay 200 # Wait this long in ms before enabling an interface after MII recovery [2] bond-updelay 100 # Bind the NIC1 physical interface to the primary bonding interface. auto eth0 # Permit the bonded interface to turn this interface up/down as necessary. allow-bond0 eth0 iface eth0 inet manual # Bind this interface to a bonding interface. bond-master bond0 # Bind the NIC2 physical interface to the primary bonding interface. auto eth1 # Permit the bonded interface to turn this interface up/down as necessary. allow-bond0 eth1 iface eth1 inet manual # Bind this interface to a bonding interface. bond-master bond0 ####### VLAN TAGGING INTERFACES (ON TOP OF BOND, BEFORE BRIDGES) ######################################### #//////////////////////////////////////////////////// # # В документации http://www.kernel.org/doc/Documentation/networking/bonding.txt # Секция "6. 802.1q VLAN Support", цитирую: # # VLAN interfaces *must* be added on top of a bonding interface only after enslaving at least one slave. # #//////////////////////////////////////////////////// # Create an interface on a VLAN on the primary bonding interface. auto bond0.101 #allow-br0-101 bond0.101 iface bond0.101 inet manual # Force the interface to up/down automatically without an IP. post-up ifconfig $IFACE up pre-down ifconfig $IFACE down # Must specify the interface again due to bonding bug in vlan tools. vlan-raw-device bond0 # Create an interface on a VLAN on the primary bonding interface. auto bond0.102 #allow-br0-102 bond0.102 iface bond0.102 inet manual # Force the interface to up/down automatically without an IP. post-up ifconfig $IFACE up pre-down ifconfig $IFACE down # Must specify the interface again due to bonding bug in vlan tools. vlan-raw-device bond0 ####### BRIDGING INTERFACES ############################################################################## #Bridged iface on BOND auto br0 # This bridge *MUST* have an HWAddress (copy of BOND0) for startup br0-101 & br0-102 # so we start it with stanza.... iface br0 inet static # Static assign the IP, netmask, default gateway. address 192.168.0.80 netmask 255.255.255.0 network 192.168.0.0 broadcast 192.168.0.255 gateway 192.168.0.40 # dns-* options are implemented by the resolvconf package, if installed dns-nameservers 192.168.0.10 192.168.0.40 dns-search xolding.lan # Bind one or more interfaces to the bridge. bridge_ports bond0 # Tune the bridge for a single interface. # * STP = ON , if you want VNETs for VMs on this BRIDGE bridge_stp on bridge_fd 0 bridge_maxwait 0 #/////////////////////////////////////////////////// # Nex 2 ifaces on top of BR0 & BOND0 # If bond0 or br0 is down - this ifaces loose functionality # And you loose yuor SSH-connection..... #/////////////////////////////////////////////////// # Bridged interface on VLAN+BR0 auto br0-101 ##iface br0-101 inet manual ## # Force the interface to up/down automatically without an IP. ## post-up ifconfig $IFACE up ## pre-down ifconfig $IFACE down iface br0-101 inet static # Static assign the IP, netmask, default gateway. address 192.168.0.81 netmask 255.255.255.0 network 192.168.0.0 broadcast 192.168.0.255 gateway 192.168.0.40 # dns-* options are implemented by the resolvconf package, if installed dns-nameservers 192.168.0.10 192.168.0.40 dns-search xolding.lan # Bind one or more interfaces to the bridge. bridge_ports bond0.101 # Tune the bridge for a single interface. # * STP = ON , if you want VNETs for VMs on this BRIDGE bridge_stp on bridge_fd 0 bridge_maxwait 0 # Bridged interface on VLAN+BR0 auto br0-102 ##iface br0-102 inet manual ## # Force the interface to up/down automatically without an IP. ## post-up ifconfig $IFACE up ## pre-down ifconfig $IFACE down iface br0-102 inet static # Static assign the IP, netmask, default gateway. address 192.168.0.82 netmask 255.255.255.0 network 192.168.0.0 broadcast 192.168.0.255 gateway 192.168.0.40 # dns-* options are implemented by the resolvconf package, if installed dns-nameservers 192.168.0.10 192.168.0.40 dns-search xolding.lan # Bind one or more interfaces to the bridge. bridge_ports bond0.102 # Tune the bridge for a single interface. # * STP = ON , if you want VNETs for VMs on this BRIDGE bridge_stp on bridge_fd 0 bridge_maxwait 0