Multiple SSIDs leading to local internet and different vpns

Hardware is an OpenWrt One with release 25.211.x
eth1 (wan)
IP 192.168.2.x (DHCP)
DNS 192.168.2.1
Gateway 192.168.2.1
Subnet 255.255.255.0
phy0 (2.4GHz) and phy1 (5GHz) have the same SSIDs setup
SSID#0 MyInternet
SSID#1 MyVPN1
SSID#2 MyVPN2

What I did so far:

  • setting up two openvpn clients and two vpn interfaces vpn0 and vpn1 that are linked to tun0 and tun1
  • setting up the ssids and creating interfaces wifi0, wifi1 and wifi2 with static IP and DHCP Server using 192.100.0.x / 192.100.1.x / 192.100.2.x. Connecting to one of the SSIDs seems to get me an IP (as I added a Traffic Rule to the firewall to allow 67/UDP)

First attempt was bridging
br0: eth1 wifi0
br1: vpn1 wifi1
br2: vpn2 wifi2
On the wifi0/1/2 i tried to setup a gateway and a dns
=> could not get it to work
=> played with firewall zones
=> no luck

Second attempt was not briding but trying to route.
this ended up in reaching local network from everywhere, probably the public ips.
So i cancelled it

I am unsure which way to go - pbr seems to be the best choice...

I would be glad to receive some LUCIE based tutorial on how to set this up. My knowledge is simple routing of IP4 - no idea of IP6 (which is btw active and I dint care, probably I should disable it for wifi1/2 and vpn1/2 ? I lack understanding how to apply pbr an reading the tutorials I found so far pretty much confused me even more - furthermore I habe no understading of firewall zones, as I used to work with iptable in past.

Thanks for Your help!

Without PBR app:

#in /etc/config/network

config route
        option target '0.0.0.0/0'
        option interface 'vpn1'
        option table '1'

config rule
        option in 'wifi1'
        option dest '0.0.0.0/0'
        option priority '1'
        option lookup '1' #table no in route

config route
        option target '0.0.0.0/0'
        option interface 'vpn2'
        option table '2'

config rule
        option in 'wifi2'
        option dest '0.0.0.0/0'
        option priority '2'
        option lookup '2' #table no in route

Browse to:

Network > Routing

You'll see the IPv4 Static Routes and IPv4 Rules tabs.

2 Likes

These are not allowed to use as private subnets, you should use 192.168.X.X

My notes how to setup with PBR netifd which basically is an elaboration of the post of @lleachii:
OpenWRT Policy Based Routing (PBR)

But you could also install the Full PBR app, reference in my notes

2 Likes

Thank You @lleachii and @egc.

1 Like