Skip to content

Instantly share code, notes, and snippets.

@rkoshy
Last active June 12, 2022 21:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rkoshy/c88198916e82634e2fd020cc125fd571 to your computer and use it in GitHub Desktop.
Save rkoshy/c88198916e82634e2fd020cc125fd571 to your computer and use it in GitHub Desktop.
Script to reset VyOS VTI interfaces that are stuck in "Administrative Down".
#!/bin/bash
RUN=/opt/vyatta/bin/vyatta-op-cmd-wrapper
DOWN=`$RUN sh interfaces |grep "A/D"|awk '{print $1}'`
echo Interfaces that need resetting: $DOWN
for TUN in $DOWN
do
PEER=`$RUN sh interfaces vti $TUN |grep peer|sed -e"s/.* peer \([0-9\.]*\)/\1/"`
logger -t "reset_vti.sh" "Resetting $TUN with peer IP $PEER"
$RUN reset vpn ipsec-peer $PEER
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment