Figure 2: How the Alias IP is added
sub AddAlias{
open(IFCONFIG,"$IFCONFIG -a|");
@IFCONFIG=<IFCONFIG>;
close IFCONFIG;
# Check to make sure if the alias is already binded.
# Return if binded.
return if ( grep(/$ALIAS_IP/,@IFCONFIG) );
# Solaris systems must use the plumb command to create the
# interface.
if ( $OS eq "SunOS" ){
`$IFCONFIG $INTERFACE plumb';
}
`$IFCONFIG $INTERFACE $ALIAS_IP netmask $ALIAS_NETMASK';
`$IFCONFIG $INTERFACE up';
if ( $? == 0 ){
&DisplayLogMessage("Alias $ALIAS_IP was successfully added \
to interface $INTERF ACE.");
}else{
&DisplayLogMessage("ERROR!! Was unable to add $ALIAS_IP to \
interface $INTERFACE .");
}
}
|