Register
It is currently Sat Oct 25, 2014 11:29 am

bonding with script on RHEL 5


All times are UTC - 6 hours


Post new topic Reply to topic  [ 1 post ] 
Author Message
 PostPosted: Wed Jul 08, 2009 2:23 am   

Joined: Wed Jul 08, 2009 2:05 am
Posts: 1
Hey,


First of all I'm sorry for my bad english.
and Thx god for this Site :)) :)) very helpful !!!

i'm loking for script for bonding on rhel 5.
I wrote a script, but I think he's silly and Not professional.
also I want to ask from user some data. for example the ip for bond interface.
This is my script.
Code:
function fn_interface_bonding {
file_bond=/etc/sysconfig/network-scripts/ifcfg-bond0
file_eth0=/etc/sysconfig/network-scripts/ifcfg-eth0
file_eth1=/etc/sysconfig/network-scripts/ifcfg-eth1
echo "What is the IP address for bond0 interface?"
read ipaddress
echo "What is the netmask?"
read netmask
echo "And the Default Gateway?"
read gateway
if [[ ! -f $file_bond ]]; then
        touch $file_bond
fi
if [[ -s $file_bond ]]; then
        printf "\t\t\tBackup /etc/sysconfig/network-scripts/ifcfg-* files... \n"
        printf "\t\t\tBackup /etc/sysconfig/network file... \n"
        printf "\t\t\tBackup /etc/modprobe.conf file... \n"
        backup
        echo "IPADDRESS=$ipaddress" > $file_bond
        echo "NETMASK=$netmask" >> $file_bond
        echo "DEVICE=bond0" >> $file_bond
        echo "BOOTPROTO=none" >> $file_bond
        echo "ONBOOT=yes" >> $file_bond
        echo "TYPE=Ethernet" >> $file_bond
        echo "GATEWAY=$gateway" >> $file_hostname
        echo "options bond0 mode=1 arp_interval=100 arp_ip_target=$gateway" >> $modprobe
        echo "USERCTL=no" >> $file_eth0
        echo "USERCTL=no" >> $file_eth1
        echo "SLAVE=yes" >> $file_eth0
        echo "SLAVE=yes" >> $file_eth1
        echo "MASTER=bond0" >> $file_eth0
        echo "MASTER=bond0" >> $file_eth1
        sed -e 's/BOOTPROTO.*/BOOTPROTO=none/' $file_eth0
        sed -e 's/BOOTPROTO.*/BOOTPROTO=none/' $file_eth1
        sed -e 's/HWADDR.*/#HWADDR/'
        sed -e 's/HWADDR.*/#HWADDR/'
        service network restart
fi
}
fn_interface_bonding

thx all


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 12 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP