I am connected to a VPS and need to route a specific application through a VPN. However, when I enable my VPN via WireGuard, my SSH connection to the VPS drops. By default, my VPN routes all traffic through itself, but I only want certain applications to use the VPN. My goal is to configure WireGuard so that only applications explicitly bound to the VPN's network interface (se-got-wg-001) will use the VPN, while others will continue using the default interface (eth0).
Below is my current WireGuard configuration:
[Interface]
PrivateKey = REDACTED
Address = 10.66.127.142/32,fc00:bbbb:bbbb:bb01::3:7f8d/128
DNS = REDACTED
[Peer]
PublicKey = REDACTED
AllowedIPs = 0.0.0.0/0,::0/0
Endpoint = REDACTED
I want these changes to persist after a reboot. What modifications should I make to ensure my system uses eth0 as the default interface, even when the VPN is enabled?
I’ve found some related posts that might help, but I’m still unclear about the steps I need to take:
- Wireguard Client With Two Interfaces - Use one Interface for Wireguard
- https://www.reddit.com/r/WireGuard/comments/npf4bp/new_to_wireguard_tips_for_routing_only_certain/
- https://serverfault.com/questions/1075973/wireguard-how-to-only-tunnel-some-of-the-traffic
- https://www.reddit.com/r/WireGuard/comments/vytuv5/is_it_possible_to_setup_wireguard_so_it_only/
Here is some information about my system:
root@vmixxx /e/wireguard# neofetch
.-/+oossssoo+/-. root@vmixxx.contaboserver.net
`:+ssssssssssssssssss+:` ---------------------------------
-+ssssssssssssssssssyyssss+- OS: Ubuntu 24.04.1 LTS x86_64
.ossssssssssssssssssdMMMNysssso. Host: KVM/QEMU (Standard PC (i440FX + PIIX, 1996) pc-i440fx-7.2)
/ssssssssssshdmmNNmmyNMMMMhssssss/ Kernel: 6.8.1-1009-realtime
+ssssssssshmydMMMMMMMNddddyssssssss+ Uptime: 2 hours, 45 mins
/sssssssshNMMMyhhyyyyhmNMMMNhssssssss/ Packages: 1813 (dpkg), 4 (snap)
.ssssssssdMMMNhsssssssssshNMMMdssssssss. Shell: fish 3.7.0
+sssshhhyNMMNyssssssssssssyNMMMysssssss+ Resolution: 800x600
ossyNMMMNyMMhsssssssssssssshmmmhssssssso CPU: AMD EPYC 7282 (4) @ 2.794GHz
ossyNMMMNyMMhsssssssssssssshmmmhssssssso GPU: 00:02.0 Vendor 1234 Device 1111
+sssshhhyNMMNyssssssssssssyNMMMysssssss+ Memory: 2630MiB / 5925MiB
.ssssssssdMMMNhsssssssssshNMMMdssssssss.
/sssssssshNMMMyhhyyyyhdNMMMNhssssssss/
+sssssssssdmydMMMMMMMMddddyssssssss+
/ssssssssssshdmNNNNmyNMMMMhssssss/
.ossssssssssssssssssdMMMNysssso.
-+sssssssssssssssssyyyssss+-
`:+ssssssssssssssssss+:`
.-/+oossssoo+/-.