#! /bin/sh #---------------------------------------------------------------------------- # /etc/rc.d/ip-eth - ip configuration of ethernet cards # # Creation: 04.02.2001 fm # Last Update: 20.07.2003 fm # # Copyright (c) 2001-2003 Frank Meyer # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. #---------------------------------------------------------------------------- . /etc/config.d/base if [ "$IP_ETH_DO_DEBUG" = yes ] then set -x fi case $1 in start) /usr/local/bin/colecho "configuring ip on ethernet cards ..." gn idx0=0 idx=1 while [ "$idx" -le "$IP_ETH_N" ] do eval name='$IP_ETH_'$idx'_NAME' eval ipaddr='$IP_ETH_'$idx'_IPADDR' eval network='$IP_ETH_'$idx'_NETWORK' eval netmask='$IP_ETH_'$idx'_NETMASK' broadcast=`/usr/local/bin/netcalc broadcast $network $netmask` if [ "$name" = "" ] then name=eth$idx0 fi if [ "$ipaddr" != "" -a "$ipaddr" != "0.0.0.0" ] then # if no ip address, skip configuration ifconfig $name $ipaddr netmask $netmask broadcast $broadcast fi idx0=$idx idx=`/usr/bin/expr $idx + 1` done ;; stop) /usr/local/bin/colecho "shutting down ip on ethernet cards ..." gn echo "Network is going down now!" | /usr/bin/wall idx0=0 idx=1 while [ "$idx" -le "$IP_ETH_N" ] do eval name='$IP_ETH_'$idx'_NAME' if [ "$name" = "" ] then name=eth$idx0 fi ifconfig $name down idx0=$idx idx=`/usr/bin/expr $idx + 1` done ;; esac set +x