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

    Best practice for FW rules

    Scheduled Pinned Locked Moved Firewalling
    6 Posts 3 Posters 5.4k 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
      cyberfinn
      last edited by

      Hey

      We have a pfSense setup in our environment. Right now we have 15 interfaces/subnets and creates a new one every month. Traffic between interfaces/subnets should not be allow by default, but every interface/subnet should be allowed to use the internet/WAN.

      How should we setup this senario?

      Right now we 14 deny rules for each interfaces, i.e:

      From interface Subnet1:
      Deny all to Subnet 2
      Deny all to Subnet 3
      Deny all to Subnet 4
      ….. and so on
      And the last rule: Allow all (For allowing access to rest of the internet)

      From interface Subnet2:
      Deny all to Subnet 1
      Deny all to Subnet 3
      Deny all to Subnet 4
      ….. and so on
      And the last rule: Allow all (For allowing access to rest of the internet)

      But when we creates a new interface/subnet, we need to add a deny rule for this subnet to all other subnets rules. It takes a lots of time.

      Can we do that smarter?

      1 Reply Last reply Reply Quote 0
      • pttP Offline
        ptt Rebel Alliance
        last edited by

        IIRC all traffic from OPT interfaces is Blocked by Default, so you dont need the Block rules. Only the LAN interface with the default "LAN to ANY" Rule needs the Block rules.
        You only need to be less "permisive" in your PASS rules On OPT interfaces

        1 Reply Last reply Reply Quote 0
        • GruensFroeschliG Offline
          GruensFroeschli
          last edited by

          Actually that's not true.
          If you remove all rules from the LAN-tab everything will be blocked as well.
          You just have to make sure that you remove the default rules.

          To the original question.
          This can be done a lot easier:

          1: Create an alias containing all your local subnets.
          I assume these local subnets use private IP's (192.168/16, 172.16/12, 10/8)
          –> If you add/remove new subnets regularly you might want to use these RFC1918 subnets directly (the above in brackets).

          2: Delete all rules on all interfaces.

          3: Create a single rule on each interface:
          Allow, Protocol: any, Source: Interface-subnet, Source-port: any, Destination: !Alias (NOT the alias), destination-port: any

          With such a rule you allow traffic to all destinations which are NOT in the alias.
          --> The internet.
          Everything else will be blocked by the invisible default "block everything" rule.

          We do what we must, because we can.

          Asking questions the smart way: http://www.catb.org/esr/faqs/smart-questions.html

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

            @ptt:

            IIRC all traffic from OPT interfaces is Blocked by Default, so you dont need the Block rules. Only the LAN interface with the default "LAN to ANY" Rule needs the Block rules.
            You only need to be less "permisive" in your PASS rules On OPT interfaces

            Thanks. But the problem is how to give access to all other IP's on the internet. I think the solution from GruensFroeschli is the right one.

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

              @GruensFroeschli:

              Actually that's not true.
              If you remove all rules from the LAN-tab everything will be blocked as well.
              You just have to make sure that you remove the default rules.

              To the original question.
              This can be done a lot easier:

              1: Create an alias containing all your local subnets.
              I assume these local subnets use private IP's (192.168/16, 172.16/12, 10/8)
              –> If you add/remove new subnets regularly you might want to use these RFC1918 subnets directly (the above in brackets).

              2: Delete all rules on all interfaces.

              3: Create a single rule on each interface:
              Allow, Protocol: any, Source: Interface-subnet, Source-port: any, Destination: !Alias (NOT the alias), destination-port: any

              With such a rule you allow traffic to all destinations which are NOT in the alias.
              --> The internet.
              Everything else will be blocked by the invisible default "block everything" rule.

              Thanks. I think this is the solution. Nice one.

              1 Reply Last reply Reply Quote 0
              • pttP Offline
                ptt Rebel Alliance
                last edited by

                Sorry, my bad.

                Mr. GruensFroeschli way, is the right way  :-[

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