ssh tunnel when no public IP

Connect client to server via ssh tunnel where client and server have to create a tunnel.

First redirect port 2222 on client to port 2223 on intermediary. Second redirect port 2223 on intermediary to port 22 on server. Finally connect to localhost on port 2222.

Client

$ ssh xx@intermediary -L 2222:localhost:2223

Server

$ ssh xx@intermediary -R 2223:localhost:22

Client

$ ssh yy@server -p 2222

client -> (2222 -> 2223) gateway (2223 -> 22) <- server
client ->  2222 ------------------------- 22 -> server

Django

Passionate Django developer with 10 years of experience on web sites and API's.

Bike

What else? Yachts are also a great but they don't fit well in cities.

FLOSS

Code is knowled. Knowled should be shared.