Skip to content

Commit

Permalink
added support for routes
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthiasLohr committed Sep 12, 2018
1 parent 6f81dc0 commit c857d8c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions f5fpc-vpn.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,25 +86,39 @@ start_gateway() {
exit 1
fi
docker exec -it "$CONTAINER_NAME" /opt/connect.sh
dockerip=`docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $CONTAINER_NAME`
for network in ${NETWORKS[@]} ; do
ip route add $network via $dockerip
done
observe_f5fpc
}

stop_vpn() {
echo "Shutting down..."
dockerip=`docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $CONTAINER_NAME`
for network in ${NETWORKS[@]} ; do
ip route del $network via $dockerip
done
docker exec "$CONTAINER_NAME" /usr/local/bin/f5fpc -o > /dev/null
docker stop "$CONTAINER_NAME"
exit
}

# read CLI parameters
POSITIONAL=()
NETWORKS=()
while [ $# -gt 0 ] ; do
case $1 in
-h|--help)
show_help
exit
shift
;;
-n|--network)
NETWORKS+=("$2")
shift
shift
;;
*)
POSITIONAL+=("$1")
shift
Expand Down

0 comments on commit c857d8c

Please sign in to comment.