SUSE Conversations


AutoYaST:NIC Bonding

cseader

By: cseader

March 31, 2008 11:10 am

Reads:244

Comments:0

Rating:0

Application:

If you are using AutoYaST and need a way to setup NIC Bonding, then you can just follow the steps outlined here. The setup in this text is a generic setup and should work with most every hardware.

Explanation:

In order to get this to work properly you will first need to change your networking tags a bit in your AutoYaST xml. Below is an example of what it should look like.

<networking>
      <dhcp_options>
        <dhclient_hostname_option>AUTO</dhclient_hostname_option>
      </dhcp_options>
      <dns>
        <dhcp_hostname config:type="boolean">true</dhcp_hostname>
        <dhcp_resolv config:type="boolean">false</dhcp_resolv>
        <domain>localdomain.com</domain>
        <hostname>localhost</hostname>
        <nameservers config:type="list">
          <nameserver></nameserver>
          <nameserver></nameserver>
        </nameservers>
        <searchlist config:type="list">
          <search>localdomain.com</search>
        </searchlist>
      </dns>
      <interfaces config:type="list">
        <interface>
          <bootproto>none</bootproto>
          <device>eth0</device>
          <startmode>off</startmode>
        </interface>
        <interface>
        <bootproto>none</bootproto>
        <device>eth1</device>
        <startmode>off</startmode>
        </interface>
      </interfaces>
      <routing>
        <ip_forward config:type="boolean">false</ip_forward>
      </routing>
    </networking>

Notice the two interface tags for eth0 and eth1 (You could have an eth2 and eth3 as well). The bootproto tag should be changed to none and the startmode tag should be changed to off. This is so that these interfaces don’t get enabled at all except through the bond device.

In order to setup the bond device we use the files tag in AutoYaST in order to lay down a configuration file in /etc/sysconfig/network/ for the bond device. (You could setup multiple bond devices if you had 4 network interfaces ) Below is a sample configuration of a bond device.

<files config:type="list">
    <file>
      <file_contents><![CDATA[STARTMODE='onboot'
BOOTPROTO='dhcp'
#IPADDR='x.x.x.x/24'
BONDING_MASTER='yes'
BONDING_SLAVE_0='eth0'  
BONDING_SLAVE_1='eth1'  
BONDING_MODULE_OPTS='mode=1 primary=eth1 arp_interval=1000  
]]></file_contents>
      <file_owner>root</file_owner>
      <file_path>/etc/sysconfig/network/ifcfg-bond0</file_path>
      <file_permissions>644</file_permissions>
    </file>
</files>

Notice BOOTPROTO is dhcp for this config, now you can change that to static if you want and then uncomment the IPADDR line and put in a static address, but then the configuration won’t be generic to lay accross dozens of machines. The BONDING_SLAVE lines are for calling out the network interfaces which will be the slaves for the Bonding.(You could add a 3rd slave if you wanted) The BONDING_MODULE_OPTS are for the bonding kernel module options to set the mode and other settings on the bonding device. You can find out all of the options by issuing the following.

# modinfo bonding

parm:           arp_ip_target:arp targets in n.n.n.n form (array of charp)
parm:           arp_interval:arp interval in milliseconds (int)
parm:           xmit_hash_policy:XOR hashing method: 0 for layer 2 (default), 1 for layer 3+4 (charp)
parm:           lacp_rate:LACPDU tx rate to request from 802.3ad partner (slow/fast) (charp)
parm:           primary:Primary network device to use (charp)
parm:           mode:Mode of operation : 0 for balance-rr, 1 for active-backup, 2 for balance-xor, 3 for broadcast, 4 for 802.3ad, 5 for balance-tlb, 6 for balance-alb (charp)
parm:           use_carrier:Use netif_carrier_ok (vs MII ioctls) in miimon; 0 for off, 1 for on (default) (int)
parm:           downdelay:Delay before considering link down, in milliseconds (int)
parm:           updelay:Delay before considering link up, in milliseconds (int)
parm:           miimon:Link check interval in milliseconds (int)
parm:           max_bonds:Max number of bonded devices (int)

So at this point feel free to modify the module options to best fit your environment. I am including a full networking and files tags together so you can just copy and paste into your AutoYaST configuration.

<networking>
      <dhcp_options>
        <dhclient_hostname_option>AUTO</dhclient_hostname_option>
      </dhcp_options>
      <dns>
        <dhcp_hostname config:type="boolean">true</dhcp_hostname>
        <dhcp_resolv config:type="boolean">false</dhcp_resolv>
        <domain>localdomain.com</domain>
        <hostname>localhost</hostname>
        <nameservers config:type="list">
          <nameserver></nameserver>
          <nameserver></nameserver>
        </nameservers>
        <searchlist config:type="list">
          <search>localdomain.com</search>
        </searchlist>
      </dns>
      <interfaces config:type="list">
        <interface>
          <bootproto>none</bootproto>
          <device>eth0</device>
          <startmode>off</startmode>
        </interface>
        <interface>
        <bootproto>none</bootproto>
        <device>eth1</device>
        <startmode>off</startmode>
        </interface>
      </interfaces>
      <routing>
        <ip_forward config:type="boolean">false</ip_forward>
      </routing>
    </networking>
<files config:type="list">
    <file>
      <file_contents><![CDATA[STARTMODE='onboot'
BOOTPROTO='dhcp'
#IPADDR='x.x.x.x/24'
BONDING_MASTER='yes'
BONDING_SLAVE_0='eth0'  
BONDING_SLAVE_1='eth1'  
BONDING_MODULE_OPTS='mode=1 primary=eth1 arp_interval=1000  
]]></file_contents>
      <file_owner>root</file_owner>
      <file_path>/etc/sysconfig/network/ifcfg-bond0</file_path>
      <file_permissions>644</file_permissions>
    </file>
</files>

Enjoy!

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)

Tags: ,
Categories: SUSE Linux Enterprise Server, Technical Solutions

Disclaimer: As with everything else at SUSE Conversations, this content is definitely not supported by SUSE (so don't even think of calling Support if you try something and it blows up).  It was contributed by a community member and is published "as is." It seems to have worked for at least one person, and might work for you. But please be sure to test, test, test before you do anything drastic with it.

Comment

RSS