Bounce SSH using NetCat

30 Nov

You can bounce an SSH connection using Netcat (actually you can bounce anything).

e.g. ———– ———— ————–
| internal | —–> | firewall | ——–> | external |
———— ———— ————–

You want to get from internal to external, but have to go through a firewall or something.

On Internal:
– edit ~/.ssh/config and enter in:
Host external
Hostname external
HostKeyAlias external
ProxyCommand /root/nc-tunnel firewall external.domain

Then create the /root/nc-tunnel script:

ssh $bouncehost nc -w 1 $target 22

Thats it, now to connect using this from internal just:
$> ssh external


Leave a Reply

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

You are commenting using your 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

%d bloggers like this: