You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
520 B
Bash

#!/usr/bin/env bash
set -euxo pipefail;
INTERFACE={{ wireguard_interface_name | quote }};
if ! ip link show dev $INTERFACE; then
ip link add dev $INTERFACE type wireguard;
else
ip link set dev $INTERFACE type wireguard;
fi
ip address add dev $INTERFACE {{ wireguard_ipv4_address | quote }}/{{ global_wireguard_ipv4_subnet | quote }};
wg setconf $INTERFACE {{ global_wireguard_configuration_directory }}/wireguard.cfg;
ip link set up dev $INTERFACE;
#ip route add {{ global_wireguard_ipv4_range }} dev $INTERFACE;