Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Multi home, policy routing public segments

    Scheduled Pinned Locked Moved Routing and Multi WAN
    4 Posts 2 Posters 1.7k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C Offline
      cuteredstorm
      last edited by

      Hi all,

      First let me say that I am a big fan of pfSense and it really saved a lot of money and time in our company. We decided to give something back and are contributing to packages git.

      I have also searched the forum and tried all the tricks, but no luck.

      We are a small LIR, multi (2x) WAN and using 3 IP segments (modified for security):
      89.212.96.186/29->this segment is routable only through provider A
      193.189.169.154/29->this segment is routable only through provider B
      185.134.185.0/24->this segment is routable through both providers (using BGP).

      BGP routing works just fine. We can also send out traffic from 185.134.185.0/24 via both providers at the same time, so that's all good.

      Now once default route is set to provider A, the IP segment 193.189.169.154/29 is no longer reachable from the internet. And the other way around.
      That makes sense really, because the package comes in through provider B (as it should) but pfSense sends the response out through provider A, following the default route.

      This is a case calling for policy routing so I jump right at it. Here are the rules for 193.189.169.154/29:

      $ pfctl -sr | grep 193.189.169
      block drop in log on ! igb3 inet from 193.189.169.152/29 to any
      block drop in log inet from 193.189.169.155 to any
      block drop in log inet from 193.189.169.154 to any
      pass in log quick route-to (igb3 193.189.169.153) inet proto tcp from 193.189.169.152/29 to any flags S/SA keep state label "USER_RULE"
      

      igb3 is the interface of provider B.

      However all responses are still flowing to provider A.

      All of this was tested against IPs on the pfSense box itself using ICMP (ping) from my home. Maybe these rules only work when the traffic is flowing through another interface?

      I have checked "Disable Negate rule on policy routing rules" and "Enable default gateway switching".

      Please help.

      1 Reply Last reply Reply Quote 0
      • C Offline
        cuteredstorm
        last edited by

        Found this https://redmine.pfsense.org/issues/5476
        and this https://forum.pfsense.org/index.php?topic=102053.0

        also related
        https://forum.pfsense.org/index.php?topic=72275
        https://www.reddit.com/r/PFSENSE/comments/3rxka2/policy_based_routing_of_pfsense_internal_traffic/
        http://serverfault.com/questions/734713/pfsense-internal-traffic-policy-based-routing

        This is a bug in 2.0+ hopefully fixed in 2.3 (no reason to believe so without testing). This is a bug because docs claim it should work:
        https://doc.pfsense.org/index.php/What_are_Floating_Rules

        1 Reply Last reply Reply Quote 0
        • R Offline
          rubic
          last edited by

          You do not need floating rules in that scenario. You need to explicitly set 'IPv4 Upstream Gateway' in the igb3 settings. This will add 'reply-to' policy routing to your rules for traffic coming in through ISP B.

          For example, ping allowed on my second non-default ISP link:

          block drop in log on ! em1 inet from 188.128.123.200/30 to any
          block drop in log inet from 188.128.123.202 to any
          pass out route-to (em1 188.128.123.201) inet from 188.128.123.202 to ! 188.128.123.200/30 flags S/SA keep state allow-opts label "let out anything from firewall host itself"
          pass in quick on em1 reply-to (em1 188.128.123.201) inet proto icmp from any to 188.128.123.202 icmp-type echoreq keep state label "USER_RULE"
          
          1 Reply Last reply Reply Quote 0
          • C Offline
            cuteredstorm
            last edited by

            Hi,

            Thank you, that really opened new options for me. For anyone else looking:

            • yes, you need to explicitly specify the upstream gateway on the interface

            • this is not enough, when you have floating rules accross both interfaces (provider A and B), but want different paths. So create separate rules :)

            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.