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

    Where do you put firewall rules? LAN1? LAN2? ...and what order do they get executed?

    Scheduled Pinned Locked Moved Firewalling
    7 Posts 2 Posters 546 Views 1 Watching
    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.
    • JustAnotherUserJ Offline
      JustAnotherUser
      last edited by JustAnotherUser

      Q1) When you have WAN rules, LAN1 rules, LAN2 rules, and WG0 rules, how does pfSense decide the execution order?

      Q2) Let's say you have LAN1 (your 'main' LAN) and LAN2 (a DMZ):

      You want an allow rule to go from LAN1 to LAN2 (so you can reach your devices in the DMZ)...
      ...BUT...
      ...you want a block rule from LAN2 to LAN1 (so if bad-guys get into LAN2, they can't get to LAN1).

      Which rule goes under LAN1 rules and which goes under LAN2 rules?

      Q3) Does the "allow WAN<->LAN2" rule go under WAN or LAN2?

      Bob.DigB 1 Reply Last reply Reply Quote 0
      • Bob.DigB Offline
        Bob.Dig LAYER 8 @JustAnotherUser
        last edited by Bob.Dig

        @JustAnotherUser You have been a member for 5 years now and have that basic question? Ok, here we go.

        All traffic is only evaluated once by the firewall, when it first enters it on an interface; top to bottom, first match wins. If it is not filtered there, the traffic can go everywhere.

        Now you can answer your questions by yourself. We can check your answers if you post them here.

        JustAnotherUserJ 1 Reply Last reply Reply Quote 0
        • JustAnotherUserJ Offline
          JustAnotherUser @Bob.Dig
          last edited by

          Okay, then why am I still able ssh to a machine on LAN1 from my DMZ (LAN2) with this rule at the top of DMZ's rules?

          It's executed before any other rule for connections entering the pfSense box from DMZ

          55ae56b1-c9b1-4523-a140-bef693d26bc4-image.png

          Bob.DigB 1 Reply Last reply Reply Quote 0
          • Bob.DigB Offline
            Bob.Dig LAYER 8 @JustAnotherUser
            last edited by

            @JustAnotherUser Something must be wrong with your setup. It is not possible by the rules.

            JustAnotherUserJ 1 Reply Last reply Reply Quote 0
            • JustAnotherUserJ Offline
              JustAnotherUser @Bob.Dig
              last edited by JustAnotherUser

              @Bob-Dig
              It's absolutely doing it which is why I had to ask the question...

              The DMZ (LAN2) is a physically separate NIC card (re1) going directly to a machine with no other interconnects.

              LAN1 is it's own NIC card (bge1) with no physical connections to the DMZ hardware or the WAN NIC (which is also a separate card (bge0)).

              There's no VLANs, no bridges, no static routes but the firewall is NOT stopping connections from DMZ to LAN1

              Bob.DigB 1 Reply Last reply Reply Quote 0
              • Bob.DigB Offline
                Bob.Dig LAYER 8 @JustAnotherUser
                last edited by

                @JustAnotherUser Reset the state table and check for floating rules. If it still "doesn't work" it is your setup.

                JustAnotherUserJ 1 Reply Last reply Reply Quote 0
                • JustAnotherUserJ Offline
                  JustAnotherUser @Bob.Dig
                  last edited by

                  @Bob-Dig

                  Resetting the state table was the answer. TY

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