WireGuard is an open-source VPN protocol implementation which is quickly gaining its popularity due to its speed, ease-of-use and well-designed codebase. This tutorial focuses on setting up WireGuard VPN client with NetworkManager GUI.
— Direct link
WireGuard is an open-source VPN protocol implementation which is quickly gaining its popularity due to its speed, ease-of-use and well-designed codebase. This tutorial focuses on setting up WireGuard VPN client with NetworkManager GUI.
At work I have to use a VPN connection. Currently there is set up a (so called) SSH jump-host, that only accepts connections from outside the internal/VPN network.
Problem with that: If the VPN connection is up it’s not possible to SSH to the jump-host anymore, because my local machine (with the VPN connection) has an internal IP address and is not allowed to connect to the jump-host.
I created a udev rule for the VPN interface tun0
.
That rules worke like this: Create a new route (to the jump-host) over my default network interface if the VPN connection is up and delete that rule if tun0
wents down.
And here are this udev rules for you – and myself … 🙂
root
(you can freely name the file as you want): /etc/udev/rules.d/99-tun0.rules
2.2.2.2
with the jump-host IP1.1.1.1
your local gateway IPdefault_interface
with your local/default network interface (for me it’s wlp2s0
; you can use ip addr
to see all interfaces)root
) the udev service: systemctl status udev
KERNEL=="tun0", ACTION=="add", RUN+="/sbin/ip route add 2.2.2.2 via 1.1.1.1 dev default_interface"
KERNEL=="tun0", ACTION=="remove", RUN+="/sbin/ip route delete 2.2.2.2 via 1.1.1.1 dev default_interface"
Thanks (for hints and inspiration) to