1
21.7 Legacy Series / Re: Wireguard selects wrong gateway for outbound peer connection
« on: September 07, 2021, 05:41:49 pm »In case someone else finds this post looking for a solution, I was able determine what I would call a ‘workaround’ to the issue.
The issue is when I create an OpenVPN client on OPNsense I lose control over what gateway many of the OPNsense services select for outbound connections.
I need both an active WireGuard connection to a VPS (to port forward behind a CGNat) and an OpenVPN client connection to route some OPNsense clients through. To keep WireGuard from connecting over the OpenVPN connection I did the following:
- disabled the OpenVPN client and gateway on OPNsense
- create a new Proxmox VM (a Pi or old computer would also work) with the OpenVPN connection, added masquerade and kill switch firewall rules, and added a restart script if it loses it’s connection
- created an OPNsense gateway that points to the IP of the new Proxmox VM I call ‘gateway’
Now I can route select clients and subnets through the new gateway and WireGuard makes a direct connection to the remote VPS which for me is now 4-5 times faster.
I’m happy with this solution for now. It resolves my problem, gives me more control over routing and simplifies my OPNsense configuration. I toyed with the idea of creating some static routes and that MAY have worked but I feel better about this option.