#! /bin/sh #---------------------------------------------------------------------------- # /etc/rc.d/ip-eth - ip configuration of ethernet cards # # Creation : 2001-02-04 fm # Last Update: $Id$ # # Copyright (c) 2001-2012 the eisfair team, team(at)eisfair(dot)org # # 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 . /etc/init.d/functions if [ "$IP_ETH_DO_DEBUG" = yes ] then set -x fi case $1 in start) boot_mesg " * Configuring ip on ethernet cards ..." 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 evaluate_retval ;; stop) boot_mesg " * Shutting down ip on ethernet cards ..." 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 evaluate_retval ;; esac set +x