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

Policy based routing

Scheduled Pinned Locked Moved General pfSense Questions
13 Posts 5 Posters 988 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.
  • J
    jeremyj
    last edited by jeremyj Nov 29, 2022, 9:26 AM Nov 29, 2022, 9:03 AM

    I have two gateways. One is my wan. The other is my vpn (mullvad), which goes out over my wan.

    I want certain traffic to egress over the vpn and if the vpn is down I do not want the traffic to egress at all.

    I have two rules for computer x. The first rule is a pass rule that says route computer x over the vpn. The second rule is a block rule that says block traffic from computer x. All traffic should from x should be caught and routed over the vpn by the first rule. If the gateway is down I expect the traffic to fail to egress. In the event that for any reason the traffic misses the first rule then the second rule should block the traffic.

    When the vpn is online I notice that traffic correctly passes out through the vpn gateway. However, when my vpn goes offline (as shown by the status in the pfsense home page) the traffic goes out over my wan. Moreover, looking at the log, it shows that the traffic is being caught by the first rule (to route via the vpn) but nevertheless is going out over the wan. I do not understand why traffic is egressing via WAN when the rule specifically says egress via the VPN. I cannot think how to investigate this further either, as I can see the right rule is being matched in the logs and the gateway is set to VPN.

    I tried deleting the rules and rewriting them and assigned computer x a new IP address for the new rules to pick up. I’ve restarted pfsense and computer x. Can someone see what may be happening or could you suggest how I can investigate the issue further? I do not understand why the traffic is egressing via the wan when the vpn is set as the gateway, to utilise policy based routing.

    F67A9986-A8EC-4893-83A3-CCC26098B164.png 3F568D7E-9943-4576-B544-2CEBAD0537B7.jpeg

    N 1 Reply Last reply Nov 29, 2022, 9:08 AM Reply Quote 0
    • N
      NogBadTheBad @jeremyj
      last edited by Nov 29, 2022, 9:08 AM

      @jeremyj set up a gateway group with the vpn as tier 1 and the wan as tier 2, point the firewall rules that you want to normally go via the vpn then wan to the gateway group you create.

      Andy

      1 x Netgate SG-4860 - 3 x Linksys LGS308P - 1 x Aruba InstantOn AP22

      J 1 Reply Last reply Nov 29, 2022, 9:10 AM Reply Quote 0
      • J
        jeremyj @NogBadTheBad
        last edited by Nov 29, 2022, 9:10 AM

        @nogbadthebad

        Thanks, but I do not want the traffic to egress at all if it cannot egress over the vpn. If I have tiers won’t it just go to tier 2 when tier 1 is down?

        N 1 Reply Last reply Nov 29, 2022, 9:12 AM Reply Quote 0
        • N
          NogBadTheBad @jeremyj
          last edited by Nov 29, 2022, 9:12 AM

          @jeremyj Oh sorry I misread your post.

          Andy

          1 x Netgate SG-4860 - 3 x Linksys LGS308P - 1 x Aruba InstantOn AP22

          N 1 Reply Last reply Nov 29, 2022, 9:21 AM Reply Quote 1
          • N
            NogBadTheBad @NogBadTheBad
            last edited by NogBadTheBad Nov 29, 2022, 9:21 AM Nov 29, 2022, 9:21 AM

            Post a screenshot of your rules.

            Andy

            1 x Netgate SG-4860 - 3 x Linksys LGS308P - 1 x Aruba InstantOn AP22

            J 1 Reply Last reply Nov 29, 2022, 9:27 AM Reply Quote 0
            • J
              jeremyj @NogBadTheBad
              last edited by Nov 29, 2022, 9:27 AM

              @nogbadthebad
              Thanks I’ve added pics to the question above. There are only three options set: the source computer, the gateway, the pipe. Thanks for the help.

              1 Reply Last reply Reply Quote 0
              • J
                jeremyj
                last edited by Nov 29, 2022, 10:06 AM

                I think it may be that you have to set an advanced option to force the gateway use. I think it is documented here:
                https://docs.netgate.com/pfsense/en/latest/multiwan/policy-route.html#enforcing-gateway-use

                Personally, that seems a really counterintuitive thing to have to set. It rather defeats the purpose of selecting a specific gateway. If failover to another gateway is wanted, that seems the whole purpose of gateway groups.

                If I am wrong or right about this being the source of my original problem, grateful if someone could confirm/disconfirm.

                B 1 Reply Last reply Nov 29, 2022, 10:25 AM Reply Quote 0
                • B
                  Bob.Dig LAYER 8 @jeremyj
                  last edited by Bob.Dig Nov 29, 2022, 12:07 PM Nov 29, 2022, 10:25 AM

                  @jeremyj said in Policy based routing:

                  https://docs.netgate.com/pfsense/en/latest/multiwan/policy-route.html#enforcing-gateway-use

                  Your link is the answer, per default pfsense want you or your "company" to be able to "work" when a gateway is failing, so you as the admin have to enforce that it doesn't work. At first pfSense is a firewall for businesses and not a VPN-Client for privacyVPNs for homeuser. 😉

                  J C 2 Replies Last reply Nov 29, 2022, 10:34 AM Reply Quote 1
                  • J
                    jeremyj @Bob.Dig
                    last edited by Nov 29, 2022, 10:34 AM

                    @bob-dig
                    Thank you. Appreciate you taking time to confirm.

                    I hope the author manual sees this post! It would be helpful to make that behaviour clearer generally in the routing and gateway terminology employed in the manual as the wording in most places suggests that a gateway “will” be used. But it seems “may” is more accurate, given the default behaviour.

                    1 Reply Last reply Reply Quote 0
                    • C
                      Cool_Corona @Bob.Dig
                      last edited by Nov 29, 2022, 11:33 AM

                      @bob-dig But thats a bad excuse for something that shouldnt happen in an enterprise grade FW.

                      When I DONT state that there is a failover GW, then ALL policy based routing to the failing GW should NOT be rerouted.

                      This is basic stuff.... This is networking for dummies.

                      This is a flaw.

                      J 1 Reply Last reply Nov 29, 2022, 11:43 AM Reply Quote 1
                      • J
                        jeremyj @Cool_Corona
                        last edited by jeremyj Nov 29, 2022, 11:50 AM Nov 29, 2022, 11:43 AM

                        @cool_corona

                        Yep. It’s also an externally awkward method of enforcing the gateway egress since if you set the advanced option then instead of privately substituting in another gateway, pfsense just disregards the rule entirely! So you have to create a further rule to then block egress. Overly complex and counterintuitive, compounded by lax terminology in the manual around rules and gateways.

                        B 1 Reply Last reply Nov 29, 2022, 12:12 PM Reply Quote 0
                        • B
                          Bob.Dig LAYER 8 @jeremyj
                          last edited by Nov 29, 2022, 12:12 PM

                          @jeremyj I don't find it that complex but it is also not a consumer product.
                          Instead of changing the advanced option you can create a VPN Killswitch via tagging. You would tag packets in your rule and then create a blockrule on WAN watching for those tags and if tagged traffic is reaching WAN that blockrule would trigger.

                          1 Reply Last reply Reply Quote 0
                          • S
                            stephenw10 Netgate Administrator
                            last edited by stephenw10 Nov 29, 2022, 3:24 PM Nov 29, 2022, 3:23 PM

                            In System > Advanced > Misc you need to set Skip rules when gateway is down.

                            Otherwise the pass rule is still created but without the VPN gateway set when it goes down. Hence the traffic leaves over the WAN directly.

                            Steve

                            Edit: What Bob said! 😉

                            1 Reply Last reply Reply Quote 2
                            13 out of 13
                            • First post
                              13/13
                              Last post
                            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
                              This community forum collects and processes your personal information.
                              consent.not_received