#!/bin/bash ethtool eth0 |grep "Link detected: yes"> /dev/null if [ $? -ne 0 ] ;then echo Can not detect the link of eth0 exit 1 fi
ethtool eth1 |grep "Link detected: yes"> /dev/null if [ $? -ne 0 ] ;then echo Can not detect the link of eth1 exit 1 fi
echoalias bond0 bonding >> /etc/modprobe.conf set_rhel5_bond_config () { unset OPTIND whilegetopts'b:m:i:n:g:s:t:' opt; do case$optin b) bond_name=$OPTARG;; m) bond_mode=$OPTARG;; i) ip=$OPTARG;; n) mask=$OPTARG;; g) gateway=$OPTARG;; s) bond_opts=$OPTARG;; t) network_type=$OPTARG;; esac done bond_config_file="/etc/sysconfig/network-scripts/ifcfg-$bond_name" echo$bond_config_file if [ -f $bond_config_file ]; then echo"Backup original $bond_config_file to bondhelper.$bond_name" mv$bond_config_file /etc/sysconfig/network-scripts/bondhelper.$bond_name -f fi
if [ "static" == $network_type ]; then if [ ! -n "$gateway" ]; then ip_setting="IPADDR=$ip NETMASK=$mask USERCTL=no" else ip_setting="IPADDR=$ip NETMASK=$mask GATEWAY=$gateway USERCTL=no" fi else ip_setting="USERCTL=no" fi cat << EOF > $bond_config_file DEVICE=$bond_name ONBOOT=yes BOOTPROTO=$network_type $ip_setting BONDING_OPTS="mode=$bond_mode $bond_opts" NM_CONTROLLED=no EOF } set_rhel5_bond_config -b bond0 -m 0 -i 192.168.0.1 -n 255.255.255.0 -g 192.168.0.254 -t static -s "miimon=100" set_rhel5_ethx_config() { bond_name=$1 eth_name=$2
mac_address=`cat /sys/class/net/$eth_name/address` eth_config_file="/etc/sysconfig/network-scripts/ifcfg-$eth_name" if [ -f $eth_config_file ]; then echo"Backup original $eth_config_file to bondhelper.$eth_name" mv$eth_config_file /etc/sysconfig/network-scripts/bondhelper.$eth_name -f fi
eth_config_file="/etc/sysconfig/network-scripts/ifcfg-$eth_name" if [ -f $eth_config_file ]; then echo"Backup original $eth_config_file to bondhelper.$eth_name" mv$eth_config_file /etc/sysconfig/network-scripts/bondhelper.$eth_name -f fi
#!/bin/bash ethtool eht0 |grep "Link detected: yes"> /dev/null if [ $? -ne 0 ] ;then echo Can not detect the link of eht0 exit 1 fi
ethtool eth1 |grep "Link detected: yes"> /dev/null if [ $? -ne 0 ] ;then echo Can not detect the link of eth1 exit 1 fi
echoalias bond0 bonding >> /etc/modprobe.conf set_rhel5_bond_config () { unset OPTIND whilegetopts'b:m:i:n:g:s:t:' opt; do case$optin b) bond_name=$OPTARG;; m) bond_mode=$OPTARG;; i) ip=$OPTARG;; n) mask=$OPTARG;; g) gateway=$OPTARG;; s) bond_opts=$OPTARG;; t) network_type=$OPTARG;; esac done bond_config_file="/etc/sysconfig/network-scripts/ifcfg-$bond_name" echo$bond_config_file if [ -f $bond_config_file ]; then echo"Backup original $bond_config_file to bondhelper.$bond_name" mv$bond_config_file /etc/sysconfig/network-scripts/bondhelper.$bond_name -f fi
if [ "static" == $network_type ]; then if [ ! -n "$gateway" ]; then ip_setting="IPADDR=$ip NETMASK=$mask USERCTL=no" else ip_setting="IPADDR=$ip NETMASK=$mask GATEWAY=$gateway USERCTL=no" fi else ip_setting="USERCTL=no" fi cat << EOF > $bond_config_file DEVICE=$bond_name ONBOOT=yes BOOTPROTO=$network_type $ip_setting BONDING_OPTS="mode=$bond_mode $bond_opts" NM_CONTROLLED=no EOF } set_rhel5_bond_config -b bond0 -m 1 -i 192.168.0.1 -n 255.255.255.0 -g 192.168.0.254 -t static -s "miimon=100 primary=eht0" set_rhel5_ethx_config() { bond_name=$1 eth_name=$2
mac_address=`cat /sys/class/net/$eth_name/address` eth_config_file="/etc/sysconfig/network-scripts/ifcfg-$eth_name" if [ -f $eth_config_file ]; then echo"Backup original $eth_config_file to bondhelper.$eth_name" mv$eth_config_file /etc/sysconfig/network-scripts/bondhelper.$eth_name -f fi
eth_config_file="/etc/sysconfig/network-scripts/ifcfg-$eth_name" if [ -f $eth_config_file ]; then echo"Backup original $eth_config_file to bondhelper.$eth_name" mv$eth_config_file /etc/sysconfig/network-scripts/bondhelper.$eth_name -f fi
#!/bin/bash ethtool eht0 |grep "Link detected: yes"> /dev/null if [ $? -ne 0 ] ;then echo Can not detect the link of eht0 exit 1 fi
ethtool eth1 |grep "Link detected: yes"> /dev/null if [ $? -ne 0 ] ;then echo Can not detect the link of eth1 exit 1 fi
echoalias bond0 bonding >> /etc/modprobe.conf set_rhel5_bond_config () { unset OPTIND whilegetopts'b:m:i:n:g:s:t:' opt; do case$optin b) bond_name=$OPTARG;; m) bond_mode=$OPTARG;; i) ip=$OPTARG;; n) mask=$OPTARG;; g) gateway=$OPTARG;; s) bond_opts=$OPTARG;; t) network_type=$OPTARG;; esac done bond_config_file="/etc/sysconfig/network-scripts/ifcfg-$bond_name" echo$bond_config_file if [ -f $bond_config_file ]; then echo"Backup original $bond_config_file to bondhelper.$bond_name" mv$bond_config_file /etc/sysconfig/network-scripts/bondhelper.$bond_name -f fi
if [ "static" == $network_type ]; then if [ ! -n "$gateway" ]; then ip_setting="IPADDR=$ip NETMASK=$mask USERCTL=no" else ip_setting="IPADDR=$ip NETMASK=$mask GATEWAY=$gateway USERCTL=no" fi else ip_setting="USERCTL=no" fi cat << EOF > $bond_config_file DEVICE=$bond_name ONBOOT=yes BOOTPROTO=$network_type $ip_setting BONDING_OPTS="mode=$bond_mode $bond_opts" NM_CONTROLLED=no EOF } set_rhel5_bond_config -b bond0 -m 2 -i 192.168.0.1 -n 255.255.255.0 -g 192.168.0.254 -t static -s "miimon=100 xmit_hash_policy=layer3+4" set_rhel5_ethx_config() { bond_name=$1 eth_name=$2
mac_address=`cat /sys/class/net/$eth_name/address` eth_config_file="/etc/sysconfig/network-scripts/ifcfg-$eth_name" if [ -f $eth_config_file ]; then echo"Backup original $eth_config_file to bondhelper.$eth_name" mv$eth_config_file /etc/sysconfig/network-scripts/bondhelper.$eth_name -f fi
eth_config_file="/etc/sysconfig/network-scripts/ifcfg-$eth_name" if [ -f $eth_config_file ]; then echo"Backup original $eth_config_file to bondhelper.$eth_name" mv$eth_config_file /etc/sysconfig/network-scripts/bondhelper.$eth_name -f fi
#!/bin/bash ethtool eht0 |grep "Link detected: yes"> /dev/null if [ $? -ne 0 ] ;then echo Can not detect the link of eht0 exit 1 fi
ethtool eth1 |grep "Link detected: yes"> /dev/null if [ $? -ne 0 ] ;then echo Can not detect the link of eth1 exit 1 fi
echoalias bond0 bonding >> /etc/modprobe.conf set_rhel5_bond_config () { unset OPTIND whilegetopts'b:m:i:n:g:s:t:' opt; do case$optin b) bond_name=$OPTARG;; m) bond_mode=$OPTARG;; i) ip=$OPTARG;; n) mask=$OPTARG;; g) gateway=$OPTARG;; s) bond_opts=$OPTARG;; t) network_type=$OPTARG;; esac done bond_config_file="/etc/sysconfig/network-scripts/ifcfg-$bond_name" echo$bond_config_file if [ -f $bond_config_file ]; then echo"Backup original $bond_config_file to bondhelper.$bond_name" mv$bond_config_file /etc/sysconfig/network-scripts/bondhelper.$bond_name -f fi
if [ "static" == $network_type ]; then if [ ! -n "$gateway" ]; then ip_setting="IPADDR=$ip NETMASK=$mask USERCTL=no" else ip_setting="IPADDR=$ip NETMASK=$mask GATEWAY=$gateway USERCTL=no" fi else ip_setting="USERCTL=no" fi cat << EOF > $bond_config_file DEVICE=$bond_name ONBOOT=yes BOOTPROTO=$network_type $ip_setting BONDING_OPTS="mode=$bond_mode $bond_opts" NM_CONTROLLED=no EOF } set_rhel5_bond_config -b bond0 -m 3 -i 192.168.0.1 -n 255.255.255.0 -g 192.168.0.254 -t static -s "miimon=100" set_rhel5_ethx_config() { bond_name=$1 eth_name=$2
mac_address=`cat /sys/class/net/$eth_name/address` eth_config_file="/etc/sysconfig/network-scripts/ifcfg-$eth_name" if [ -f $eth_config_file ]; then echo"Backup original $eth_config_file to bondhelper.$eth_name" mv$eth_config_file /etc/sysconfig/network-scripts/bondhelper.$eth_name -f fi
eth_config_file="/etc/sysconfig/network-scripts/ifcfg-$eth_name" if [ -f $eth_config_file ]; then echo"Backup original $eth_config_file to bondhelper.$eth_name" mv$eth_config_file /etc/sysconfig/network-scripts/bondhelper.$eth_name -f fi
#!/bin/bash ethtool eht0 |grep "Link detected: yes"> /dev/null if [ $? -ne 0 ] ;then echo Can not detect the link of eht0 exit 1 fi
ethtool eth1 |grep "Link detected: yes"> /dev/null if [ $? -ne 0 ] ;then echo Can not detect the link of eth1 exit 1 fi
echoalias bond0 bonding >> /etc/modprobe.conf set_rhel5_bond_config () { unset OPTIND whilegetopts'b:m:i:n:g:s:t:' opt; do case$optin b) bond_name=$OPTARG;; m) bond_mode=$OPTARG;; i) ip=$OPTARG;; n) mask=$OPTARG;; g) gateway=$OPTARG;; s) bond_opts=$OPTARG;; t) network_type=$OPTARG;; esac done bond_config_file="/etc/sysconfig/network-scripts/ifcfg-$bond_name" echo$bond_config_file if [ -f $bond_config_file ]; then echo"Backup original $bond_config_file to bondhelper.$bond_name" mv$bond_config_file /etc/sysconfig/network-scripts/bondhelper.$bond_name -f fi
if [ "static" == $network_type ]; then if [ ! -n "$gateway" ]; then ip_setting="IPADDR=$ip NETMASK=$mask USERCTL=no" else ip_setting="IPADDR=$ip NETMASK=$mask GATEWAY=$gateway USERCTL=no" fi else ip_setting="USERCTL=no" fi cat << EOF > $bond_config_file DEVICE=$bond_name ONBOOT=yes BOOTPROTO=$network_type $ip_setting BONDING_OPTS="mode=$bond_mode $bond_opts" NM_CONTROLLED=no EOF } set_rhel5_bond_config -b bond0 -m 4 -i 192.168.0.1 -n 255.255.255.0 -g 192.168.0.254 -t static -s "miimon=100 xmit_hash_policy=layer2+3" set_rhel5_ethx_config() { bond_name=$1 eth_name=$2
mac_address=`cat /sys/class/net/$eth_name/address` eth_config_file="/etc/sysconfig/network-scripts/ifcfg-$eth_name" if [ -f $eth_config_file ]; then echo"Backup original $eth_config_file to bondhelper.$eth_name" mv$eth_config_file /etc/sysconfig/network-scripts/bondhelper.$eth_name -f fi
eth_config_file="/etc/sysconfig/network-scripts/ifcfg-$eth_name" if [ -f $eth_config_file ]; then echo"Backup original $eth_config_file to bondhelper.$eth_name" mv$eth_config_file /etc/sysconfig/network-scripts/bondhelper.$eth_name -f fi
#!/bin/bash ethtool eht0 |grep "Link detected: yes"> /dev/null if [ $? -ne 0 ] ;then echo Can not detect the link of eht0 exit 1 fi
ethtool eth1 |grep "Link detected: yes"> /dev/null if [ $? -ne 0 ] ;then echo Can not detect the link of eth1 exit 1 fi
echoalias bond0 bonding >> /etc/modprobe.conf set_rhel5_bond_config () { unset OPTIND whilegetopts'b:m:i:n:g:s:t:' opt; do case$optin b) bond_name=$OPTARG;; m) bond_mode=$OPTARG;; i) ip=$OPTARG;; n) mask=$OPTARG;; g) gateway=$OPTARG;; s) bond_opts=$OPTARG;; t) network_type=$OPTARG;; esac done bond_config_file="/etc/sysconfig/network-scripts/ifcfg-$bond_name" echo$bond_config_file if [ -f $bond_config_file ]; then echo"Backup original $bond_config_file to bondhelper.$bond_name" mv$bond_config_file /etc/sysconfig/network-scripts/bondhelper.$bond_name -f fi
if [ "static" == $network_type ]; then if [ ! -n "$gateway" ]; then ip_setting="IPADDR=$ip NETMASK=$mask USERCTL=no" else ip_setting="IPADDR=$ip NETMASK=$mask GATEWAY=$gateway USERCTL=no" fi else ip_setting="USERCTL=no" fi cat << EOF > $bond_config_file DEVICE=$bond_name ONBOOT=yes BOOTPROTO=$network_type $ip_setting BONDING_OPTS="mode=$bond_mode $bond_opts" NM_CONTROLLED=no EOF } set_rhel5_bond_config -b bond0 -m 5 -i 192.168.0.1 -n 255.255.255.0 -g 192.168.0.254 -t static -s "miimon=100" set_rhel5_ethx_config() { bond_name=$1 eth_name=$2
mac_address=`cat /sys/class/net/$eth_name/address` eth_config_file="/etc/sysconfig/network-scripts/ifcfg-$eth_name" if [ -f $eth_config_file ]; then echo"Backup original $eth_config_file to bondhelper.$eth_name" mv$eth_config_file /etc/sysconfig/network-scripts/bondhelper.$eth_name -f fi
eth_config_file="/etc/sysconfig/network-scripts/ifcfg-$eth_name" if [ -f $eth_config_file ]; then echo"Backup original $eth_config_file to bondhelper.$eth_name" mv$eth_config_file /etc/sysconfig/network-scripts/bondhelper.$eth_name -f fi
#!/bin/bash ethtool eht0 |grep "Link detected: yes"> /dev/null if [ $? -ne 0 ] ;then echo Can not detect the link of eht0 exit 1 fi
ethtool eth1 |grep "Link detected: yes"> /dev/null if [ $? -ne 0 ] ;then echo Can not detect the link of eth1 exit 1 fi
echoalias bond0 bonding >> /etc/modprobe.conf set_rhel5_bond_config () { unset OPTIND whilegetopts'b:m:i:n:g:s:t:' opt; do case$optin b) bond_name=$OPTARG;; m) bond_mode=$OPTARG;; i) ip=$OPTARG;; n) mask=$OPTARG;; g) gateway=$OPTARG;; s) bond_opts=$OPTARG;; t) network_type=$OPTARG;; esac done bond_config_file="/etc/sysconfig/network-scripts/ifcfg-$bond_name" echo$bond_config_file if [ -f $bond_config_file ]; then echo"Backup original $bond_config_file to bondhelper.$bond_name" mv$bond_config_file /etc/sysconfig/network-scripts/bondhelper.$bond_name -f fi
if [ "static" == $network_type ]; then if [ ! -n "$gateway" ]; then ip_setting="IPADDR=$ip NETMASK=$mask USERCTL=no" else ip_setting="IPADDR=$ip NETMASK=$mask GATEWAY=$gateway USERCTL=no" fi else ip_setting="USERCTL=no" fi cat << EOF > $bond_config_file DEVICE=$bond_name ONBOOT=yes BOOTPROTO=$network_type $ip_setting BONDING_OPTS="mode=$bond_mode $bond_opts" NM_CONTROLLED=no EOF } set_rhel5_bond_config -b bond0 -m 6 -i 192.168.0.1 -n 255.255.255.0 -g 192.168.0.254 -t static -s "miimon=100" set_rhel5_ethx_config() { bond_name=$1 eth_name=$2
mac_address=`cat /sys/class/net/$eth_name/address` eth_config_file="/etc/sysconfig/network-scripts/ifcfg-$eth_name" if [ -f $eth_config_file ]; then echo"Backup original $eth_config_file to bondhelper.$eth_name" mv$eth_config_file /etc/sysconfig/network-scripts/bondhelper.$eth_name -f fi
eth_config_file="/etc/sysconfig/network-scripts/ifcfg-$eth_name" if [ -f $eth_config_file ]; then echo"Backup original $eth_config_file to bondhelper.$eth_name" mv$eth_config_file /etc/sysconfig/network-scripts/bondhelper.$eth_name -f fi