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

    UDP firewall rule being skipped

    Scheduled Pinned Locked Moved Firewalling
    20 Posts 2 Posters 1.3k 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.
    • R
      Ryuu 0
      last edited by

      I have 3 sites communicating with each other via IPsec VTIs and I want to limit UDP traffic to a specific port (8472).
      I tried adding the following rule:
      b4a6c7cf-4172-4ca5-821c-8c21f777c272-image.png

      However, according to the firewall logs, packets are being caught by the default deny rule and are, therefore, being dropped:
      ba8b935f-3c65-493c-aad5-a3668061a8ae-image.png

      If I change the rule to allow any port (or a range of 1 to 65535) then packets are no longer dropped.
      Ideally I'd be able to limit the source and destination as well, which is the rule I originally created however found the same problem (packets being dropped).

      I tried resetting the firewall state table and also confirmed the rule was correctly created, using pfctl -sr and found it was:
      pass in quick on enc0 inet proto udp from any to any port = 8472 keep state label "USER_RULEl <redacted_for_brevity>"

      Is there something I'm missing or have done wrong?

      Any insight would be greatly appreciated.

      NightlySharkN 3 Replies Last reply Reply Quote 0
      • NightlySharkN
        NightlyShark @Ryuu 0
        last edited by NightlyShark

        @Ryuu-0 The "From" and "To" do not mean "Source port" "Destination port"... They mean "First port of destination port range" "last port of destination port range".
        See...
        0879545a-08dd-4b6e-b7bf-395b9081e6e9-image.png
        Click on advanced on source and just set both "from" boxes to 8472.

        1 Reply Last reply Reply Quote 0
        • NightlySharkN
          NightlyShark @Ryuu 0
          last edited by

          @Ryuu-0 If I understood what you wanted correctly, anyway...

          1 Reply Last reply Reply Quote 0
          • NightlySharkN
            NightlyShark @Ryuu 0
            last edited by

            @Ryuu-0 Or maybe you mean you only want traffic on this port and no other? In that case:
            0c95c723-e5ce-4eac-b1f2-ac501e567585-image.png

            R 1 Reply Last reply Reply Quote 0
            • R
              Ryuu 0 @NightlyShark
              last edited by

              @NightlyShark Thank you for your replies.

              The "From" and "To" do not mean "Source port" "Destination port"... They mean "First port of destination port range" "last port of destination port range".

              See...

              I understand. I tried that with no luck (please check the first screenshot I shared).

              Or maybe you mean you only want traffic on this port and no other? In that case:

              Yes, I only want to allow UDP traffic on port 8472.
              Surely Invert Match will allow traffic whose destination is any port except the specified port (8492 in your screenshot).
              If so then this is the opposite of what I'm trying to do.

              NightlySharkN 1 Reply Last reply Reply Quote 0
              • NightlySharkN
                NightlyShark @Ryuu 0
                last edited by NightlyShark

                @Ryuu-0 You use a block rule, and below that an allow any to any rule.

                R 1 Reply Last reply Reply Quote 0
                • R
                  Ryuu 0 @NightlyShark
                  last edited by

                  @NightlyShark Why a block rule? pfsense firewalls are default deny, so what block rule are you suggesting?

                  NightlySharkN 4 Replies Last reply Reply Quote 0
                  • NightlySharkN
                    NightlyShark @Ryuu 0
                    last edited by

                    @Ryuu-0 You override the default block rule by an allow all rule, and you override that by a block all except 8492 rule

                    1 Reply Last reply Reply Quote 0
                    • NightlySharkN
                      NightlyShark @Ryuu 0
                      last edited by

                      @Ryuu-0 Imagine the default deny rule as being under your rule list. PfSense rules are processed top to bottom, so...

                      1 Reply Last reply Reply Quote 0
                      • NightlySharkN
                        NightlyShark @Ryuu 0
                        last edited by

                        @Ryuu-0 You said that this failed:
                        581d34fd-2776-4d17-9839-d092c6d2d82e-image.png

                        R 1 Reply Last reply Reply Quote 0
                        • NightlySharkN
                          NightlyShark @Ryuu 0
                          last edited by

                          @Ryuu-0 That is what you need:
                          2f2e67a0-b629-45fb-9447-c19ae175a048-image.png

                          1 Reply Last reply Reply Quote 0
                          • R
                            Ryuu 0 @NightlyShark
                            last edited by

                            @NightlyShark Sorry, that's not what I said. My screenshot is, unfortunately, missing the "Action: Pass" field. But that's what I tried and what's failing (pasting again for convenience)

                            00addf42-94ff-4ad6-814b-0383af47e252-image.png

                            NightlySharkN 1 Reply Last reply Reply Quote 0
                            • NightlySharkN
                              NightlyShark @Ryuu 0
                              last edited by

                              @Ryuu-0 What rule drops those packets? Can you see in the logs?

                              R 1 Reply Last reply Reply Quote 0
                              • R
                                Ryuu 0 @NightlyShark
                                last edited by

                                @NightlyShark Yeah. It's being blocked by the default rule:
                                3792c4e8-f444-44e0-b9dc-f1456cb809cd-image.png

                                NightlySharkN 1 Reply Last reply Reply Quote 0
                                • NightlySharkN
                                  NightlyShark @Ryuu 0
                                  last edited by

                                  @Ryuu-0 Do you by any chance have the IPsec profile setup as an interface? Because then all rules at the IPsecServerXYZ tab take precedence over the general IPsec tab (for all IPsec connections/profiles), including the default deny one.

                                  R 1 Reply Last reply Reply Quote 0
                                  • R
                                    Ryuu 0 @NightlyShark
                                    last edited by

                                    @NightlyShark Yeah, it's set up as a Virtual Tunnel Interface.
                                    I'll take a quick look at those settings.

                                    NightlySharkN R 2 Replies Last reply Reply Quote 1
                                    • NightlySharkN
                                      NightlyShark @Ryuu 0
                                      last edited by NightlyShark

                                      @Ryuu-0 Then you need to create an interface and set the rules on that tab.

                                      1 Reply Last reply Reply Quote 0
                                      • R
                                        Ryuu 0 @Ryuu 0
                                        last edited by

                                        @Ryuu-0 I just checked, there are no extra tabs, in Firewall Rules, for the IPsec interfaces.
                                        The only tab is the general IPsec tab

                                        NightlySharkN 1 Reply Last reply Reply Quote 0
                                        • NightlySharkN
                                          NightlyShark @Ryuu 0
                                          last edited by

                                          @Ryuu-0 What is the destination address for the packets, PfSense?

                                          1 Reply Last reply Reply Quote 0
                                          • R
                                            Ryuu 0
                                            last edited by

                                            Does anyone else have an insight as to what's going wrong?

                                            Something I didn't make clear is that there are no UDP rules other than the one I'm trying to add, i.e. it's not a case of traffic being blocked by a different rule; I in fact don't have any block rules, only pass and rely on the default rule to block any traffic which doesn't match a pass rule

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