Wednesday, October 11, 2006

Tunneling HTTP/WEB/Port 80 traffic(requests) thru SSH

I just bumped into something I've never done before but think is really cool. Tunnelling HTTP/Port 80 traffic through SSH.

A scenario that is valid for me. I would like to view a intranet website that is behind a firewall/router. The website isn't meant for public consumption, but for myself. For instance the D-Link Wireless router DI-724DU configuration page for my home network.

What you need:
(1) Server servicing SSH -- in my case a Gentoo Linux machine running SSHD and configured correctly). Reference name: remotehost.remotedns.org
(2) The DI-724DU (or some other router with port forwarding functionality). Reference name: di724-192-168-0-1 (192.168.0.1 is the default ip)
(3) The SSH port being forwarded to the above named server .
(4) A SSH client -- for me openSSH on an VMWare server with Gentoo on it (outside of my home LAN): Reference name: host.outsidenetwork.com

On the VMWare Gentoo Linux machine that is outside of my home LAN simply type:
(1) ssh -L 2022:192.168.0.1:80 username@remotehost.remotedns.org
where 192.168.0.1 is IP of the router di724-192-168-0-1
(2) Enter the username's password on the remotehost.remotedns.org machine
(3) Start a browser on host.outsidenetwork.com. Enter http://localhost:2022.

You will get the webpage of the D-Link DI-724 wireless router.

Cool! Simple as 1,2,3!

No comments: