SSH - SSH into a host, under a router which you don't have access (can't forward the port)

0

Host A wants to ssh into Host B which is behind a router. We don't have access to the router of Host B, so we can't do port forwading.

Which other alternatives are there for allowing Host A to ssh into Host B?

ferit

Posted 2016-03-08T21:41:58.340

Reputation: 139

Quick comment, there is something called reverse SSH, maybe this could be of help to you? Reverse SSH means you ssh from host B to host A and reverse the connection, you can SSH this way – Maarten – 2016-03-08T22:33:58.003

@MaartenOlijve Can you please give an example with working commands? – ferit – 2016-03-08T23:06:18.943

Answers

1

One alternative that I've used for this purpose is to set up a VPN with an access point somewhere reachable by both Host A and Host B, i.e. somewhere on the internet. I suggest looking into OpenVPN and its examples. This way you can virtualize a network through which you can access any other hosts connected as if they were on the same network.

OpenVPN is pretty powerful, so providing a step-by-step guide would be beyond the scope of this answer.

Jarmund

Posted 2016-03-08T21:41:58.340

Reputation: 5 155

1This is also known as a "jump server" - and the only way to get around the lack of port forwarding, as far as I am aware, +1 – Sam3000 – 2016-03-08T21:54:49.327

0

There is one more alternative. Give host B regular IP address. Not NATTing, no RFC1918 IPs. Just a normal IP. Then (firewall rules allowing) everyone can ssh directly to host B.

Hennes

Posted 2016-03-08T21:41:58.340

Reputation: 60 739

Can you explain how? – ferit – 2016-03-08T23:00:11.680

Log in on host A (e.g. your own desktop) and type ssh hostB.domainfromB.tld. That should just work. It only gets harder if firm B adds firewalls, or does not give B a direclty reachable IP. Then you need to work around these barriers. (And for hosts B which are at home there often is such a barrier in the form or NAT, caused by us running out of IP v4 addresses and ugly workarounds. This is temporarily though. IPv6 and a much bigger IP pool has been introduced a few decades ago and is slowly getting implemented). – Hennes – 2016-03-09T06:50:24.897

So you mean ssh public_ip.private_ip ? Do I need to tell, Host B is also a personal computer under a router, there is no firm. – ferit – 2016-03-10T03:19:50.570