Wireguard traffic through Wan

HI,

I use wg and pbr and in the moment everything goes to wg, but now I have just few devices which need wg so I would prefer traffic trough wan and use pbr to add some devices to wg. I thought I had only to unchecked the route allowed ips, but it seems to does not work.

Did you tryed with net.ipv4.conf.wg0.rp_filter = 2 in /etc/sysctl.conf ?

no I have no idea what it is :wink:

I added it, it seems to be the same. I try to choose ''wan'' instead of '''torguard wg'' as default route?

1 Like

image

where is the Use default gateway ??

wan interface

1 Like

You cannot choose that. It displays the default gateway that has top priority in the main routing table.
But this doesn't matter too much you can add a rule to route a few devices via VPN and then another rule to route everything via the WAN.

1 Like

Yes in the pbr

Been almost a year since using PBR @trendy, so I don't know for fact this next statement.

Could one put a metric on the wan interface and then just execute ifdown wg0

after ifdown wg0 I got the traffic on wan but it is not really what I wanted, cause when I restart wg0, the default is back on wg

tor

Yes, you can set a higher metric in the wg0 interface, then do a ifup wg0 and it will come up with default in PRB the wan.

1 Like

We are going to need you to assign static address "reserved address" for the devices you only want on wan.

Then we can help you build assign these devices to a table lookup and put it on the wan metric.

wg0 stays default route and the simple lookup table will send the exceptions to the wan interface.

I don't want to sound antagonistic to PBR, but it is not needed if you do a lookup table and metric.

but pbr seems to be easier to setup, right?

Easy? Have you got it working?

pbr? yes, it is working well, but all my devices on pbr are on WAN except 3. So I wanted to do the inverse but it is not a big deal

Great you've achieved PBR making wan the default route correct?

You've got some devices that you need on wg0 correct?

PBR has a huge README and scenarios.
Where do the scenarios not fit in your easy lan?

not, still on wg0, the default route goes on ''wan'' only if I do ifdown wg0 but I dont want to stop my wg

I mentioned how to fix that here.

1 Like