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

    Basic firewall rules for interfaces

    Scheduled Pinned Locked Moved General pfSense Questions
    13 Posts 4 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.
    • ?
      A Former User
      last edited by

      I have another super simple, generic, noob question. I have LAN and "NET2" as interfaces. I want LAN to have access to every interface indiscriminately, and NET2 to have WAN access, but no LAN access.

      LAN:
      6fd9efc4-6684-441a-af78-ed3c807d6180-image.png

      NET2:
      2d86615d-6916-4451-bc3e-323b93550762-image.png

      But obviously (to you) NET2 has no WAN or LAN access and idk why. What obvious netsec mistake am I making

      S J 2 Replies Last reply Reply Quote 0
      • AndyRHA
        AndyRH
        last edited by

        LAN rule #4 is not needed because Net2 traffic will not enter the LAN interface.

        Net2 rule #1 is allowing access the WAN subnet, not the internet. Notice on the LAN rules there is any:any rule. On Net2 you want block any:LAN and then allow any:any.

        LAN traffic will be allowed to Net2, Net2 will be allowed to respond. A state will be created to allow the traffic flow.

        As I understand the question that will get you going.

        o||||o
        7100-1u

        ? 1 Reply Last reply Reply Quote 0
        • S
          SteveITS Galactic Empire @A Former User
          last edited by

          @bumzag What Andy said, but just noting that if you start blocking things on NET2, you probably want to allow from NET2 to the NET2 IP on pfSense port 53 for DNS (TCP+UDP). That is not allowed in your screenshot either, but would be allowed by allowing NET2 net:any. Also you may or may not want to block NET2 net to your pfSense ("this Firewall" so all IPs) ports 443/80/22.

          Pre-2.7.2/23.09: Only install packages for your version, or risk breaking it. Select your branch in System/Update/Update Settings.
          When upgrading, allow 10-15 minutes to restart, or more depending on packages and device speed.
          Upvote ๐Ÿ‘ helpful posts!

          1 Reply Last reply Reply Quote 0
          • ?
            A Former User @AndyRH
            last edited by A Former User

            Thanks for the responses. I added the block rule on NET2 and per @SteveITS added rule #3:
            c892f3f8-fed0-4bba-a7fc-1f0a8e9cd620-image.png

            But with that block rule #1, I don't have WAN acces (or LAN which is good). I can ping 192.168.2.1 no problem but can't ping 8.8.8.8 or google.com

            S 1 Reply Last reply Reply Quote 0
            • S
              SteveITS Galactic Empire @A Former User
              last edited by

              @bumzag In the order shown, the third rule will never trigger because the second rule has already allowed the traffic. (they process in order, with an implicit deny all at the end)

              On NET2, are devices set to use the NET2 interface IP as their DNS?

              Pre-2.7.2/23.09: Only install packages for your version, or risk breaking it. Select your branch in System/Update/Update Settings.
              When upgrading, allow 10-15 minutes to restart, or more depending on packages and device speed.
              Upvote ๐Ÿ‘ helpful posts!

              ? 1 Reply Last reply Reply Quote 0
              • ?
                A Former User @SteveITS
                last edited by A Former User

                @steveits said in Basic firewall rules for interfaces:

                @bumzag In the order shown, the third rule will never trigger because the second rule has already allowed the traffic. (they process in order, with an implicit deny all at the end)

                On NET2, are devices set to use the NET2 interface IP as their DNS?

                On a NET2 device with debian 11, I changed /etc/resolv.conf to 192.168.2.1 and rebooted, still no WAN access.

                S 1 Reply Last reply Reply Quote 0
                • S
                  SteveITS Galactic Empire @A Former User
                  last edited by

                  @bumzag Is the gateway 192.168.2.1 also? I misread your post that you cannot ping 8.8.8.8 so it's not (only) a DNS problem. Try a traceroute there to see how far you get.

                  You have traffic matching the any:any rule ("1/13 KiB").

                  Pre-2.7.2/23.09: Only install packages for your version, or risk breaking it. Select your branch in System/Update/Update Settings.
                  When upgrading, allow 10-15 minutes to restart, or more depending on packages and device speed.
                  Upvote ๐Ÿ‘ helpful posts!

                  1 Reply Last reply Reply Quote 0
                  • ?
                    A Former User
                    last edited by A Former User

                    @steveits yes sorry I edited it without realizing you commented. This is my /etc/network/interfaces file on a NET2 device

                    iface ens18 inet static
                       address 192.168.2.2
                       netmask 255.255.255.0
                       gateway 192.168.2.1
                       dns-nameservers 192.168.2.1
                    

                    traceroute 8.8.8.8 gets me

                    1 192.168.2.2 (192.168.2.2) 3062.489ms !H 3062.423 ms !H 3062.401 ms !H

                    S 1 Reply Last reply Reply Quote 0
                    • S
                      SteveITS Galactic Empire @A Former User
                      last edited by

                      @bumzag https://networkengineering.stackexchange.com/questions/16454/difference-between-unresponsive-and-unreachable-h-hosts-in-traceroute-out

                      So not a DNS issue. Routing table on the PC?

                      Pre-2.7.2/23.09: Only install packages for your version, or risk breaking it. Select your branch in System/Update/Update Settings.
                      When upgrading, allow 10-15 minutes to restart, or more depending on packages and device speed.
                      Upvote ๐Ÿ‘ helpful posts!

                      ? 1 Reply Last reply Reply Quote 0
                      • ?
                        A Former User @SteveITS
                        last edited by

                        @steveits

                        sorry got distracted. if I add a rule to allow NET2 to LAN, devices on NET2 have no problem reaching WAN. I'm guessing there's a gateway issue with the NET2 interface?
                        0a783b9b-c3eb-4b02-b5fc-4268cae1d6a7-image.png

                        S 1 Reply Last reply Reply Quote 0
                        • S
                          SteveITS Galactic Empire @A Former User
                          last edited by

                          @bumzag I believe that rule allows Net2 to anyโ€ฆI think you want more like

                          Block net2 net to lan net
                          Allow net2 net to any

                          Pre-2.7.2/23.09: Only install packages for your version, or risk breaking it. Select your branch in System/Update/Update Settings.
                          When upgrading, allow 10-15 minutes to restart, or more depending on packages and device speed.
                          Upvote ๐Ÿ‘ helpful posts!

                          ? 1 Reply Last reply Reply Quote 0
                          • ?
                            A Former User @SteveITS
                            last edited by

                            @steveits

                            im sorry but can you eli5? I don't understand, why would I add a block all rule to the LAN interface from NET2 but then add an allow all rule on the LAN interface from NET2? thanks for helping btw

                            1 Reply Last reply Reply Quote 0
                            • J
                              Jarhead @A Former User
                              last edited by Jarhead

                              @bumzag said in Basic firewall rules for interfaces:

                              I want LAN to have access to every interface indiscriminately, and NET2 to have WAN access, but no LAN access.

                              The block comes before the allow so LAN would be blocked

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