#!/bin/bash | |
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
source ../multi-host.conf | |
# linkfail.sh fail|recover end1 end2 | |
ACT=$1 | |
END1=$2 | |
END2=$3 | |
CTRLVAR1='CTRL_'${END1:0:1} | |
CTRLVAR2='CTRL_'${END2:0:1} | |
IP4VAR1='IP4_'$END1 | |
IP4VAR2='IP4_'$END2 | |
CMD='-D' | |
if [[ $ACT == 'fail' ]] | |
then | |
CMD='-I' | |
fi | |
ssh ${!CTRLVAR1} "sudo iptables $CMD INPUT -s ${!IP4VAR2}/32 -p udp --dport 6363 -j DROP" | |
ssh ${!CTRLVAR2} "sudo iptables $CMD INPUT -s ${!IP4VAR1}/32 -p udp --dport 6363 -j DROP" | |