OPNsense Forum

Archive => 24.1, 24.4 Legacy Series => Topic started by: gtech1 on July 07, 2024, 06:25:43 PM

Title: Routing/NATing certain networks through VPN
Post by: gtech1 on July 07, 2024, 06:25:43 PM
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
Title: Re: Routing/NATing certain networks through VPN
Post by: Patrick M. Hausen on July 07, 2024, 06:38:56 PM
Did you put the outbound NAT rule on the OpenVPN interface?
Title: Re: Routing/NATing certain networks through VPN
Post by: gtech1 on July 08, 2024, 04:34:25 AM
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!