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

    DMZ

    Scheduled Pinned Locked Moved General pfSense Questions
    25 Posts 5 Posters 3.8k 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.
    • A Offline
      Atreides
      last edited by

      I'm a bit confused about DMZ firewall rules. In regards to the order of rules do I want the rule that blocks traffic to be at the bottom or top of the rule set? Do I need a rule that blocks traffic at all? Or is all traffic implicitly blocked unless I let it through?

      1 Reply Last reply Reply Quote 0
      • M Offline
        mguebert
        last edited by

        Rules are matched from the top down, the first rule that matches wins, the rest don't get evaluated.

        1 Reply Last reply Reply Quote 0
        • KOMK Offline
          KOM
          last edited by

          Each interface has a hidden Default Deny rule that you can envision as being at the very bottom of the list.  If no rules above it apply then the traffic is blocked.

          1 Reply Last reply Reply Quote 0
          • A Offline
            Atreides
            last edited by

            In that case, I was trying to set up a DMZ following instructions from here. Would this be working correctly as a DMZ? I want to be able to access the internet from the DMZ but have no access into any of my subnets. Do I need to change anything? I attached my rules below.

            wrath and lilan are hosts where wrath needs to access an NFS share on lilan. RFC1918 is 192.168.0.0/16, 172.16.0.0/12, and 10.0.0.0/8.

            20170117-092303.png
            20170117-092303.png_thumb

            1 Reply Last reply Reply Quote 0
            • KOMK Offline
              KOM
              last edited by

              Considering how firewall rules are processed top-down first-match, your last rule will never hit since rule #4 allows all access to anywhere (including LAN).  Here is how I do it.  My DMZ servers need to talk to our LAN-based Zabbix server, and they need to get DNS from LAN, too.

              dmz.png
              dmz.png_thumb

              1 Reply Last reply Reply Quote 0
              • A Offline
                Atreides
                last edited by

                Oh I see, I have been thinking about it backwards? When people say the rules are top down I thought that would mean that the last thing to be read would be the bottom, in my case blocking RFC1918. Instead I should be thinking about it based on priority? So the rules higher up are the rules that will be respected?

                1 Reply Last reply Reply Quote 0
                • D Offline
                  doktornotor Banned
                  last edited by

                  First match wins (except for floating rules).

                  1 Reply Last reply Reply Quote 0
                  • A Offline
                    Atreides
                    last edited by

                    So, this better?

                    20170117-rules.png
                    20170117-rules.png_thumb

                    1 Reply Last reply Reply Quote 0
                    • KOMK Offline
                      KOM
                      last edited by

                      I suspect not, if your pfSense DMZ interface is part of RFC1918.  Why not get rid of your last two rules and then just copy my last rule?

                      1 Reply Last reply Reply Quote 0
                      • A Offline
                        Atreides
                        last edited by

                        Well, I have many subnets… I guess I could block them all, but wont that be the same as I currently have?

                        1 Reply Last reply Reply Quote 0
                        • A Offline
                          Atreides
                          last edited by

                          Here's what i ended up with:

                          block-by-net.png_thumb
                          block-by-net.png

                          1 Reply Last reply Reply Quote 0
                          • KOMK Offline
                            KOM
                            last edited by

                            Still no good.  Your 4th rule allows all access to anywhere.  Delete it entirely.

                            1 Reply Last reply Reply Quote 0
                            • jahonixJ Offline
                              jahonix
                              last edited by

                              You have lots of "allow BUT" rules, the ones with "!". Doesn't make sense.
                              Either make them block that range OR make them allow it but NOT "allow all but…"

                              1 Reply Last reply Reply Quote 0
                              • jahonixJ Offline
                                jahonix
                                last edited by

                                @KOM:

                                … just copy my last rule?

                                Problem is that it works but is harder to follow than need be.
                                Blocking something with an allow rule seems … strange.

                                Better use one rule first to explicitly block * to LAN
                                Add another rule to allow * to world.

                                1 Reply Last reply Reply Quote 0
                                • A Offline
                                  Atreides
                                  last edited by

                                  @jahonix:

                                  @KOM:

                                  … just copy my last rule?

                                  Problem is that it works but is harder to follow than need be.
                                  Blocking something with an allow rule seems … strange.

                                  Better use one rule first to explicitly block * to LAN
                                  Add another rule to allow * to world.

                                  Yea, this is what I wanted to do originally.

                                  1 Reply Last reply Reply Quote 0
                                  • A Offline
                                    Atreides
                                    last edited by

                                    @Atreides:

                                    So, this better?

                                    Doesn't my earlier post above accomplish that?

                                    1 Reply Last reply Reply Quote 0
                                    • jahonixJ Offline
                                      jahonix
                                      last edited by

                                      It does.
                                      Don't know what problems KOM had with it, I'd do it that way.

                                      1 Reply Last reply Reply Quote 0
                                      • A Offline
                                        Atreides
                                        last edited by

                                        @jahonix:

                                        It does.
                                        Don't know what problems KOM had with it, I'd do it that way.

                                        Great! That is why I was confused. I'll try that.

                                        Thanks everyone.

                                        1 Reply Last reply Reply Quote 0
                                        • KOMK Offline
                                          KOM
                                          last edited by

                                          Your first ruleset allowed access everywhere before the LAN block.  Your second ruleset has you blocking all private IP space and not just LAN.  Your 3rd ruleset allowed everything before the blocks.

                                          Second ruleset would do the job but the block is overly broad, and this can potentially impact you down the road if you add any interfaces or VLANs.

                                          1 Reply Last reply Reply Quote 0
                                          • A Offline
                                            Atreides
                                            last edited by

                                            @KOM:

                                            Your first ruleset allowed access everywhere before the LAN block.  Your second ruleset has you blocking all private IP space and not just LAN.  Your 3rd ruleset allowed everything before the blocks.

                                            Second ruleset would do the job but the block is overly broad, and this can potentially impact you down the road if you add any interfaces or VLANs.

                                            How so? The DMZ shouldn't have access to any other VLANS/interfaces.

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