Routing/NATing certain networks through VPN

Started by gtech1, July 07, 2024, 06:25:43 PM

Previous topic - Next topic
Here's what I have done/got working so far:

1. connected to remove vpn server using openvpn
2. added a route for my wanted network to go through the vpn: route add 1.2.3.4/24 10.8.0.5

this works. I can ping the remote network from the OPNSense box

now I want to do the same with the clients sitting behind OPNSense

I setup an outbound NAT rule that says all traffic through the openvpn interface to be natted.
This *works* except it NATs ALL traffic, not just traffic for 1.2.3.4/24

Is there a way to do this without having to specify all my wanted networks in the NAT rules ?

I want only traffic through the OpenVPN interface to be natted

Did you put the outbound NAT rule on the OpenVPN interface?
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

Thank you, that was indeed the issue! I had done it on the the VPN name interface I created not just 'OpenVPN'. Once I changed the source, bam, it worked - you rock!