Skip to content

Instantly share code, notes, and snippets.

@juddgaddie
Created June 7, 2020 17:42
Show Gist options
  • Save juddgaddie/76ccae72cf0216c3aa75f71395468c45 to your computer and use it in GitHub Desktop.
Save juddgaddie/76ccae72cf0216c3aa75f71395468c45 to your computer and use it in GitHub Desktop.
Setting up wireguard in a specific VRF and adding a route. Works with Cumulus Linux
#!/bin/bash
#to enable debugging
#echo module wireguard +p > /sys/kernel/debug/dynamic_debug/control
ip rule add fwmark 1001 iif lo priority 4999 table mgmt
ip link add dev wg0 type wireguard
ip -4 address add 10.1.50.43/16 dev wg0
wg setconf wg0 <(wg-quick strip /etc/wireguard/wg0.conf)
wg set wg0 fwmark 1001
ip link set up dev wg0
ip link set dev wg0 master mgmt
ip route add table mgmt 10.2.0.0/16 via 10.1.0.1 dev wg0
wg show wg0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment