Tunneling Through a Remote Firewall Using SSH Commands

If you’re dealing with systems behind a firewall it’s almost inevitable that you will need to tunnel into those systems from time to time.  Fortunately, there are some quick & easy commands to accomplish this.  In this example, we are going to use a Mac OSX or linux-based system, to gain access to a web server’s port 80 on a fire-walled server.

Let’s say the domain of the remote server is dfrn.net, the fire-walled server has an IP address of and the firewalled server has a web server at port 80.  We need to choose an unused port on our own system, in this case we’ll use 2020.

So our side of the tunnel is going to be http://localhost:2020/ and the other side of the tunnel will be

ssh root@dfrn.net -L 2020:

root@dfrn.net's password:

So, now port 80 on the fire-walled server will be accessible by simply pointing your web browser to http://localhost:2020/.  To terminate the tunnel, simply exit the shell.

Leave a Reply

Your email address will not be published. Required fields are marked *