Find the answer to your Linux question:
Results 1 to 2 of 2
Hi, given the situation: Host1 --- SSH(22) ---> Host2 ---- (7007) ---> Host3 10.0.0.1 --- (22) ---> 192.168.0.1 --- (7007) ---> 172.16.0.1 I need to access port 7007 on Host3 ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Sep 2010
    Posts
    1

    SSH tunnel assistance needed


    Hi, given the situation:

    Host1 --- SSH(22) ---> Host2 ---- (7007) ---> Host3
    10.0.0.1 --- (22) ---> 192.168.0.1 --- (7007) ---> 172.16.0.1

    I need to access port 7007 on Host3 (172.16.0.1:7007)
    from Host1 (10.0.0.1) using access through Host2 (192.168.0.1) to whom I have only SSH access (port 22)

    I need this to be done as a transparant route seen from Host1 and I have no access to Host3, eg. on Host1
    I should be able to access port 7007 using eg. telnet directly....

    Host 1 & 2 are both Linux servers under my full control and are OpenSSH enabled...

    How do I set this up??

    Thanks a bundle in advance for any assistance setting this up.

    Best regards!

  2. #2
    Linux Enthusiast
    Join Date
    Jan 2005
    Location
    Saint Paul, MN
    Posts
    675
    Quote Originally Posted by ncsjohndoe View Post
    Hi, given the situation:

    Host1 --- SSH(22) ---> Host2 ---- (7007) ---> Host3
    10.0.0.1 --- (22) ---> 192.168.0.1 --- (7007) ---> 172.16.0.1

    I need to access port 7007 on Host3 (172.16.0.1:7007)
    from Host1 (10.0.0.1) using access through Host2 (192.168.0.1) to whom I have only SSH access (port 22)

    I need this to be done as a transparant route seen from Host1 and I have no access to Host3, eg. on Host1
    I should be able to access port 7007 using eg. telnet directly....

    Host 1 & 2 are both Linux servers under my full control and are OpenSSH enabled...

    How do I set this up??

    Thanks a bundle in advance for any assistance setting this up.

    Best regards!
    Code:
             +-------------+        +-------------+           +------------+ 
             |  localhost  |        | 192.168.0.1 |           | 172.16.0.1 |
             |  10.0.0.1   |        |             |           |            |
             |             |----->22|             |-------->22|            |
             |             |        |             |           |            |
        >8000------------------>8016--------------------->7007|            |
             |             |        |             |           |            |
             +-------------+        +-------------+           +------------+ 
    
    via the command:
    
       1) Connect to 192.168.0.1 via ssh
    
              ssh -L 8016:localhost:8000 user@192.168.0.1
    
       2) Now that you are on 192.168.0.1 connect to 172.16.0.1
    
              ssh user@172.16.0.1 -L 8016:localhost:7007
    
    Now that you have a connection on 10.0.0.1 port 8000 that is really connected
    to port 7007 on 172.16.0.1.
    You will need to have a valid login on all three machines.

    Of course the connection is only good while the two ssh are both in place.

    The ports 8000 and 8016 can easily be other port numbers.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •