Scripts For Configuring IP Multi Pa Thing in Oracle Solaris
Scripts For Configuring IP Multi Pa Thing in Oracle Solaris
IP Multipathing
in Oracle Solaris
Prashant Pilankar, April 2010
Introduction
This tech tip provides a main script and several subscripts that are useful for configuring IP Multipathing in the
Oracle Solaris operating system. The scripts can be modified as needed and can be used to perform the
following tasks:
Note: All the scripts work on both SPARC and x86 machines, with the exception of the script for configuring
unique MAC addresses. That script works only on SPARC systems.
This section contains screen shots that show how to use the main script, ipmpconf, for performing various
tasks.
First, here is a screen shot of the menu provided by the ipmpconf script:
Note: Option 2 is capable of configuring unique MAC addresses only on SPARC systems. Its functionality
works fine, but I was not able to provide a screen shot for it because I only have a test Oracle Solaris instance
running on an x86 system with VMware.
It seems I have missed the task of making the IPMP configuration persistent across reboot. So next I add the
missing task before I reveal the logic of the script.
Now let's update the /etc/hostname.<interface> file for the e1000g1 interface:
/etc/hostname.e1000g2
sys11 netmask + broadcast + group mpgrp-one up addif sys11-test-e1000g2 deprecated
netmask + broadcast + -failover up
/etc/hostname.e1000g1
sys11-data-e1000g1 netmask + broadcast + group mpgrp-one up addif sys11-test-e1000g1
deprecated netmask + broadcast + -failover up
Now that we have seen how to use the main ipmpconf script, let's have a look at the code for all the scripts.
Here's a link to the ipmp_scripts.zip file, which contains the source code for the main script and the
subscripts.
2. Place the subscripts in the same directory where you place the main ipmpconf script.
3. Modify the path in the main script as needed, so it points to the directory where you placed the scripts.
(Currently, /export/home/pilankar/ipmp_scripts is used in the script.)
#!/usr/bin/bash
#Version 1.0
#Author: Prashant Pilankar
#Email : [email protected]
# Script for IP Multipathing Configuration in Solaris OS
while [ 1 ]
do
echo -e '\E[42;38m' # Set colors: bg=blue, fg=white
clear # Note: colors may be different in xterms
echo -e '\E[44;38m' # bg=red
Following are the subscripts that are called from the main ipmpconf script.
#!/usr/bin/bash
#Script to display the current Interface Configuration and OS Release
#Author: Prashant Pilankar
echo
"========================================================================================
==============="
echo " `tput smso` Network Interfaces Configured `tput
rmso`"
echo -e "\033[32m `/usr/sbin/ifconfig -a` \e[m" ; sleep 4
echo " `tput smso` Solaris OS Release `tput rmso`"
echo -e "\033[32m `cat /etc/release` \e[m" ; sleep 4
echo " `tput smso` Contents of /etc/default/mpathd file
`tput rmso`"
echo -e "\033[32m `cat /etc/default/mpathd ` \e[m" ; sleep 4
echo
"========================================================================================
==============="
#!/usr/bin/bash
#Script to set the local-mac-address? variable to true only for sparc systems
#Author: Prashant Pilankar
echo -e "\033[41m Following is the existing value of the local-mac-address? variable on
sparc system \e[m"
eeprom "local-mac-address?"
echo "Would you like to continue to set the variable to true (y/n)?"
read f
if [ $f = y ]
then
eeprom "local-mac-address?=true" ; echo "now the variable value is set to" ; eeprom
"local-mac-address?" ; sleep 5
else
echo "bye for now " ; sleep 4 ; exit
fi
#!/usr/bin/bash
#Script to update the /etc/inet/hosts file for ipmp
#Author: Prashant Pilankar
echo -e "\033[44m Add the data and test IP addresses to the /etc/inet/hosts file for the
sake of clarity \e[m"
echo "Please input the following information"
echo "IP Address"
echo "Associated hostname"
echo "Comment"
echo "==================================================================="
echo -e "\033[41m Example : 192.168.1.1 sys11 # Data address for hme0 \e[m"
echo "==================================================================="
read a b c
echo $a $b $c >> /etc/inet/hosts
echo
echo -e "\033[45m Following are the contents of the /etc/inet/hosts file \e[m"
cat /etc/inet/hosts ; sleep 5
#!/usr/bin/bash
#Script to configure a interface as part of a Multipath group
#Author: Prashant Pilankar
echo -e "\033[41m This script assumes the /etc/inet/hosts & /etc/inet/netmasks file's are
updated \e[m"
echo -e "\033[41m Please input the following information \e[m"
echo "Interface Name"
echo "Name of the Multipath group"
echo "Hostname associated with the interface"
echo "==================================================================="
echo -e "\033[44m Example : hme0 mpgrp-one sys11 \e[m"
echo "==================================================================="
read a b c
#!/usr/bin/bash
#Script to configure a interface as part of a Multipath group
#Author: Prashant Pilankar
echo -e "\033[44m This script assumes the /etc/inet/hosts file is updated \e[m"
echo -e "\033[44m Please input the following information \e[m"
echo "Interface Name"
echo "Test Address of the Interface"
echo "==================================================================="
echo -e "\033[41m Example : hme0 192.168.1.51 \e[m"
echo "==================================================================="
read a b
ifconfig $a addif $b deprecated netmask + broadcast + -failover up &> /dev/null ; echo
"===========================" ; ifconfig -a ; sleep 5
#!/usr/bin/bash
#Script to Verify Link-based IPMP Operation
#Author: Prashant Pilankar
echo -e "\033[44m Please input the following Information to Verify Link-based IPMP
Operation \e[m"
echo "Interface Name"
echo "=========================================="
echo -e "\033[41m Example : hme0 \e[m"
echo "=========================================="
read a
if_mpadm -d $a ; echo -e "\033[45m Following is the NIC Configuration after the forced
Failover \e[m" ; ifconfig -a
echo " `tput smso` Recent update to /var/adm/messages file `tput rmso`
" ; tail -2 /var/adm/messages
echo "========Please Wait forcing Failback===========" ; sleep 6
if_mpadm -r $a ; echo -e "\033[45m Following is the NIC Configuration after the forced
Failback \e[m" ; ifconfig -a ; sleep 6
echo " `tput smso` Recent update to /var/adm/messages file `tput rmso`
" ; tail -2 /var/adm/messages
echo "========================================================"
#!/usr/bin/bash
#This script makes the IPMP Settings persistent across reboot
#Author: Prashant Pilankar
echo -e "\033[44m This script updates the /etc/hostname.<interface> files for
Persistent IPMP Settings \e[m"
echo -e "\033[44m Please input the following information for each \e[m"
echo -e "\033[44m Physical Interface part of the IPMP group \e[m"
echo "Hostname Associated With the Physical Interface"
echo "IPMP groupname"
echo "Hostname Associated with the Test Interface"
echo "============================================================"
echo -e "\033[45m Example : hme0 sys11 mpgrp-one sys11-test-hme0 \e[m"
echo "============================================================"
read a b c d
touch /etc/hostname.$a
echo "`echo $b` netmask + broadcast + group `echo $c` up addif `echo $d` deprecated
netmask + broadcast + -failover up" > /etc/hostname.$a
echo -e "\033[45m Following are the updates made to the file /etc/hostname.`echo $a`
\e[m"
cat /etc/hostname.$a ; sleep 5
Prashant Shashikant Pilankar has been a Solaris System Administrator for nearly nine years. He has experience
in Veritas Volume Manger and Basic Veritas Cluster and Basic Veritas NetBackup from Symantec, plus several
IT certifications, including the Solaris OS, Veritas, Oracle, Cisco, and Microsoft technology.