Skip to content

Instantly share code, notes, and snippets.

@jameskyle
Created June 26, 2012 20:04
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jameskyle/2998524 to your computer and use it in GitHub Desktop.
Save jameskyle/2998524 to your computer and use it in GitHub Desktop.
manual bonding configuration
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing. This file was generated by cede.
#
# This file describes the network interfaces available
modprobe bonding
echo 1 > /sys/class/net/bond0/bonding/mode
echo +eth0 > /sys/class/net/bond0/bonding/slaves
echo +eth1 > /sys/class/net/bond0/bonding/slaves
ip link set bond0 up
ip addr add ${MGMT_ADDRESS}/20 broadcast ${MGMT_BROADCAST} dev ${MGMT_INTERFACE}
ip link set ${MGMT_INTERFACE} up
# 10gb bond
echo +${PUBLIC_BOND} > /sys/class/net/bonding_masters
echo 4 > /sys/class/net/bond1/bonding/mode
echo 100 > /sys/class/net/bond1/bonding/miimon
echo 200 > /sys/class/net/bond1/bonding/downdelay
echo 200 > /sys/class/net/bond1/bonding/updelay
echo 1 > /sys/class/net/bond1/bonding/xmit_hash_policy
echo 1 > /sys/class/net/bond1/bonding/ad_select
echo 1 > /sys/class/net/bond1/bonding/lacp_rate
echo +eth2 > /sys/class/net/bond1/bonding/slaves
echo +eth3 > /sys/class/net/bond1/bonding/slaves
ip link set bond1 up
# Interfaces
ip link add link ${IPMI_BOND} name ${IPMI_INTERFACE} type vlan id ${IPMI_VLAN}
ip addr add ${IPMI_ADDRESS}/24 broadcast ${IPMI_BROADCAST} dev ${IPMI_INTERFACE}
ip link set ${IPMI_INTERFACE} up
ip link add link ${OPS_BOND} name ${OPS_INTERFACE} type vlan id ${OPS_VLAN}
ip addr add ${OPS_ADDRESS}/20 broadcast ${OPS_BROADCAST} dev ${OPS_INTERFACE}
ip link set ${OPS_INTERFACE} up
ip link add link ${PUBLIC_BOND} name ${PUBLIC_INTERFACE} type vlan id ${PUBLIC_VLAN}
ip addr add ${PUBLIC_ADDRESS}/24 broadcast ${PUBLIC_BROADCAST} dev ${PUBLIC_INTERFACE}
ip link set ${PUBLIC_INTERFACE} up
ip route add default via ${PUBLIC_GATEWAY} dev ${PUBLIC_INTERFACE}
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment