#!/bin/bash
em1='/etc/sysconfig/network-scripts/ifcfg-em1'
em2='/etc/sysconfig/network-scripts/ifcfg-em2'
bond0='/etc/sysconfig/network-scripts/ifcfg-bond0'
mod='/etc/modprobe.d/dist.conf'
rc='/etc/rc.local'
cat > $em1 <<EOF
DEVICE=em1
ONBOOT=yes
BOOTPROTO=none
EOF
cat > $em2 <<EOF
DEVICE=em2
ONBOOT=yes
BOOTPROTO=none
EOF
cat > $bond0 <<EOF
DEVICE=bond0
BOOTPROTO=static
NETMASK=xxxxxxx
NETMASK=xxxxxxx
GATEWAY=xxxxxxxxx
ONBOOT=yes
TYPE=Ethernet
BONDING_OPTS="mode=4 xmit_hash_policy=layer3 4 miimon=100"
EOF
cat >> $mod <<EOF
alias bond0 bonding
EOF
cat >> $rc <<EOF
ifenslave bond0 em1 em2
EOF