Created
August 4, 2019 17:12
-
-
Save Belphemur/fe695a796337e33376e43f3e095bdff6 to your computer and use it in GitHub Desktop.
Wirguard with Network Namespace
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
CONFIG=/etc/wireguard/wg1.conf | |
DEVICE=wg1 | |
IP="10.11.1.115/16" | |
ip netns add vpn | |
ip link add $DEVICE type wireguard | |
wg setconf $DEVICE $CONFIG | |
ip link set $DEVICE netns vpn | |
ip netns exec vpn ip addr add $IP dev $DEVICE | |
ip netns exec vpn ip link set $DEVICE up | |
ip netns exec vpn ip route add default dev $DEVICE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment