LinuxSA Mailing list archives

Index: [thread] [date] [subject] [author] [stats]
  From: Anthony Symons <ant@sa.pracom.com.au>
  To  : <linuxsa@linuxsa.org.au>
  Date: 23 Nov 2001 16:13:16 +1030

Re: Routing - Best Practices

On Fri, 2001-11-23 at 15:39, Dale Long wrote:
> On this topic, does Linux have any elegant solution to provide
redundant
> network card functionality? For example, the main NIC fails, the
secondary
> NIC takes on the ip details and MAC address of the failed card
> automatically.

You could have a script do it easy enough, provided you could reliably
work out if it is your netcard thats at fault and not the cable, or the
switch, or something unrelated. 

Basic, untested, from the top of my head, lauch from end of /etc/rc.d
like:

nohup netcheck &



#!/bin/bash

while [ 1 ] ; do 

        ifconfig |grep eth0 --OR-- ping otherhost -c 1

        if [ $? != 0 ] ; then
                ifdown eth0
                ifup eth1
        
                echo -e
"to:admin@wherever.org\nfrom:network@`hostname`\nsubject:network card
fail over\n\nNetwork has switched interfaces to eth1 on host `hostname`"
| sendmail -t

        fi
done
On Fri, 2001-11-23 at 15:39, Dale Long wrote:
> On this topic, does Linux have any elegant solution to provide
redundant
> network card functionality? For example, the main NIC fails, the
secondary
> NIC takes on the ip details and MAC address of the failed card
> automatically.

You could have a script do it easy enough, provided you could reliably
work out if it is your netcard thats at fault and not the cable, or the
switch, or something unrelated. 

Basic, untested, crude, from the top of my head :) I probably should
test this, but its mainly just for someone to use as a starting point. 

lauch from end of /etc/rc.d/rc.local like:

nohup netcheck.sh &

#!/bin/bash

DEVICE1=eth0
DEVICE2=eth1

while [ 1 ] ; do 

        ifconfig |grep $DEVICE1 --OR-- ping otherhost -c 1

	# check return code
        if [ $? != 0 ] ; then
		ifdown $DEVICE1
                ifup $DEVICE2

		#swap order of devices, so that if its not the net card at fault
you'll still have redundancy.
		DEVTEMP=$DEVICE1
		DEVICE1=$DEVICE2
		DEVICE2=$DEVTEMP   

		#alert a human to check it out     
                echo -e
"to:admin@wherever.org\nfrom:network@`hostname`\nsubject:network card
fail over\n\nNetwork has switched interfaces to eth1 on host `hostname`"
| sendmail -t

        fi

	#dont need to check constantly and waste huge system resources, 1ce per
min should do
	sleep 1m
done

-- 
Systems Administrator       
Pracom Ltd.             
+61 8 82029074 -=- +61 402 100 671 
anthony.symons@sa.pracom.com.au

PRIVILEGED - PRIVATE AND CONFIDENTIAL
This electronic mail is solely for the use of the addressee and may
contain information which is confidential or privileged.
If you receive this electronic mail in error, please delete it from
your system immediately and notify the sender by electronic mail or
using any of the above contact details.

-- 
LinuxSA WWW: http://www.linuxsa.org.au/  IRC: #linuxsa on irc.linux.org.au
To unsubscribe from the LinuxSA list:
  mail linuxsa-request@linuxsa.org.au with "unsubscribe" as the subject


Index: [thread] [date] [subject] [author] [stats]
Return to the LinuxSA Mailing List Information Page