ssh port forwarding

Problem:

You are on box A and you want to connect to box C (to some port),but there is not direct connectivity from box A to box C on to a particular port: e.g.

A $ telnet C_IP_OR_NAME C_PORT ( does not work)

However, there is a box B which has connectivity to box C to that port

B $ telnet C_IP_OR_NAME C_PORT ( does work)

Solution:

Assuming you have ssh connectivity from box A to box B, then start port forwarding on box A to be routed to box C via box B:

ssh -f B_USER@B_IP_OR_NAME -L A_PORT:C_IP_OR_NAME:C_PORT -N

that will make every call to the A_PORT on box A to be routed to box C port (C_PORT) via box B

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s