diff --git a/vpn/tinc/tinc-up b/vpn/tinc/tinc-up index 629f4ef..42959f1 100644 --- a/vpn/tinc/tinc-up +++ b/vpn/tinc/tinc-up @@ -1,13 +1,14 @@ #!/bin/sh -IP="10.127.x.x" +IP="" +PEER="" -case `uname` in +case "`uname`" in Linux) - ip link set $INTERFACE up - ip addr add "$IP" dev $INTERFACE + ip link set "$INTERFACE" up + ip addr add "$IP" peer "$PEER" dev "$INTERFACE" ;; *BSD) - ifconfig $INTERFACE "$IP" + ifconfig "$INTERFACE" "$IP" "$PEER" ;; esac diff --git a/vpn/wg-postup.sh b/vpn/wg-postup.sh new file mode 100644 index 0000000..36f14df --- /dev/null +++ b/vpn/wg-postup.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +IF="$1" +LOCAL_IP="$2" +PEER_IP="$3" +LOCAL_IPV6="$4" +PEER_IPV6="$5" + +ip addr del "$LOCAL_IP" dev "$IF" +ip addr add "$LOCAL_IP" peer "$PEER_IP" dev "$IF" +ip addr del "$LOCAL_IPV6" +ip addr add "$LOCAL_IPV6" peer "$PEER_IPV6" dev "$IF" diff --git a/vpn/wireguard.conf b/vpn/wireguard.conf index 6ed90bd..2edcc00 100644 --- a/vpn/wireguard.conf +++ b/vpn/wireguard.conf @@ -1,6 +1,6 @@ [Interface] Address = 10.127.x.x/32, fd80::/32 -PostUp = /path/to/wg-postup.sh 10.127.x.x/32 fd80::/32 +PostUp = /path/to/wg-postup.sh 10.127.x.x/32 fd80::/32 # Custom DNS #DNS = 127.0.0.1 # Set MTU to 1412 if using PPP