Forum Discussion

jcrew's avatar
jcrew
Icon for Nimbostratus rankNimbostratus
Jul 16, 2014

irule to disable interface

Trying to come up with a work around for not having BFD implemented between LTM and router in imish. Goal is to have interface shut down if far end of interconnect becomes ICMP unreachable. If far end becomes reachable, enable interface. I'm thinking I can do this in the Linux OS with a perl script, but any thoughts would be appreciated.

 

  • Rory's avatar
    Rory
    Icon for Nimbostratus rankNimbostratus

    How often are you wanting to run this? If it's on a per minute basis you could just add a crontab with a shell script like this:

    !/bin/bash
    
    count=0
    IP_ADDR="1.2.3.4"
    
    count="`ping -c 1 $IP_ADDR | grep 'packets transmitted' | awk '{print $4 }'`"
    
    if [ $count -eq 0 ]
    then
        echo "$count packets received"
        echo "ifconfig interface1 down"
    fi
    

    Or you could make it an infinite loop with a sleep period.