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

    Port forwarding problem

    General pfSense Questions
    5
    23
    5.8k
    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.
    • W
      wallabybob
      last edited by

      It is my recollection that some SSH servers need to be configured to specify which IP addresses are allowed access.

      I suggest you check your SSH configuration. SSH log might record failed access attempts.

      As johnpoz suggested, tcpdump is a useful tool to verify your access attempt passes various points along its path.

      Have you reset firewall states after setting up your port forward? See Diagnostics -> States, click on Reset States tab.

      1 Reply Last reply Reply Quote 0
      • M
        marvosa
        last edited by

        Post your port forward and firewall rules.  Also… on the linux server... make sure it's actually listening on port 22... and that the software firewall is either off... or has 22 allowed.  I would turn it off for testing.

        1 Reply Last reply Reply Quote 0
        • J
          jerwiles
          last edited by

          Here's my NAT rule

          Interface - WAN
          External address - any
          Protocol - TCP
          External port range - from: SSH   to:(other)
          NAT IP - 10.1.2.232
          Local port - SSH
          No XMLRPC Sync - Not Checked

          And my Firewall Rule

          Action - Pass
          Disabled - not checked
          Interface - WAN
          Protocol - TCP
          Source - "not" not checked   Type: Any   Address: Blank
           Advanced / Source port range - from: any   to: any
          Source OS - any
          Destination - "not" not checked
           Type: Single host or alias
           Address: 10.1.2.232
          Destination port range - from: SSH   to: SSH
          Log - checked
          Advanced Options - all empty
          State type - keep state
          No XMLRPC Sync - not checked
          Schedule - none
          Gateway - default

          I deleted the rules regarding port 2222, since they weren't working anyway.

          I tried doing screenshots but the forum says my image files are too large and I don't wanna mess with that.

          To answer other questions - yes I have reset the states - And I also did a packet capture on port 22 while making an attempt to connect, and this was the result:

          11:00:28.624981 IP 66.87.74.16.17597 > x.x.x.2.22: tcp 0
          11:00:31.614608 IP 66.87.74.16.17597 > x.x.x.2.22: tcp 0
          11:00:37.626820 IP 66.87.74.16.17597 > x.x.x.2.22: tcp 0

          x's for privacy

          1 Reply Last reply Reply Quote 0
          • J
            jerwiles
            last edited by

            Also worth mentioning, tcpdump isn't logging anything at all when I do "tcpdump port 22" and attempt to connect to the server. Just for testing's sake, I also enabled ssh on the pfsense box and established a connection to it from the LAN side, and ran the same command "tcpdump port 22" and it logged my connection to the pfsense box.

            1 Reply Last reply Reply Quote 0
            • M
              marvosa
              last edited by

              You can use a service like photobucket.com, which will export the html image code… allowing you to post screenshots.

              1 Reply Last reply Reply Quote 0
              • stephenw10S
                stephenw10 Netgate Administrator
                last edited by

                You haven't told us the 'source address' and 'destination address' fields in your NAT rule. Only 'external address' which isn't one of the fields. Confusing!  ;)

                Steve

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

                  ^ exactly.  there is no external address field in nat, do you mean src is set to any.  Then what is your dst address in the nat, it should be wan address.  If you put in the IP address of your server then no it would never work.  Because the wan would never see traffic dest of your private IP address.  All traffic on your wan interface would be a dst of your wan address.

                  Once your wan rule allows the traffic in, then the nat would nat and forward that traffic to where you want it to go.

                  Nor did you list what the source port in your nat rule is set too in your above.  Just post a screen shot.. As to it being too large - what the hell are you using to take it with print screen, that is going to be a BMP file?  Use one of the 1000's of free tools out there to take your screen shot and save it in a format that makes sense, jpg, png, etc.  And they also allow you to reduce size and quality to make for very small size.

                  Windows 7 has the built in snipping tool for example.

                  By default your firewall wan rule should be autocreated when you setup the nat/forward.

                  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
                  • J
                    jerwiles
                    last edited by

                    @stephenw10:

                    You haven't told us the 'source address' and 'destination address' fields in your NAT rule. Only 'external address' which isn't one of the fields. Confusing!  ;)

                    Steve

                    I told you everything that's in the rule…

                    Anyway, the problem with posting screenshots was that I was trying to post all of my screenshots in one post... thus why the forum was saying too large. Anyway, here's screenshots... broken up over multiple posts

                    Attached here is my NAT settings

                    ![SSH Rule NAT.jpg](/public/imported_attachments/1/SSH Rule NAT.jpg)
                    ![SSH Rule NAT.jpg_thumb](/public/imported_attachments/1/SSH Rule NAT.jpg_thumb)
                    ![NAT Rules.jpg](/public/imported_attachments/1/NAT Rules.jpg)
                    ![NAT Rules.jpg_thumb](/public/imported_attachments/1/NAT Rules.jpg_thumb)

                    1 Reply Last reply Reply Quote 0
                    • J
                      jerwiles
                      last edited by

                      And firewall settings

                      ![Firewall Rules.jpg](/public/imported_attachments/1/Firewall Rules.jpg)
                      ![Firewall Rules.jpg_thumb](/public/imported_attachments/1/Firewall Rules.jpg_thumb)

                      1 Reply Last reply Reply Quote 0
                      • J
                        jerwiles
                        last edited by

                        Firewall rule page 1

                        ![Firewall SSH Rule pt1.jpg](/public/imported_attachments/1/Firewall SSH Rule pt1.jpg)
                        ![Firewall SSH Rule pt1.jpg_thumb](/public/imported_attachments/1/Firewall SSH Rule pt1.jpg_thumb)

                        1 Reply Last reply Reply Quote 0
                        • J
                          jerwiles
                          last edited by

                          Firewall rule page 2

                          ![Firewall SSH Rule pt2.jpg](/public/imported_attachments/1/Firewall SSH Rule pt2.jpg)
                          ![Firewall SSH Rule pt2.jpg_thumb](/public/imported_attachments/1/Firewall SSH Rule pt2.jpg_thumb)

                          1 Reply Last reply Reply Quote 0
                          • J
                            jerwiles
                            last edited by

                            Firewall rule page 3

                            ![Firewall SSH Rule pt3.jpg](/public/imported_attachments/1/Firewall SSH Rule pt3.jpg)
                            ![Firewall SSH Rule pt3.jpg_thumb](/public/imported_attachments/1/Firewall SSH Rule pt3.jpg_thumb)

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

                              What version of of sense are you running?  I don't see interface on the nat rule

                              It's on the edit page but not the rule listing.

                              Are you using old 1.x line?

                              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
                              • stephenw10S
                                stephenw10 Netgate Administrator
                                last edited by

                                Hmm, looks like 1.2.3 or earlier. You should update when you have an opportunity to so safely.
                                Anyway you should have 'external address' set to 'interface address'.

                                Steve

                                1 Reply Last reply Reply Quote 0
                                • J
                                  jerwiles
                                  last edited by

                                  I'm using 1.2.3. I have a captive portal with user self registration, which is why the old version. There was a php script posted here on the forums by another user for user self registration that I am using (modified of coarse), but it does not work on 2.0+, just older versions of pfSense.

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

                                    Well couple things – again not seeing WAN as interface on the actual listing of the rules.  But only in your edit, did it get unselected somehow?

                                    Also is that other nat working? And I agree with stephenw10 the external should be set to WAN interface address not any.  Also your edit along with interface, but why would your external port be 22-any, you don't want to foward 23 to 22 do you.  Your dst is ssh-ssh so your external should match that ssh-ssh

                                    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
                                    • J
                                      jerwiles
                                      last edited by

                                      I FOUND THE PROBLEM!  ;D

                                      It actually has to do with the captive portal. I had to add to and from rules in the allowed IP addresses list. I already had added the server's MAC to the MAC Pass-Through list, and thought that was all I needed to do, but I was wrong. Now that I have added the IP address of the server to the "allowed IP addresses" list in Captive Portal section it is working as it should be.

                                      Thank you guys for helping me troubleshoot. :)  You all have been quite helpful!

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