32 lines
613 B
Bash
32 lines
613 B
Bash
|
#!/usr/bin/env bash
|
||
|
wg setconf vpn /snacks/wireguard/wg.conf
|
||
|
ip link set dev vpn up
|
||
|
ip addr flush dev vpn
|
||
|
ip route flush dev vpn
|
||
|
|
||
|
echo "-- <start> inner_basic.sh --"
|
||
|
|
||
|
echo "VPN_IPV4_ADDRESS=${VPN_IPV4_ADDRESS}"
|
||
|
echo "VPN_IPV6_ADDRESS=${VPN_IPV6_ADDRESS}"
|
||
|
|
||
|
echo "-- <end> inner_basic.sh --"
|
||
|
if [ -z "${VPN_IPV4_ADDRESS}" ]
|
||
|
then
|
||
|
ip addr add ${VPN_IPV4_ADDRESS} dev vpn
|
||
|
fi
|
||
|
|
||
|
if [ -z "${VPN_IPV6_ADDRESS}" ]
|
||
|
then
|
||
|
ip addr add ${VPN_IPV6_ADDRESS} dev vpn
|
||
|
fi
|
||
|
|
||
|
if [ -z "${VPN_IPV4_ADDRESS}" ]
|
||
|
then
|
||
|
ip -4 route add default dev vpn
|
||
|
fi
|
||
|
|
||
|
if [ -z "${VPN_IPV6_ADDRESS}" ]
|
||
|
then
|
||
|
ip -6 route add default dev vpn
|
||
|
fi
|