OPNsense Forum

English Forums => Tutorials and FAQs => Topic started by: Himpich on November 09, 2022, 12:58:14 PM

Title: HowTo correctly setup Multi-WAN including specific custom routes?
Post by: Himpich on November 09, 2022, 12:58:14 PM
Hello,
I have to upstream providers and want to use both of them with defined target roules including a failover. My idea was:

1) Setup both gateways (gw1, gw2, they are fritzboxes), same weight
2) Create a Wan Gateway group (gwg1) with gw1 as tier 1 and gw2 as tier 2
3) create a second wan gateway group (gwg2) with gw1 as tier2 and gw2 as tier 1
4) Per default route all traffic over gwg1
5) add a rule (System/Routes  or  as pf rules with a gateway defined in Firewall/Rules/LAN (also tried Firewall/Rules/WAN) (I want to route an external nextcloud target via the second upstream)

Problem:
ALL traffic is routed via gw1 which is the tier1 gateway in gwg1
NO traffic is routed via gw2 ever. Except when I turn of gw1
I disabled sticky connections, tried the pf rules, tried system routes. Gateway switching is enabled.

What might I be doing wrong? Is there a guide how to setup multi-wan including a manual route to route via the secondary gateway?

Thanks in Advance
Title: Re: HowTo correctly setup Multi-WAN including specific custom routes?
Post by: tiermutter on November 09, 2022, 01:55:06 PM
With GW groups defined, you would like to go with policy based routing (FW rules defining the GW).
With "default allow" routed over GW1 you will need a second rule before "default allow" with GW2 defined.

Can you provide a screenshot of your ruleset? What you described should work as far as I can see...
Title: Re: HowTo correctly setup Multi-WAN including specific custom routes?
Post by: Himpich on November 09, 2022, 02:06:39 PM
First Attachment: The Gateway Groups

Second Attachment: The policy based routing rules (on the lan interface - tried the same on wan without any change)

Traffic is _always_ routed via WANGWGROUP, never REVERSE_WAN_GW_GROUP

Title: Re: HowTo correctly setup Multi-WAN including specific custom routes?
Post by: tiermutter on November 09, 2022, 02:15:31 PM
Looks good.
Sure this is v4 traffic going over the wrong GW?
Maybe it´s worth a try not to route over reverse_GW for the first time, but route directly to the other GW.
Title: Re: HowTo correctly setup Multi-WAN including specific custom routes?
Post by: tiermutter on November 09, 2022, 02:17:59 PM
What´s behind the alias "Nextcloud"? Is it configured properly?
Title: Re: HowTo correctly setup Multi-WAN including specific custom routes?
Post by: tiermutter on November 09, 2022, 02:19:14 PM
And is the rule really hit when it should?