Friday, December 28, 2012

Setup vlan on top of bond in SuSE linux 11

I have 4 NICs on a SuSE server (SELS 11 sp2) and I want to bond them together and enable vlan on top of the bond device,  following are the files I need create:

(1) ifcfg-eth<#>:  (ifcfg-eth0 ~ ifcfg-eth3) , basically set all them with empty IP and with STARTMODE='off' ,  BOOTPROTO='none' )

Myhost01:/etc/sysconfig/network # cat ifcfg-eth0
BOOTPROTO='none'
BROADCAST=''
ETHTOOL_OPTIONS=''
IPADDR=''
MTU=''
NAME='NetXtreme II BCM5709 Gigabit Ethernet'
NETMASK=''
NETWORK=''
REMOTE_IPADDR=''
STARTMODE='off'
USERCONTROL='no'
Myhost01:/etc/sysconfig/network #cp ifcfg-eth0 ifcfg-eth1
Myhost01:/etc/sysconfig/network #cp ifcfg-eth0 ifcfg-eth2
Myhost01:/etc/sysconfig/network #cp ifcfg-eth0 ifcfg-eth3



(2)  ifcfg-bond0   (bond eth0 ~ eth3 together, using mode 4 or 802.3ad ,  see Trunking / Bonding Multiple Network Interfaces  for more descriptions about the modes;
Please note 802.3ad needs special configurations on switch side,  see  Cisco LACP for details. )


Myhost01:/etc/sysconfig/network # cat ifcfg-bond0
BONDING_MASTER='yes'
BONDING_MODULE_OPTS='mode=802.3ad miimon=100'
BOOTPROTO='static'
BROADCAST=''
ETHTOOL_OPTIONS=''
IPADDR='0.0.0.0/32'
MTU=''
NAME=''
NETMASK='255.255.255.0'
NETWORK=''
REMOTE_IPADDR=''
STARTMODE='auto'
USERCONTROL='no'
BONDING_SLAVE0='eth0'
BONDING_SLAVE1='eth1'
BONDING_SLAVE2='eth2'
BONDING_SLAVE3='eth3'
PREFIXLEN='24'

(3) ifcfg-vlan<#>  ( Create vlan on top of the bond interface, vlan0 for vlan ID 10, vlan1 for vlan ID 20 , make sure you have  MODULES_LOADED_ON_BOOT="8021q" added in /etc/sysconfig/kernel , network admin also need enable vlan tags on switch side.)

Myhost01:/etc/sysconfig/network #
Myhost01:/etc/sysconfig/network # cat ifcfg-vlan0
BOOTPROTO='static'
BROADCAST=''
ETHERDEVICE='bond0'
ETHTOOL_OPTIONS=''
IPADDR='192.168.10.70/24'
MTU=''
NAME=''
NETWORK=''
REMOTE_IPADDR=''
STARTMODE='auto'
USERCONTROL='no'
VLAN_ID='10'

Myhost01:/etc/sysconfig/network # cat ifcfg-vlan1
BOOTPROTO='static'
BROADCAST=''
ETHERDEVICE='bond0'
ETHTOOL_OPTIONS=''
IPADDR='192.168.20.50/24'
MTU=''
NAME=''
NETWORK=''
REMOTE_IPADDR=''
STARTMODE='auto'
USERCONTROL='no'
VLAN_ID='20'


After above configuration in place,  check route configurations (such as default route in /etc/sysconfig/network/routes) and then  restart network:
/sbin/rcnetwork restart


Above is an example from CLI,  to accomplish the same thing in GUI,  please use "yast2 lan ".
For eth0~eth3, edit them to be slave in bond, with Activate device of  "NEVER",  create the bond with the proper bond driver options (in "Bond Slaves" tab ) and activate device as "  At Boot Time",  then create the vlan interfaces on top of the bond;

Please refer to following blogs/docs for more details:
suse-linux-11-how-to-configure-vlans/
Yast2 lan