Using floating rules to set gateway (group)



  • I have the following setup:

    • WAN 1 with GW 1

    • WAN 2 with GW 2

    • Gateway group "Failover" with GW2 in Tier1 and GW1 in Tier2

    • LAN 1

    • LAN 2

    • LAN 3

    GW2 is the default gateway. I'm trying to configure the following rules in the less error-prone way:

    • All traffic from LAN 1 and LAN 2 should use the "Failover" gateway group

    • All traffic from LAN 3 must always use GW1

    It works when i set

    | Source | Destination | Gateway |
    | LAN 1 | * | Failover |
    | LAN 2 | * | Failover |
    | LAN 3 | * | GW1 |

    Unfortunately, i don't have simple "Pass all" rules - there are 10-20 rules per interface, which can lead to errors if either the Failover gateway isn't set on LAN1 / LAN2 (traffic would not fail over) or GW1 isn't set on LAN3 (traffic would leave the wrong interface).

    I tried to use floating rules to set the gateway in this way:

    | Interfaces | Direction | Action | Gateway |
    | LAN1, LAN2 | in | Match | Failover |
    | LAN3 | in | Match | GW1 |

    leaving the Pass actions on the interface pages. However, this does not work as expected. It seems that the "default" gateway option on the Pass rules in the interface tabs do set the gateway using the systems routing table and not "use whatever been set before or use the system routing table".

    Is there another way to set the gateway without specifying it on every rule?



  • Unfortunately, i don't have simple "Pass all" rules - there are 10-20 rules per interface, which can lead to errors if either the Failover gateway isn't set on LAN1 / LAN2 (traffic would not fail over) or GW1 isn't set on LAN3 (traffic would leave the wrong interface).

    nobody that uses pfsense in a non-home environment has "simple PASS all" rules ….
    what kind of difficulty do you have that allow for errors ?
    the easiest way to prevent stuff like that is to put you pass rules (with GW) at the bottom, and all the block rules above them.

    I tried to use floating rules to set the gateway in this way

    you probably could do that if you really wanted to …. looks like swatting a fly with a bulldozer to me.
    if you still wanted to go that route, i guess you have to do it on WAN-interface with direction out


  • Netgate

    Unfortunately, i don't have simple "Pass all" rules - there are 10-20 rules per interface, which can lead to errors if either the Failover gateway isn't set on LAN1 / LAN2 (traffic would not fail over) or GW1 isn't set on LAN3 (traffic would leave the wrong interface).

    Make your rules correct and it'll work.  It's probably easier and less error-prone to have everything related to traffic from a LAN interface in one place than to have it in multiple places.