mirror of https://github.com/dadevel/wg-netns
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.
1.0 KiB
1.0 KiB
wg-netns
wg-quick for linux network namespaces. A simple python script that implements the steps described at wireguard.com/netns.
Setup
Requirements:
- Linux
- Python 3.8 or newer
ip
fromiproute2
wg
fromwireguard-tools
Just download the script and make it executable.
mkdir -p ~/.local/bin/ && curl -o ~/.local/bin/wg-netns https://raw.githubusercontent.com/dadevel/wg-netns/master/wg-netns.py && chmod 0755 ~/.local/bin/wg-netns
Usage
Instead of running wg-quick up my-vpn
run wg-netns up my-vpn
.
Now you can spawn a shell in the new network namespace.
ip netns exec my-vpn bash -i
Or connect a container to it.
podman run -it --rm --network ns:/var/run/netns/my-vpn alpine wget -O - https://ipinfo.io
You can find a wg-quick@.service
equivalent at extras/systemd/wg-netns@.service.