Hi,
I wrote once a silly script to do what you want with the old bonding 
driver (that didn't support autodetection of link down). It uses 
mii-diag (or whatever program you tell it) to check if the link is up or 
down, and ifconfig the interface accordingly. I checked it with the 
eepro100 driver and mii-diag against an EtherChannel capable switch a 
couple of month ago (it was kernel 2.4.10 or something like that).

Boris Kreitchman wrote:

> Hello,
> 
> Does anyone have successful experience with implementing active/backup
> setup with dual Intel EtherExpress Pro/100 ? Meaning when link goes down
> on first interface IP will be transfered to second one.
> 
> I tried bonding driver (/usr/src/linux/Documentation/networking/bonding.txt)
> and while everything configured according to that mini-howto
> (miimon=100 mode=1) nothing happends when active cable is disconnected.
> 
> Driver from Intel's site reports when link goes up and down but I don't
> see there an option to put it into active/backup mode.
> 
> Kernel is 2.4.17.
> 
> Regards,
> Boris
> 
> 
> 
> =================================================================
> To unsubscribe, send mail to [EMAIL PROTECTED] with
> the word "unsubscribe" in the message body, e.g., run the command
> echo unsubscribe | mail [EMAIL PROTECTED]
> 
> 
> 


-- 
Eran Mann                 Direct  : 972-4-9936230
Senior Software Engineer  Fax     : 972-4-9890430
Optical Access            Email   : [EMAIL PROTECTED]



#!/bin/sh

# This script monitors an ethernet interface for link status, 
# configures it down when the link is gone, and configures it 
# up when the link returns. 
# The script uses the mii-diag utility available from 
# www.scyld.com/diag/ and looks for the string "Link status: established"
# in its output, So make sure you have mii-diag in your $PATH. You can 
# change either the program or the string to look for by changing 
# $command and $string below.
#
# Usage : ifwatch.sh ifname [ period [ verbosity ] ]
# Where <ifname>  - the name of the interface to watch
#       period    - how many seconds to sleep between polls (default - 3)
#       verbosity - verbose - say the status on each poll
#                   quiet   - don't say anything

command="mii-diag"
string="Link status: established"

if [ -z "$2" ] ; then 
  export period=3
else
  export period=$2
fi

oldstate="none"

while [ 1 ]
do
  X=`$command -v $1 | grep "$string"`
  if [ ! -z "$X" ] ; then
     if [ "$3" = "verbose" ] ; then
        echo $1 up
     fi
     if [ "up" != "$oldstate" ] ; then
        oldstate="up" 
        /sbin/ifconfig $1 up 
        if [ "$3" != "quiet" ] ; then
           echo configure $1 up
        fi
     fi
  else
     if [ "$3" = "verbose" ] ; then
        echo $1 down
     fi
# Note: this down1 state is required because if sleep is too 
# short then after we ifconfig ethX up, the card could still 
# be in autonegotiation when we check it again, and then we'll
# mistakenly think the link is down.
     if [ "down1" = "$oldstate" ] ; then
        oldstate="down" 
        /sbin/ifconfig $1 down 
        if [ "$3" != "quiet" ] ; then
           echo configure $1 down
        fi
     fi
     if [ "up" = "$oldstate" ] ; then
        oldstate="down1" 
     fi
  fi
  sleep $period
done

Reply via email to