author | Oleksandr Gavenko <gavenkoa@gmail.com> |
Tue, 07 Jun 2011 15:00:40 +0300 | |
changeset 878 | 719703185d67 |
parent 371 | 0664ebefacb1 |
child 1240 | 70c6a3153bc7 |
permissions | -rw-r--r-- |
261
0332d38237db
Rename ssh article to remote-shell.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
4
diff
changeset
|
1 |
-*- mode: outline; coding: utf-8 -*- |
1
743f7a15697a
Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
2 |
|
371 | 3 |
* Reverse SSH Tunneling |
4
c676a664a5ef
Reverse SSH Tunneling.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1
diff
changeset
|
4 |
|
c676a664a5ef
Reverse SSH Tunneling.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1
diff
changeset
|
5 |
Have you ever wanted to ssh to your Linux box that sits behind NAT? Now you can with |
c676a664a5ef
Reverse SSH Tunneling.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1
diff
changeset
|
6 |
reverse SSH tunneling. This document will show you step by step how to set up reverse SSH |
c676a664a5ef
Reverse SSH Tunneling.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1
diff
changeset
|
7 |
tunneling. The reverse SSH tunneling should work fine with Unix like systems. |
c676a664a5ef
Reverse SSH Tunneling.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1
diff
changeset
|
8 |
|
c676a664a5ef
Reverse SSH Tunneling.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1
diff
changeset
|
9 |
Let's assume that Destination's IP is 192.168.20.55 (Linux box that you want to access). |
c676a664a5ef
Reverse SSH Tunneling.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1
diff
changeset
|
10 |
|
c676a664a5ef
Reverse SSH Tunneling.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1
diff
changeset
|
11 |
You want to access from Linux client with IP 138.47.99.99. |
c676a664a5ef
Reverse SSH Tunneling.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1
diff
changeset
|
12 |
Destination (192.168.20.55) <- |NAT| <- Source (138.47.99.99) |
c676a664a5ef
Reverse SSH Tunneling.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1
diff
changeset
|
13 |
|
c676a664a5ef
Reverse SSH Tunneling.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1
diff
changeset
|
14 |
SH from the destination to the source (with public ip) using command below: |
c676a664a5ef
Reverse SSH Tunneling.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1
diff
changeset
|
15 |
|
c676a664a5ef
Reverse SSH Tunneling.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1
diff
changeset
|
16 |
$ ssh -R 19999:localhost:22 sourceuser@138.47.99.99 |
c676a664a5ef
Reverse SSH Tunneling.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1
diff
changeset
|
17 |
|
c676a664a5ef
Reverse SSH Tunneling.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1
diff
changeset
|
18 |
port 19999 can be any unused port. |
c676a664a5ef
Reverse SSH Tunneling.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1
diff
changeset
|
19 |
Now you can SSH from source to destination through SSH tuneling: |
c676a664a5ef
Reverse SSH Tunneling.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1
diff
changeset
|
20 |
|
c676a664a5ef
Reverse SSH Tunneling.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1
diff
changeset
|
21 |
$ ssh localhost -p 19999 |
c676a664a5ef
Reverse SSH Tunneling.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1
diff
changeset
|
22 |
|
c676a664a5ef
Reverse SSH Tunneling.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1
diff
changeset
|
23 |
3rd party servers can also access 192.168.20.55 through Destination (138.47.99.99). |
c676a664a5ef
Reverse SSH Tunneling.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1
diff
changeset
|
24 |
Destination (192.168.20.55) <- |NAT| <- Source (138.47.99.99) <- Bob's server |
c676a664a5ef
Reverse SSH Tunneling.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1
diff
changeset
|
25 |
|
c676a664a5ef
Reverse SSH Tunneling.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1
diff
changeset
|
26 |
From Bob's server: |
c676a664a5ef
Reverse SSH Tunneling.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1
diff
changeset
|
27 |
|
c676a664a5ef
Reverse SSH Tunneling.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1
diff
changeset
|
28 |
$ ssh sourceuser@138.47.99.99 |
c676a664a5ef
Reverse SSH Tunneling.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1
diff
changeset
|
29 |
|
c676a664a5ef
Reverse SSH Tunneling.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1
diff
changeset
|
30 |
After the sucessful login to Source: |
c676a664a5ef
Reverse SSH Tunneling.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1
diff
changeset
|
31 |
|
c676a664a5ef
Reverse SSH Tunneling.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1
diff
changeset
|
32 |
$ ssh localhost -p 19999 |
c676a664a5ef
Reverse SSH Tunneling.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1
diff
changeset
|
33 |
|
c676a664a5ef
Reverse SSH Tunneling.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1
diff
changeset
|
34 |
The connection between destination and source must be alive at all time. Tip: you may run |
c676a664a5ef
Reverse SSH Tunneling.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1
diff
changeset
|
35 |
a command (e.g. watch, top) on Destination to keep the connection active. |
262 | 36 |
|
37 |
* Ajaxterm. |
|
38 |
||
39 |
Allow remote shell access to host from web browser (require html+css+javascript). |
|
40 |
||
41 |
http://antony.lesuisse.org/software/ajaxterm |
|
42 |
home page |