LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 09-26-2016, 12:21 PM   #1
jeanluca
LQ Newbie
 
Registered: May 2006
Posts: 2

Rep: Reputation: 0
Setup SSH tunnel through proxy


I want to setup a ssh tunnel from SERVER A to SERVER C. However, SERVER C is not public and only accessible through SERVER B.

Now I have access to SERVER B, so I though I could setup a tunnel as follows:

$serverA> ssh root@serverB -L 9000:serverC:9000 -L 9001:serverC:9001 ... -fN

Now, although this command runs fine and I can see the port

$serverA> netstat -tulnp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.11:37192 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 11/ssh
tcp 0 0 127.0.0.1:9001 0.0.0.0:* LISTEN 11/ssh
tcp 0 0 127.0.0.1:9002 0.0.0.0:* LISTEN 11/ssh
tcp 0 0 127.0.0.1:9003 0.0.0.0:* LISTEN 11/ssh
tcp6 0 0 ::1:9000 :::* LISTEN 11/ssh
tcp6 0 0 ::1:9001 :::* LISTEN 11/ssh
tcp6 0 0 ::1:9002 :::* LISTEN 11/ssh
tcp6 0 0 ::1:9003 :::* LISTEN 11/ssh
udp 0 0 127.0.0.11:43149 0.0.0.0:* -

But I don't get any responses from these ports when I connect, for example:

$> telnet localhost 9001
Trying ::1...
Connected to localhost.
Escape character is '^]'.
Connection closed by foreign host.

So the question is, is there something wrong with how I try to set this up. Should I make config-adjustments to SERVER B ? Any help would be appreciated!

Cheers
 
Old 09-26-2016, 01:41 PM   #2
custangro
Senior Member
 
Registered: Nov 2006
Location: California
Distribution: Fedora , CentOS , RHEL
Posts: 1,979
Blog Entries: 1

Rep: Reputation: 209Reputation: 209Reputation: 209
Quote:
Originally Posted by jeanluca View Post
I want to setup a ssh tunnel from SERVER A to SERVER C. However, SERVER C is not public and only accessible through SERVER B.

Now I have access to SERVER B, so I though I could setup a tunnel as follows:

$serverA> ssh root@serverB -L 9000:serverC:9000 -L 9001:serverC:9001 ... -fN

Now, although this command runs fine and I can see the port

$serverA> netstat -tulnp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.11:37192 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 11/ssh
tcp 0 0 127.0.0.1:9001 0.0.0.0:* LISTEN 11/ssh
tcp 0 0 127.0.0.1:9002 0.0.0.0:* LISTEN 11/ssh
tcp 0 0 127.0.0.1:9003 0.0.0.0:* LISTEN 11/ssh
tcp6 0 0 ::1:9000 :::* LISTEN 11/ssh
tcp6 0 0 ::1:9001 :::* LISTEN 11/ssh
tcp6 0 0 ::1:9002 :::* LISTEN 11/ssh
tcp6 0 0 ::1:9003 :::* LISTEN 11/ssh
udp 0 0 127.0.0.11:43149 0.0.0.0:* -

But I don't get any responses from these ports when I connect, for example:

$> telnet localhost 9001
Trying ::1...
Connected to localhost.
Escape character is '^]'.
Connection closed by foreign host.

So the question is, is there something wrong with how I try to set this up. Should I make config-adjustments to SERVER B ? Any help would be appreciated!

Cheers
Does it work if you do the command individually? Without multiple `-L`?
 
Old 09-26-2016, 01:53 PM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,672

Rep: Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892
No. See the following on how to ssh via a proxy.

http://www.linuxquestions.org/questi...sh-4175590163/

Last edited by michaelk; 09-26-2016 at 03:31 PM. Reason: Update
 
Old 09-28-2016, 01:15 PM   #4
jeanluca
LQ Newbie
 
Registered: May 2006
Posts: 2

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by michaelk View Post
No. See the following on how to ssh via a proxy.

http://www.linuxquestions.org/questi...sh-4175590163/
Thanks for helping. Right now I think it might be something with the ports being bind to 127.0.0.1 with the results that they are not accessible from the outside. Its still a theory
 
Old 09-28-2016, 02:11 PM   #5
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,672

Rep: Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892
What are you trying to accomplish?

What service running on port 9000/9001 on server C are you trying to tunnel?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Ssh tunnel to web site behind Nginx proxy devent Linux - Server 7 01-30-2014 06:46 AM
Need help for SSH tunnel through NTLM-authenticated HTTP proxy theYinYeti Linux - Networking 3 02-25-2012 02:15 PM
Connect to a proxy through a middle host with a ssh tunnel iacchi Linux - Networking 3 02-16-2012 12:02 PM
ftp proxy via ssh tunnel on server side using what? drobert Linux - Software 3 05-09-2011 04:38 PM
How do I set up an ssh tunnel through a http proxy? wilko Linux - Networking 2 03-10-2010 01:05 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:31 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration