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

    NAT not working when destination and redirecting port are different

    NAT
    3
    8
    385
    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.
    • L
      Landomix
      last edited by

      Hi to everyone. I am trying to test pfsense, and my network is setup as follows: there it is a server, running on port 80, connected to the LAN port of the firewall.

      The NAT works perfectly if I am keeping the same port, e.g., <FIREWALL_IP>:80 correctly redirects to <SERVER_IP>:80, but if I setup the following rule, tryng to perform the redirection of <FIREWALL_IP>:6666 to <SERVER_IP>: 80, it does not work. (the only thing I changed with respect to before, is the destination port, which, if I am not wrong, should be the one to which I am pointing).
      For convenience, in the following there it is an image of the rule.

      image.jpg

      Here the link to my post in the reddit community of pfsense, containing other tries I've done.

      Please, notice that if the internal and external ports are the same, it works perfectly fine.

      Version: latest stable, 2.6.0-RELEASE (amd64) built on Mon Jan 31 19:57:53 UTC 2022 FreeBSD 12.3-STABLE.

      Thanks in advance for the help!

      S 1 Reply Last reply Reply Quote 0
      • S
        SteveITS Galactic Empire @Landomix
        last edited by

        @landomix further down the page there’s an option to create a linked firewall rule, is that the default of creating the rule? Did you try creating a different rule? The ability works fine, I do it all the time.

        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!

        L 1 Reply Last reply Reply Quote 0
        • L
          Landomix @SteveITS
          last edited by

          @steveits yes, I used the default rule, producing the following:

          nat_rule_firewall.png

          When you say that you use it every day, you mean with different ports? Because if I just do the nat of two addresses with the same port, it works. The problem raises when I change the port that I try to access from the WAN. Theoretically this rule shuld be right with the port "80", because if I'm not wrong, first pfSense first translate the address, and then pass the package through the firewall.

          Thanks for the quick response!

          S Bob.DigB 2 Replies Last reply Reply Quote 0
          • S
            SteveITS Galactic Empire @Landomix
            last edited by

            @landomix yes different ports. The 584k indicates the rule is matching traffic.

            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!

            L 1 Reply Last reply Reply Quote 0
            • Bob.DigB
              Bob.Dig LAYER 8 @Landomix
              last edited by

              @landomix If you test with a browser you have to put in :6666 at the end...

              L 1 Reply Last reply Reply Quote 0
              • L
                Landomix @Bob.Dig
                last edited by

                @bob-dig I confirm that all the connection tests has been done by adding obviously :6666

                1 Reply Last reply Reply Quote 0
                • L
                  Landomix @SteveITS
                  last edited by

                  @steveits unfortunately even if appears that some traffic is being exhanged I still cannot connect tò the server. Is it possibile that the traffic being exchanged is my request which has then been discarded by the firewall?

                  S 1 Reply Last reply Reply Quote 0
                  • S
                    SteveITS Galactic Empire @Landomix
                    last edited by

                    @landomix no it should have an open state for the reply. Presumably the gateway on the server is the pfSense because it works on the other port.
                    You could check states and/or a packet capture on LAN…
                    Have you tried a different alt port? It shouldn’t care but…

                    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
                    • First post
                      Last post
                    Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.