How to route the traffic from a wireless to wireguard

I recently installed WireGuard on my router. It works fine and all traffic are being passed through it.

However I need a requirement. My router has 3 wifi network. I would like to route the traffic from one wifi only (MyWiFi_5G) to WG and let the other two to be passed through the wan.

I'll be appreciated if anyone you can guide me on how to do it.

I'll share my configs in following screenshots.

Firewall settings

Wireless settings

Interface settings

Devices list

You need to do Policy Based Routing and you have 3 options:

  1. mwan3 package
  2. pbr package
  3. a set of rules/routes for each internet connection.

If every wifi interface is bridged in the lan network, then you can manually select the IPs which are used in the 5G wifi and route them via the wireguard tunnel. If this is not possible to achieve, then you need to create a separate network for the 5G wifi and route every packet coming in from the 5G network to the wireguard tunnel.

I think this would be the easiest options, is there any reference on how to do that?

Or you can have a single policy in pbr targeting a @wlan0-1 interface and routing over WG tunnel.

2 Likes

Better try what @stangri suggested first.

I installed PBR and I managed to route the devices based on their MAC address.
However I'm getting this error when I specify the local addresses / devices as wlan0 or wlan0-1 for example
Failed to resolve wlan0

image

image

Remember that my devices are disabled in device tab, do I need to enable them somehow to be able to use them in PBR rules?

Sorry, I missed to include @ in the device name. It doesn't show any error when using @wlan0 but the rule doesn't work.

I also applied the suggestions in this note, but the traffic is still routing through default gateway

Are you sure that wlan0 is the correct name?
In the first post we can see that radio1 is assigned to MyWifi_5G.

I tried all the wlans (0,1,0-1), but none of them is working :frowning: