wireguard-setup/scripts/inner.sh
2021-02-25 13:17:46 +01:00

23 lines
550 B
Bash

#!/usr/bin/env bash
ip link add veth-inner type veth peer name veth-outer
ip link set dev veth-outer netns default
ip link set dev veth-inner master mynet0
ip link set dev veth-inner up
ip link set dev mynet0 up
ip link set dev veth-inner up
wg setconf vpn /snacks/wireguard/wg.conf
ip link set dev vpn up
ip addr flush dev vpn
ip route flush dev vpn
echo ${VPN_IPV4_ADDRESS}
echo ${VPN_IPV6_ADDRESS}
ip addr add ${VPN_IPV4_ADDRESS} dev vpn
ip addr add ${VPN_IPV6_ADDRESS} dev vpn
ip -4 route add default dev vpn
ip -6 route add default dev vpn