summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/sample/wg_tunnel/run.sh
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/tcpip/sample/wg_tunnel/run.sh')
-rwxr-xr-xpkg/tcpip/sample/wg_tunnel/run.sh34
1 files changed, 34 insertions, 0 deletions
diff --git a/pkg/tcpip/sample/wg_tunnel/run.sh b/pkg/tcpip/sample/wg_tunnel/run.sh
new file mode 100755
index 000000000..7b5bf0524
--- /dev/null
+++ b/pkg/tcpip/sample/wg_tunnel/run.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+usage() {
+ echo "$0 [-6] [-tap] -dev <dev>"
+ exit
+}
+
+IPV6=0
+OPTS=
+DEV=
+
+while [ $# -gt 0 ]; do
+ case $1 in
+ -4) IPV6=0;;
+ -6) IPV6=1;;
+ -tap) OPTS="$OPTS -tap";;
+ -dev) DEV="$2"; shift;;
+ *) usage;;
+ esac
+
+ shift
+done
+
+if [ -z "$DEV" ]; then
+ usage
+fi
+
+if [ $IPV6 -eq 1 ]; then
+ OPTS="$OPTS $DEV 2001:470:de6f:5311::2/64 10003 2001:470:de6f:5312::1/64 2001:470:de6f:5311::1"
+else
+ OPTS="$OPTS $DEV 10.1.1.2/24 10003 10.1.2.1/24 10.1.1.1"
+fi
+
+exec ./wg_tunnel $OPTS