Quantcast
Channel: All EdgeRouter posts
Viewing all articles
Browse latest Browse all 60861

Re: Routing locally originated traffic after failover in 1.9.0

$
0
0

The updated script seems to be working very well even of multiple flip-flops.

 

#!/bin/bash

GROUP=$1
INTF=$2
STATUS=$3

MYLOG="/var/log/wlb"
TS=$(date +"%Y%m%d-%T")

run=/opt/vyatta/bin/vyatta-op-cmd-wrapper
INTFDSCR=$($run show interfaces | grep $INTF | awk '{print $4}')

/usr/sbin/conntrack -F
#Following not needed in 1.9.1beta2
#/usr/sbin/ubnt-add-connected.pl case "$STATUS" in active) msg="$TS: Internet connection $GROUP:$INTF:$INTFDSCR is active." # Change eth1 to shortest distance ... fix local routing if [ $INTF = "eth1" ]; then vtysh -c "ip route 0.0.0.0/0 172.16.16.1 5"; fi # Email sysadmin when interface becomes active echo -e "$msg\n\n$(uptime)\n\nLast 10 fail-over evets\n$(grep wlb: /var/log/messages|tail -n 10)" \ | mailx -r "***@tekux.com" \ -s "Router $(hostname) WAN fail-over event" \ -S smtp="smtp.gmail.com:587" \ -S smtp-use-starttls \ -S smtp-auth=login \ -S smtp-auth-user="***@tekux.com" \ -S smtp-auth-password="***" \ -S ssl-verify=ignore ***@tekux.com ;; inactive) msg="$TS: Internet connection $GROUP:$INTF:$INTFDSCR is inactive." ;; failover) msg="$TS: Internet connection $GROUP:$INTF:$INTFDSCR is failover." # Change eth1 to longest distance ... fix local routing if [ $INTF = "eth1" ]; then vtysh -c "ip route 0.0.0.0/0 172.16.16.1 20"; fi
;; *) msg="$TS: Oh crap, $GROUP:$INTF:$INTFDSCR going [$STATUS]" ;; esac echo $msg >> $MYLOG logger $msg exit 0

 


Viewing all articles
Browse latest Browse all 60861

Trending Articles