1

The setup is as follow: I'm on a private network 192.168.1.0/24

I need to access a webpage on my browser from a server hystrix to which I don't have a direct connection. Usually, to access that page, I connect to another server (bast01) to which I have direct access via ssh port and belongs to the same network as the server I need to access and there I open a browser and access the needed webpage via a weblink like: http://hystrix:8080/hystrix/monitor?stream=http://gateway03:8080/hystrix.stream

I would need an ssh tunnel to access the link via localhost on 8080.

I can access the bast01 via ssh.

Any help would be highly appreciated.

Thank you, Gabriel

1 Answer 1

1

Easy. As you said you need a tunnel. We'll make one.

ssh -L 8080:bast01:8080 myuser@bast02

You log in normally, and you could use anything you normally use in an ssh session. However, it did something else. It told ssh that you want a port on your local machine, namely 8080 (that's the first 8080), to tunnel to bast01 on port 8080, using bast02 (the one you are logging in to). Do note, that your own machine does not need to be able to resolve (DNS) the name bast01, the name must be resolvable by bast02. Obviously bast02 needs to be resolvable from your desktop.

At this point, you point your browser to: http://localhost:8080 Voilà... You now see the login page (or whatever) that is hosted on port 8080 of bast01.

Now, bast01 might use vhosts, and in that case your browser will sent the hostname it wants to the server. In this case, the server will receive "localhost" as a name and it might not know what to do with it. If that's the case, temporary edit your hosts file (on the machine where you issue the ssh command, typically your desktop) and add:

127.0.01 hystrix

(or whatever name you need to use)

2
  • Thank you for your answer. I have edited my post because I had a typo. The server I need to access via bast01 is hystrix on port 8080. As I was saying, in order to do that I usually go to bast01 via ssh and then curl to hystrix.
    – gbaii
    Aug 10, 2016 at 13:04
  • Well, I hoped I gave you enough information so you'd figure out the way to use this without me giving premade commands. I'd rather have you understand what I told. Here you go, this is what you need: ssh -L 8080:hystix:8080 youruser@bast01 Might help understanding what the command actually does too ;-) Then point your browser to localhost:8080. The vhost comment still aplies (just test, if it works, you don't need to add anything to the hosts file) Aug 10, 2016 at 13:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .