Ssh/tunnel: Unterschied zwischen den Versionen

Aus SchnallIchNet
< Ssh
Wechseln zu: Navigation, Suche
Zeile 15: Zeile 15:
  
  
== portbased tunnel ==
+
.ssh/config:
 +
 
 +
DynamicForward 127.0.0.1:1080
 +
 
 +
 
 +
== Local forward ==
 +
 
 +
 
 +
der sshclient 10.10.11.254 wird mein zugriff auf den lokalen port 3389 durch den ssh-server 213.221.106.43 auf das zielsystem 192.168.102.50:3389 weitergeleitet.
  
TODO: Mach et schoen!! ;-)
 
  
 
  beispiel:
 
  beispiel:
Zeile 23: Zeile 30:
 
  csteidl@koblenz$
 
  csteidl@koblenz$
 
  ssh -L 10.10.11.254:3389:192.168.102.50:3389 -f -N root@213.221.106.43
 
  ssh -L 10.10.11.254:3389:192.168.102.50:3389 -f -N root@213.221.106.43
 +
 +
~/.ssh/config:
 +
--------------
 +
LocalForward 10.10.11.254:3389 192.168.102.50:3389
 +
 
   
 
   
 
  allgemeine syntax:
 
  allgemeine syntax:
Zeile 45: Zeile 57:
 
                                                           192.168.102.50 (win)  
 
                                                           192.168.102.50 (win)  
 
                                                             dst_host
 
                                                             dst_host
 +
 +
 +
== Remote Forward ==
 +
 +
der ssh-server 213.221.106.43 kann durch connect auf 127.0.0.1:8000 auf den port 80 des ssh-client 10.10.11.254 zugreifen
 +
 +
ssh -R 127.0.0.1:8000:10.10.11.254:80 213.221.106.43
 +
 +
 +
~/.ssh/config:
 +
 +
RemoteForward 127.0.0.1:8000 10.10.11.254:80

Version vom 9. Juni 2015, 16:01 Uhr

socks proxy

ssh enables me to simply create an ssh-tunnel which provides a socks proxy.
this is really simple!
ssh protocoll version 2 is needed but should prefered anyway... ;-)

ssh [-f] -N -D[ip:]1080 <username>@my.sshenabled.really.huge.bandwith.connected.host.tld

where:

  • -f run in background, otherwise ssh runs in foreground...
  • -N says sshd not to start any application on destination host
  • -D specifies the port to use on the local host (1080)
    • if you do not specify an IP of your local system, localhost (127.0.0.1) is used...
    • keep in mind, that you need to be root to allocate well-known-ports


.ssh/config:

DynamicForward 127.0.0.1:1080


Local forward

der sshclient 10.10.11.254 wird mein zugriff auf den lokalen port 3389 durch den ssh-server 213.221.106.43 auf das zielsystem 192.168.102.50:3389 weitergeleitet.


beispiel:
=========
csteidl@koblenz$
ssh -L 10.10.11.254:3389:192.168.102.50:3389 -f -N root@213.221.106.43

~/.ssh/config:
--------------
LocalForward 10.10.11.254:3389 192.168.102.50:3389


allgemeine syntax:
==================
ssh -L [lokaler_host:]lokaler_port:dst_host:dst_port -f -N user@ssh_host

erklaerung:
===========
beim aufbau eine remotedesktop verbindung an 10.10.11.254:3389 wird dann die 
verbindung von 213.221.106.43 (192.168.102.40) an 192.168.102.50:3389 
weitergeleitet, wobei _nur_ der server 213.221.106.43 verbindung zum server 
192.168.102.50 hat. 

koblenz              ssh_host (NAT)                      ssh_host (real)
10.10.11.254 ---> FW:213.221.106.43:22 ---|1:1 nat|---> 192.168.102.40:22
                                                               |
                                                               |
                                                              3389
                                                               |
                                                               |
                                                               v
                                                          192.168.102.50 (win) 
                                                            dst_host


Remote Forward

der ssh-server 213.221.106.43 kann durch connect auf 127.0.0.1:8000 auf den port 80 des ssh-client 10.10.11.254 zugreifen

ssh -R 127.0.0.1:8000:10.10.11.254:80 213.221.106.43


~/.ssh/config:

RemoteForward 127.0.0.1:8000 10.10.11.254:80