wireguard-setup/scripts/inner_basic.sh

33 lines
611 B
Bash
Raw Permalink Normal View History

2024-02-07 21:55:12 +00:00
#!/usr/bin/env bash
2024-02-10 17:00:45 +00:00
wg setconf vpn /run/vpnclient/wg.conf
2024-02-07 21:55:12 +00:00
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 --"
2024-02-07 22:57:52 +00:00
if [ -n "${VPN_IPV4_ADDRESS}" ]
2024-02-07 21:55:12 +00:00
then
ip addr add ${VPN_IPV4_ADDRESS} dev vpn
fi
2024-02-07 22:57:52 +00:00
if [ -n "${VPN_IPV6_ADDRESS}" ]
2024-02-07 21:55:12 +00:00
then
ip addr add ${VPN_IPV6_ADDRESS} dev vpn
fi
2024-02-07 22:57:52 +00:00
if [ -n "${VPN_IPV4_ADDRESS}" ]
2024-02-07 21:55:12 +00:00
then
ip -4 route add default dev vpn
fi
2024-02-07 22:57:52 +00:00
if [ -n "${VPN_IPV6_ADDRESS}" ]
2024-02-07 21:55:12 +00:00
then
ip -6 route add default dev vpn
fi