DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Tunnel Traffic Through SSH

  • submit to reddit
        To connect to a specific port on a machine inside of an internal network via a different machine that can access it and has SSH enabled.

ssh -C -L [port]:[internal hostname of machine]:[port] [public machine]

Then use whatever program to connect to, which SSH will forward on to the proper host.

Common ports include:
3389 for Microsoft Remote Desktop/Terminal Services
22 for SSH