Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I was wondering if there was a way to connect over ssh "backwards". For example, lets say there's a client connected to example.com via ssh from behind a router. Well you wouldn't be able to ssh to that client unless the proper ports were forwarded on the router right? So I'm wondering if there would be a way to connect to example.com through ssh then from there connect to the client using the already existing ssh connection. Thanks to any responders.
You can make a connection but not specifically ssh.
What you want is on the machine behind the firewall, run a ssh to some external client, but not to set up a ssh terminal link, but to set-up a port forward on the external client back to the normal ssh port on the firewalled machine.
Later on the extrnal client (or if you allow it, some other host to that port on the external client), you ssh to that previously setup 'local port forward' and hey presto you are connected to the normal ssh port of the firewalled machine.
Its basically a ssh into the firewall via a ssh port forward previously set-up from inside the firewall
You can not use this for laptops or things not permanently on the net, as the firewalled machine must set-up the port forward.
Though you could have that machine 'test' the port forward is running, and re-try setting it up at regular intervals. This way if you have a roaming laptop, (which has say a dynamic DNS) the port forward and be initialised and you can connect to your firewalled host.
Note the simplest way is to actually setup a proper port forward on your router. I do this, and as my home router has a port forward to port 22 on my home machine, but it is NOT port 22 on the router. As my router has dynamic dns I can login to my home machines no matter what IP it or I am on.
But if you can't do that try the port forward solution.
In fact, it's a remote forward. Have a look at the -R option to ssh. You can use this set up port on the outside machines then. To keep it alive, you can think about autossh and using an ssh-key.
Remember that you have to initiate the connection from the computer which is behind the firewall and everything to your computer. But then you have access from your computer to the host behind the firewall.
If your computer is also behind a firewall, then you need a third computer which is open for SSH to both of you. If you can keep straight what is remote and what is local, use this guide:
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.