aboutsummaryrefslogtreecommitdiff
path: root/files/openvpn/create_openvpn_interface
diff options
context:
space:
mode:
Diffstat (limited to 'files/openvpn/create_openvpn_interface')
-rwxr-xr-xfiles/openvpn/create_openvpn_interface10
1 files changed, 10 insertions, 0 deletions
diff --git a/files/openvpn/create_openvpn_interface b/files/openvpn/create_openvpn_interface
new file mode 100755
index 0000000..87d9144
--- /dev/null
+++ b/files/openvpn/create_openvpn_interface
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+DEV="$1"
+SUBNET="$2"
+
+openvpn --mktun --dev "$DEV"
+ip link set dev "$DEV" txqueuelen 100
+ifconfig "$DEV" "$SUBNET".1 pointopoint "$SUBNET".2 mtu 1500
+route add -net "$SUBNET".0 netmask 255.255.255.0 gw "$SUBNET".2
+