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

    NAT & Filter Association Comes Loose

    Scheduled Pinned Locked Moved 2.1 Snapshot Feedback and Problems - RETIRED
    7 Posts 2 Posters 1.5k 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.
    • N
      NOYB
      last edited by

      NAT & Filter association comes loose when rules order is changed.

      1. Create a new associative NAT rule, save and apply changes.
      2. Move the new NAT rule from the bottom of the NAT rules list to the top, and apply changes.
      3. Go to the firewall rules and move the NAT associated rule from the bottom of Firewall rules list to the top, and apply changes.
      4. Edit the NAT rule to add a source address, save and apply changes.
      5. The source address is not applied / updated to the firewall filter rule.

      Prior to moving the order of the rules adding and changing NAT rule source address works and is applied to the firewall rule.

      There is still an association between the two though because deleting the NAT rule also still deletes the firewall rule.

      1 Reply Last reply Reply Quote 0
      • jimpJ
        jimp Rebel Alliance Developer Netgate
        last edited by

        Is there something special about moving it that causes it? Does it happen to you if you don't move them? Meaning if you add a nat rule and then immediately go back and edit the source.

        Remember: Upvote with the ๐Ÿ‘ button for any user/post you find to be helpful, informative, or deserving of recognition!

        Need help fast? Netgate Global Support!

        Do not Chat/PM for help!

        1 Reply Last reply Reply Quote 0
        • N
          NOYB
          last edited by

          ". . . if you add a nat rule and then immediately go back and edit the source."
          Yes that works (until they are moved).

          Apparently there is something about moving them that changes because until they are moved it works.

          1 Reply Last reply Reply Quote 0
          • jimpJ
            jimp Rebel Alliance Developer Netgate
            last edited by

            Is it isolated to just moving the filter rule, or just moving the nat rule? Or does it have to be both?

            They use a random associated ID tag, so I don't see how moving them would really make any difference, but if you can narrow it down and then do a before/after config diff, it may help shed some light on what is happening.

            Remember: Upvote with the ๐Ÿ‘ button for any user/post you find to be helpful, informative, or deserving of recognition!

            Need help fast? Netgate Global Support!

            Do not Chat/PM for help!

            1 Reply Last reply Reply Quote 0
            • N
              NOYB
              last edited by

              Okay little narrower case here.

              Problem is consistently reproducible by creating a NAT with source restriction, then moving the associated rule from the bottom to the top of rules list (right below the private and bogon rules).ย  Then changing source restriction via NAT.ย  The source restriction changes in NAT but not in rule.

              Moving another rule to the top spot (above the NAT associated rule) and it again works.

              Seems the NAT associated rule has problems being first in the list.

              1 Reply Last reply Reply Quote 0
              • jimpJ
                jimp Rebel Alliance Developer Netgate
                last edited by

                Ah, I see what happened there.

                The function tests if the result == false, but if the result is 0, that is equal to false in PHP. It needs a more strict type match (=== not ==).

                Try this:
                https://github.com/bsdperimeter/pfsense/commit/752c6ca8117e05e6bb74115d2199dab7ff99168d

                Remember: Upvote with the ๐Ÿ‘ button for any user/post you find to be helpful, informative, or deserving of recognition!

                Need help fast? Netgate Global Support!

                Do not Chat/PM for help!

                1 Reply Last reply Reply Quote 0
                • N
                  NOYB
                  last edited by

                  That works.ย  Good job.ย  Thanks.

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