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

    SSH NAT to another network

    Scheduled Pinned Locked Moved NAT
    27 Posts 3 Posters 3.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.
    • D
      dgiorgio
      last edited by

      I'm trying to remotely access the OpenWRT router.
      I created a NAT in pfsense to redirect connections.

      192.168.0.132:2222 -> 192.168.10.1:22

      I try to connect my PC to the IP 192.168.0.132 and the port 2222. I have no success.
      Screenshot_20160925_163229.png
      Screenshot_20160925_163229.png_thumb
      ![SSH OPENWRT.dia.jpg](/public/imported_attachments/1/SSH OPENWRT.dia.jpg)
      ![SSH OPENWRT.dia.jpg_thumb](/public/imported_attachments/1/SSH OPENWRT.dia.jpg_thumb)

      1 Reply Last reply Reply Quote 0
      • D
        dgiorgio
        last edited by

        I try to connect with the command.

        ssh -p 2222 root@192.168.0.132

        The pfsense can connect in OpenWRT, but NAT is not working.

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

          Wrong interface? I think you want LAN, not WAN.

          Please correct any obvious misinformation in my posts.
          -Not a professional; an arrogant ignoramous.

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

            Actually, it seems like you are just trouble-shooting incorrectly. You need to test from a remote/external IP, not a LAN IP, or enable NAT loopback.

            Please correct any obvious misinformation in my posts.
            -Not a professional; an arrogant ignoramous.

            1 Reply Last reply Reply Quote 0
            • D
              dgiorgio
              last edited by

              I am changing settings in OpenWRT, but have not had success.
              and also do not know if the problem is in OpenWRT.

              follow my network settings.

              router: 192.168.0.1
              OpenWRT: 192.168.10.1
              PC: 192.168.0.100

              pfsense
              wan: 192.168.0.132
              opt1: 192.168.10.109

              the wan interface is connected to the router
              the opt1 interface on OpenWRT

              DHCP is done in the router and the OpenWRT.

              OpenWRT does not have internet access, it is a router that I use for testing.

              1 Reply Last reply Reply Quote 0
              • D
                dgiorgio
                last edited by

                the cable connected to the OpenWRT is the LAN port

                1 Reply Last reply Reply Quote 0
                • D
                  dgiorgio
                  last edited by

                  I read in some forums, that only works if the pfsense is the gateway.
                  that is the only way the ssh work with this connection mode.

                  This is true?

                  in my network, pfsense is not the gateway, on any network.

                  1 Reply Last reply Reply Quote 0
                  • D
                    dgiorgio
                    last edited by

                    I disabled the dhcp in OpenWRT.
                    enable dhcp in opt1 interface in pfsense.
                    and got access by ssh, why I could not access the other way?

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

                      "in my network, pfsense is not the gateway, on any network."

                      If pfsense is not your gateway how would it work, do you have specific routing to go through pfsense depending on dest/source IP?

                      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.8, 24.11

                      1 Reply Last reply Reply Quote 0
                      • D
                        dgiorgio
                        last edited by

                        this setting is in my house.
                        It is not a corporate network.
                        the pfsense serves to VPN, and study.
                        I installed another router with OpenWRT to study, and I want to isolate this network from my private network.
                        So I put another IP range, and pfsense in the middle, but wanted to access the OpenWRT through my private network, only to set up.

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

                          dude draw your network..  Routing is routing no matter if the network is a home network or a work network ;)  If your going to have downstream routers then you would need to use transit networks.

                          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.8, 24.11

                          1 Reply Last reply Reply Quote 0
                          • D
                            dgiorgio
                            last edited by

                            sorry, but I did not understand how to do this.
                            I have to make a routing on OpenWRT?

                            192.168.0.0/24 -> 192.168.10.109

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

                              So your pfsense natting and its network is behind a nat.

                              so you have this publicIP - wrt 192.168.0.? –- 192.168.0.? wan pfsense lan -- 192.168.10.? ---- 192.168.10.109 SSH Server?

                              So if you want to ssh in that sort of setup from where from the public internet then you would have to forward on wrt 22 to whatever that 192.168.0.x address is for pfsense wan, then on pfsense you would forward 22 to your 192.168.10.109 box.

                              Your going to have issues if your on the 192.168.0 network and want to nat reflect, ie hit the public IP with asymmetrical routing.  In the case of wanting to ssh to 192.168.10.109 from boxes on the 192.168.0 network you would just hit your pfsense wan IP directly and let if forward.

                              If your trying to use pfsense behind a nat, and for an openvpn server into your network directly behind your wrt router your going to have all kinds of asymmetrical routing problems without source natting your openvpn connections.

                              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.8, 24.11

                              1 Reply Last reply Reply Quote 0
                              • D
                                dgiorgio
                                last edited by

                                OpenWRT does not use the network 192.168.0.X

                                router: 192.168.0.1 (DHCP Server)
                                PC: 192.168.0.100

                                OpenWRT: 192.168.10.1 (DHCP Server)

                                pfsense (VM Proxmox)
                                wan: 192.168.0.132
                                opt1: 192.168.10.109

                                –-------------------------------

                                I think that the connection does not work because the OpenWRT not find the ip source.

                                will the OpenWRT seeks ip 192.168.0.100 to close the connection?

                                if I do a routing, every connection to network 192.168.0.0/24 be redirected to the IP 192.168.10.109?

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

                                  What???  So your pfsense is a VM?

                                  Dude grab the napkin and the crayons and draw this..    Makes ZERO sense..

                                  What is connected to what?  Where is your wan/internet?

                                  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.8, 24.11

                                  1 Reply Last reply Reply Quote 0
                                  • D
                                    dgiorgio
                                    last edited by

                                    in the first post I created a diagram

                                    pfsense is not the gateway, and does dhcp, I use pfsense to vpn, and to isolate networks.

                                    in this case it isolates the OpenWRT

                                    I have another interface on pfsense, LAN interface ip 192.168.100.1, it does dhcp to other VMs to isolate game servers.

                                    I did not put the LAN interface in the diagram, because it will be used in this case.

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

                                      Ok.. So you want to get to this openssh from where?  Your PC in you drawing or the internet?  You still need to create a port forward on pfsense.  to the openwrt IP.  Do you have gateway setup on wrt.  Is that connected to wrt wan?  Why is openwrt your dhcp server in this setup?  so 192.168.10.1 is openwrt LAN IP?  And there is nothing behind openwrt - what purpose is it then?  Wireless? It sure can not be the gateway off the 192.168.10 network.

                                      So if you want to get to it from your PC you have to hit your pfsense wan IP on that port 2222, for openwrt to be able to talk back it needs to have a gateway setup that would be pfsense IP in that network 192.168.10.109

                                      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.8, 24.11

                                      1 Reply Last reply Reply Quote 0
                                      • D
                                        dgiorgio
                                        last edited by

                                        got it!

                                        I got to change the settings, and set DHCP on opt1 interface, OpenWRT was set to get IP by DHCP.

                                        that way it worked!

                                        so I can let the dhcp on OpenWRT and set the 192.168.0.109 (pfsense) as the gateway.

                                        I'll try.

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

                                          What possible reason do you want/need wrt to be dhcp server?

                                          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.8, 24.11

                                          1 Reply Last reply Reply Quote 0
                                          • D
                                            dgiorgio
                                            last edited by

                                            because it is not always this router is in my house.

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