Mal Herring wrote:
> Hi List,
> Been looking on forums.gentoo.org looking for a way to pair two NIC's so
> that should the primary fail, the secondary takes over...
> 
> The situation is this:
> 
> 8 HP DL380G4's all running Gentoo moving into a data centre rack, the
> firewall is currently a Netscreen(Juniper) 25 and another will be added
> to give us Active/Passive failover on the firewalls.
> 
> Redundant switches will be added behind the firewalls to ensure that is
> not a single point of failure, all the DL380 have two NIC's in them and
> currently only one is active.
> 
> All boxes covered with HP on a 24x7x4 Carepaq, redundant power supplies
> to be added - DC is a N+1 so fine there...
> 
> Biggest issue I am facing and becoming lost on is teaming the NIC's so I
> can connect NIC1 to Switch 1 and NIC2 to switch 2 etc...
> 
> Can anyone help ?
> 
> Ta
> 
> Mal
> 
rather dirty but what about put this script in a "*/5" minutes cron ?

------- check_connectivity --------
#! /bin/sh

# counter of failed ping
FAILED_PING=0

# after how much time the script is forced to exit
# warning %s is a gnu extension to date
STOP_TIME=$(( $(date +%s) + 300 -2 ))

# host used for chech
REACHABLE_HOSTS="192.168.1.123 192.168.1.124"

# seconds to wait before to switch (approx)
# left operand = tentatives
# right operand = no of hosts in REACHABLE_HOSTS
TTW=$(( 5 * 2 ))

# if this become "1" call houston
SWITCHED=0

PING_CMD="arping -c1 -Ieth0 -w1 -q"


while [[ "$(date +%s)" -lt "${STOP_TIME}" ]] && [[ ${SWITCHED} -eq 0 ]]
do
        for host in ${REACHABLE_HOSTS}
        do
                if ($PING_CMD $host) ; then
                        FAILED_PING=1
                else
                        FAILED_PING=$(( FAILED_PING + 1 ))
                fi
        done

        if [[ ${FAILED_PING} -gt ${TTW} ]] ; then
                SWITCHED=1
                # put the replace interface fx here
                echo "switch_interface"
        fi
        sleep 1
done
------- check_connectivity --------

Still todo are:
-  the switch_interface() interface function something like relink
   /etc/conf.d/net and restart the net
- the "return to normality" script that once eth0 work again for some
  seconds switch back
- A lock that prevent the script to start if the interface is switched
  (and instead run the check for "normal" status)
- a mail to the admin

P.S. has never checked in real life, do your checks before to use it

Cheers,
Francesco R.
-- 
gentoo-user@gentoo.org mailing list

Reply via email to