OpenVPN Redirect Gateway - Option from Client

Started by Heathy65, November 05, 2017, 11:23:00 PM

Previous topic - Next topic
I have OpenVPN on OPNsense installed and working with the Redirect Gateway option enabled in the server so all traffic from my clients (iPhone & Mac) is routed via the VPN connection.  This is what I want when I'm connected to public Wi-Fi services etc.  However I have another use case when I just want specific traffic to route via the VPN and other "Internet" traffic not not do this.

Is there any way to set this from the client side (I'm using the OpenVPN client on my iPhone & Viscosity on my Mac).  I'm sure I could achieve this "manually" on Mac by manipulating the routing table but not on the iPhone?

One messy/alternative solution I thought of is having two OpenVPN servers configured on OPNsense, one configured each way.

Quote from: Heathy65 on November 05, 2017, 11:23:00 PM
One messy/alternative solution I thought of is having two OpenVPN servers configured on OPNsense, one configured each way.

Not sure why that is messy?  Thats exactly what I would do. 

you can eithter only set the redirect gateway option on "client specific overrides" or remove the redirect gateway in the client ovpn file with

route 0.0.0.0 192.0.0.0 net_gateway
route 64.0.0.0 192.0.0.0 net_gateway
route 128.0.0.0 192.0.0.0 net_gateway
route 192.0.0.0 192.0.0.0 net_gateway

https://community.openvpn.net/openvpn/wiki/IgnoreRedirectGateway

May 23, 2018, 02:39:48 PM #3 Last Edit: May 23, 2018, 02:44:44 PM by sofien
were you been able to fix you concern?

Were you be able to forward all traffic through your tunnel? did you find a way to indicate which traffic need to goes through the vpn?
Quote from: Heathy65 on November 05, 2017, 11:23:00 PM
I have OpenVPN on OPNsense installed and working with the Redirect Gateway option enabled in the server so all traffic from my clients (iPhone & Mac) is routed via the VPN connection.  This is what I want when I'm connected to public Wi-Fi services etc.  However I have another use case when I just want specific traffic to route via the VPN and other "Internet" traffic not not do this.

Is there any way to set this from the client side (I'm using the OpenVPN client on my iPhone & Viscosity on my Mac).  I'm sure I could achieve this "manually" on Mac by manipulating the routing table but not on the iPhone?

One messy/alternative solution I thought of is having two OpenVPN servers configured on OPNsense, one configured each way.