Port Forwarding

Introduction

This page describes how you may reach the inside of your local network from the outside via SSH port forwarding, also known as SSH tunneling.

At home, you may want to configure your wireless gateway/router using a web interface. Then you enter its IP address on your local network, e.g. http://192.168.0.1/. If you want to do this from the outside you can turn on remote management. But what if you feel that remote management is insecure, or if you want to configure some other equipment on a different local address, e.g. a wireless bridge on http://192.168.0.30/? An easy solution, if you have secure shell (ssh) access to a computer on your home network, is port forwarding.

Setup

First, you must have a Linux computer running and accepting connections on the ssh port, 22. You would normally do this in slightly different ways for different Linux distributions, so I will not say anything more about this.
Secondly, you must configure your gateway/router to forward ssh connections to that Linux computer. Look in your gateway's documentation.
Now, you can use your Windows laptop from the Internet (outside your LAN), with PuTTY installed, to make an SSH tunnel into your LAN.

PuTTY Configuration

Under Category, click Connection->SSH->Tunnels.
In Destination, write down the local IP address you would use if you were at home. If it is a web interface, the port is normally 80.
Choose an unused local port on your laptop as source port. Click Add.
Configurating PuTTY for SSH port forwarding

Under category Session, type the IP number (on the WAN side) to the gateway at your home network. Use port 22 (ssh). Click open and log in (on your Linux computer)(not shown).
Connecting to your gateway using PuTTY

Now you are ready to use your browser.

Browsing to your local web interface

Use localhost: as the web address.
Example: Browsing to web page on LAN

From Linux instead of Windows

If your laptop has got Linux instead of Windows, use

ssh -L <unused local port>:<web server on your LAN>:80 <gateway WAN IP>

e.g. "ssh -L 9900:192.168.0.30:80 123.45.67.89".

Reference

http://www.symantec.com/connect/articles/ssh-port-forwarding