Skip to content

Instantly share code, notes, and snippets.

@mariotpc
Forked from juddgaddie/wg-speedy.sh
Created February 8, 2023 14:38
Show Gist options
  • Save mariotpc/c5f2ccf8563cdfcfd6e28d4cb80814cb to your computer and use it in GitHub Desktop.
Save mariotpc/c5f2ccf8563cdfcfd6e28d4cb80814cb 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