HI,
I have created a script that does just that - removes any redundant default gateways.Works well for me.
=============================================
#!/bin/ksh
#
# Version 1.0
# August 30, 2005
#
#The script cleans ODM from redundant routs :
#1.Get the real default gateway (if exists) from lsip.sh .If there is no gateway found - just quit with message.
#2.Check for other gateways and remove them from ODM.
#3.If any routes were bad and have been removed - do the following:
# -flush all gateways
# -run bosboot
# -recreate the good default gateway
LOG=/tmp/cleanroute.log
HOSTNAME=`hostname`
#Check if my host is available.If not - force reboot at the end of the script
ping -c 1 $HOSTNAME >/dev/null 2>&1
if [[ $? != 0 ]] ;then
echo "My host $HOSTNAME is not pingable." |tee -a $LOG
exit 1
fi
MYADDRESS=`traceroute $HOSTNAME 2>/dev/null |awk '/source/ && ! /trying/ {print $4}'`
MYENT=`netstat -rn|grep $MYADDRESS|awk '! /lo0|pp0/ {print substr($6,3)}'|sort -u`
echo "============================================================" |tee -a $LOG
echo `date` >> $LOG
#Dsplay the orinal routing
echo "\ninet0 :" |tee -a $LOG
echo "`lsattr -El inet0|grep Route`" |tee -a $LOG
echo "\nnestat :" |tee -a $LOG
echo `netstat -rn|grep default`|tee -a $LOG
echo "-------------------------------------------"|tee -a $LOG
#establish the real gateway address
for EN in `lsdev -Cs pci| awk '/ent/ { print $1 }'|cut -c 1,2,4`;do
DEFAULT=`mktcpip -S $EN 2>&1|awk -F: '$0 !~ /host/ {print $7 }'`
if [[ -n $DEFAULT ]] ;then #just get the first gateway occurance and carry on
break
fi
done
if [[ -z $DEFAULT ]] ;then
echo "No default gateways were found !"
exit 1
fi
for DEFAULT1 in `netstat -rn|grep -v $DEFAULT|awk '/UGc/ {print $2}'` ;do #it's a gateway,but not a default one
if [[ $DEFAULT1 != $DEFAULT ]] ;then #if it's a bad gateway - remove it
VALUE=`odmget CuAt|grep -w $DEFAULT1|awk -F'"' '{print $2}'`
odmdelete -q "name=inet0 and value='$VALUE'" -o CuAt
BAD=1
fi
done
if [[ $BAD != 1 ]] ;then
echo "No bad routes were discovered." |tee -a $LOG #exit if nothing was changed
exit 0
fi
route -n -f |tee -a $LOG #flash all routes
echo "\nNow running bosboot.This may take a minute ..."
bosboot -a -d `lspv | grep rootvg | awk '{print $1}'|head -1`|tee -a $LOG #create bosboot
mktcpip -h $HOSTNAME -a $MYADDRESS -g $DEFAULT -i en$MYENT |tee -a $LOG #restore the good gateway
#Dsplay the new routing
echo "\ninet0 :" |tee -a $LOG
echo "`lsattr -El inet0|grep Route`" |tee -a $LOG
echo "\nnestat :" |tee -a $LOG
echo `netstat -rn|grep default`|tee -a $LOG
echo "-------------------------------------------"|tee -a $LOG
Long live king Moshiach !