I have a remote machine running a server which I'd like access to locally. However, I can only SSH into the machine, not use any other ports.
I booted up an Amazon EC2 instances and opened all its ports. The plan is to set up a remote tunnel from the machine to the ec2 instance.
On the remote machine, the server is working:
$ links http://localhost:5555/foobs
This accesses the foobs
page correctly. On EC2, I can access port 5555 if a server is hosted there:
$ echo really > index.html
$ python -m SimpleHTTPServer 5555
Serving HTTP on 0.0.0.0 port 5555 ...
Then, from my local browser: http://ec2-xx-xx-xx-xx.compute-1.amazonaws.com:5555/ gives me the "really" page.
However, if I do port forwarding, from the machine:
$ ssh -R 5555:ec2-xx-xx-xx-xx.compute-1.amazonaws.com:5555 -i keys/key.pem [email protected]
Then pointing my browser at http://ec2-xx-xx-xx-xx.compute-1.amazonaws.com:5555/ does not get me the page. The app that uses it gives ERR_CONNECTION_REFUSED
. However, the port is being used. If from the ssh shell that's doing the forwarding I try to run the server on the same port:
$ python -m SimpleHTTPServer 5555
...
socket.error: [Errno 98] Address already in use
What gives? I am not the biggest networking wizard, as might be evident.
From your local machine:
Then you'll have access to port 5555 on the remote machine from your local system. Just point your browser to
http://localhost:5555/
It looks like you need to enable Port Forwarding in Amazon Elastic Load Balancer for the port 5555. Do you use ELB in front of your instance?