wireguard-setup/scripts/inner.sh

23 lines
550 B
Bash
Raw Normal View History

2021-02-25 12:17:46 +00:00
#!/usr/bin/env bash
2021-02-25 10:19:46 +00:00
ip link add veth-inner type veth peer name veth-outer
2021-02-25 12:17:46 +00:00
ip link set dev veth-outer netns default
2021-02-25 10:19:46 +00:00
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
2021-02-25 12:17:46 +00:00
echo ${VPN_IPV4_ADDRESS}
echo ${VPN_IPV6_ADDRESS}
2021-02-25 10:19:46 +00:00
ip addr add ${VPN_IPV4_ADDRESS} dev vpn
ip addr add ${VPN_IPV6_ADDRESS} dev vpn
2021-02-25 12:17:46 +00:00
2021-02-25 10:19:46 +00:00
ip -4 route add default dev vpn
ip -6 route add default dev vpn