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

    Internal port redirect

    Scheduled Pinned Locked Moved NAT
    10 Posts 3 Posters 702 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.
    • S
      Scarecrow4798
      last edited by

      Newbie question.

      I'm trying to setup pfSense to redirect a port for a Dashy self hosted dashboard.

      The port dashy is listening on is 4000 and I'm wanting to access it from my LAN on port 80 i.e. http://dashy.lan

      It is only accessible internally from my LAN and does not have any open ports on my WAN.
      I've tried using the NAT port forwarding but cant get the dammed thing to work. I know I need NAT reflection and I've tried NAT + Proxy and PureNAT.
      I have reflection turned on in System -> Advanced -> Firewall & NAT

      http://dashy.lan:4000 works fine

      All the help topics and YouTube videos are about accessing internal ports from external devices but that's not what I am after.
      Can anyone help.

      V johnpozJ 2 Replies Last reply Reply Quote 0
      • V
        viragomann @Scarecrow4798
        last edited by

        @Scarecrow4798 said in Internal port redirect:

        The port dashy is listening on is 4000 and I'm wanting to access it from my LAN on port 80 i.e. http://dashy.lan

        Why don't you just set it to listen on port 80?

        S 1 Reply Last reply Reply Quote 0
        • johnpozJ
          johnpoz LAYER 8 Global Moderator @Scarecrow4798
          last edited by

          @Scarecrow4798 nat reflection is never going to work unless dashy.lan resolves to a pfsense IP, normally nat reflection is used for stuff that resolves to your public IP and there is no way to have the client use a fqdn that resolves to your local IP.

          haproxy could also be used, but again dashy.lan would have to resolve to a Pfsense IP vs just the local IP you have dashy running on.

          I am with @viragomann why not just have it listen on 80 if that is the port you want to use?

          Or why does is matter what port.. Just create a bookmark that points to it with port.. for example I run a dashboard docker (heimdall) and my bookmark just points to where its running http://nas.home.arpa:8056/

          An intelligent man is sometimes forced to be drunk to spend time with his fools
          If you get confused: Listen to the Music Play
          Please don't Chat/PM me for help, unless mod related
          SG-4860 24.11 | Lab VMs 2.7.2, 24.11

          1 Reply Last reply Reply Quote 0
          • S
            Scarecrow4798 @viragomann
            last edited by Scarecrow4798

            @viragomann

            As im still learning its more a proof of concept so if it comes up on another port i know how to configure everything correctly

            dashy.lan does resolve to a pfsense ip http://10.0.1.11

            johnpozJ 1 Reply Last reply Reply Quote 0
            • johnpozJ
              johnpoz LAYER 8 Global Moderator @Scarecrow4798
              last edited by johnpoz

              @Scarecrow4798 said in Internal port redirect:

              its more a proof of concept

              You can not reflect what pfsense doesn't see.. If dashy.lan resolve to say 192.168.1.100, and pfsense IP is 192.168.1.1, and its wan say 1.2.3.4

              When you client on 192.168.1.50 tries to go to dashy.lan on 192.168.1.100 pfsense would never see this traffic to reflect it. I you want to reflect, dashy.lan would have to resolve to an IP on pfsense that it could reflect.. Or to a IP that goes through pfsense so it could redirect it. And if you don't change the reflection source IP to be pfsense your most likely going to run into a asymmetrical issue... Because 192.168.1.100 will send the traffic right to 192.168.1.50.. vs sending it back to pfsense to send back to 1.50

              As a to a concept of reflection, it is an abomination to networking IMHO.. It can be used as a last resort work around when the client is forced to use say public dns and can not resolve a fqdn to the local address.. Of if it uses hardcoded IPs that go outside or to pfsense wan IP.. But in general you should avoid reflection or proxy when access resources that are local the network your on..

              If your service can not listen on a standard port, say http 80 or 443 for https, and you can not run say a actual webserver that handles the host headers and serves up the specific site based on the fqdn being accessed or even say a 301 that tells the client hey your trying to access http://dashy.lan go here http://dashy.lan:4000

              The simple solution is just use a bookmark that includes your oddball port in the url.

              An intelligent man is sometimes forced to be drunk to spend time with his fools
              If you get confused: Listen to the Music Play
              Please don't Chat/PM me for help, unless mod related
              SG-4860 24.11 | Lab VMs 2.7.2, 24.11

              S 1 Reply Last reply Reply Quote 0
              • S
                Scarecrow4798 @johnpoz
                last edited by

                @johnpoz

                im getting a little lost

                my pc is 10.0.1.9
                pfsense 10.0.1.1/22
                dashy 10.0.1.11

                dashy.lan resolves to 10.0.1.11

                wan 192.168.0.2

                pfsense has a DHCP server handing out ip addresses

                johnpozJ 1 Reply Last reply Reply Quote 0
                • johnpozJ
                  johnpoz LAYER 8 Global Moderator @Scarecrow4798
                  last edited by johnpoz

                  @Scarecrow4798 said in Internal port redirect:

                  my pc is 10.0.1.9
                  pfsense 10.0.1.1/22
                  dashy 10.0.1.11

                  so if .9 wants to talk to dashy at .11 - that traffic would never be seen by pfsense - so how could it ever "reflect" it or redirect it any way..

                  An intelligent man is sometimes forced to be drunk to spend time with his fools
                  If you get confused: Listen to the Music Play
                  Please don't Chat/PM me for help, unless mod related
                  SG-4860 24.11 | Lab VMs 2.7.2, 24.11

                  S 1 Reply Last reply Reply Quote 0
                  • S
                    Scarecrow4798 @johnpoz
                    last edited by

                    @johnpoz

                    damn it that makes sense.

                    Would the best way of doing it then be to move dashy to another interface? VLAN?

                    V johnpozJ 2 Replies Last reply Reply Quote 0
                    • V
                      viragomann @Scarecrow4798
                      last edited by

                      @Scarecrow4798
                      You can also achieve this if both are on the same interface, but dashy.lan has to resolve the the pfSense LAN address and you have to translate the source address to avoid asymmetrical routing, as mentioned.
                      And since you don't forward dashy on WAN, as I understood, there is nothing to reflect. So you would have to create a port forwarding for it on the LAN.

                      So dashy.lan points to pfSense LAN IP by your internal DNS.

                      The add a port forwarding rule to LAN:
                      destination: LAN address, port: 80
                      redirect target: 10.0.1.11, port 4000

                      For the source translation go to outbound NAT and enable the hybrid mode and save this.
                      Add a rule on LAN:
                      source: any
                      destination: 10.0.1.11, port 4000
                      translation: interface address

                      1 Reply Last reply Reply Quote 0
                      • johnpozJ
                        johnpoz LAYER 8 Global Moderator @Scarecrow4798
                        last edited by johnpoz

                        @Scarecrow4798 said in Internal port redirect:

                        Would the best way of doing it then be to move dashy to another interface? VLAN?

                        Sure if this dashy was on a different network that route through pfsense, you could redirect the traffic to a different port.

                        Seems like of trouble, that could be solved with a simple :port on your bookmark ;)

                        An intelligent man is sometimes forced to be drunk to spend time with his fools
                        If you get confused: Listen to the Music Play
                        Please don't Chat/PM me for help, unless mod related
                        SG-4860 24.11 | Lab VMs 2.7.2, 24.11

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