1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-vps.git synced 2025-02-12 11:21:56 +00:00
openmptcprouter-vps/omr-6in4-run
Ycarus (Yannick Chabanois) 5b8b41326e Latest VPS script updates
2020-04-21 19:27:56 +02:00

23 lines
584 B
Bash
Executable file

#!/bin/sh
set -e
if [ ! -f "$2" ]; then
echo "usage: $(basename "$0") FILE"
exit 1
fi
. "$(readlink -f "$2")"
DEV="omr-6in4-$(basename "$2")"
if [ "$1" = "start" ]; then
[ -n "$(ip tunnel show ${DEV})" ] && ip tunnel del ${DEV} 2>&1 >/dev/null
ip tunnel add ${DEV} mode sit remote ${REMOTEIP} local ${LOCALIP}
ip -6 addr add ${LOCALIP6} dev ${DEV}
ip link set ${DEV} up
[ -n "$ULA" ] && ip route replace ${ULA} via $(echo ${REMOTEIP6} | cut -d/ -f1) dev ${DEV}
fi
if [ "$1" = "stop" ]; then
ip tunnel del ${DEV}
fi