In order to activate reverse port forwarding with OpenSSH, assume the computer sitting behind a NAT is labeled ‘home’, and the publicly addressable one is labeled ‘server’. On server, add the following lines to /etc/ssh/sshd_config:

AllowTcpForwarding yes
GatewayPorts yes

On home, add the following lines to ~/.ssh/config:

Host server
User username
IdentityFile ~/.ssh/id_dsa
ExitOnForwardFailure yes
RemoteForward 2200 localhost:22

On home, run the following command:

ssh -fnN server

This command must be running any time you want to make a connection to home.

Now, from any computer with a net connection, you can connect directly to home by opening an ssh connection to server on port 2200.

ssh server -p 2200

© 2010 tepidpond Online Suffusion WordPress theme by Sayontan Sinha