Route some clients through Openvpn

Hi, I a going through different openvpn guides and they all seem to be configuring VPN for all devices on the network. Is there a way to configure it such that only some devices are forced through it and the rest are bypassing?
And another question : is there a way to setup multiple instances of openvpn connected to different providers and then selectively route some client through one and others through another VPN instance?

You may find this thread very helpful: Use WireGuard interface for specific devices only

There is a post describing how to add 2 lines to your startup script and make a minor change to DHCP. It will setup some hosts in your LAN to use another interface and outbound route.

Thx for the advice, but have to use openvpn in this case. Is selective routing possible?

A simple search of this forum yields policy based routing.

1 Like

Yes, you can use policy-based routing with OpenVPN.

From: Use WireGuard interface for specific devices only

You want your router to use 2 separate default routes…that’s easily done via policy-based routing on Linux systems.

Thank you. Now that I know what it is called, I know what to search for.

Hi, I achieved this by creating different SSID (and relative network with different subnet mask) and different VPN profiles, each in a different firewall zone. Then I set up different forward rules so that clients on each SSID are routed to one of the VPN connections.

An interesting idea, but having a lot of SSID's slows down the access point...

The SSIDs are per VPN not per client. So you'll have VPN1 profile and WVPN1 SSID, VPN2 profile and WVPN2 SSID and so on. All the clients that must run through VPN1 must connect to WVPN1, all of them that must pass through VPN2 should connect to WVPN2 and so on. The bandwidth of the AP will be shared through the total clients connected to the AP, with little overlap.
But sure if you have a lot of different VPN profiles the bandwidth of your WAN also will be shared though your VPN connections, and I think the WAN speed is normally slower than that of the AP. :slightly_smiling_face:

But you could also set static DHCP lease for just the devices that must pass through VPNs and create forward rules for their IPs.:+1: