LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Port forwarding: Directing traffic to a ssh client (https://www.linuxquestions.org/questions/linux-newbie-8/port-forwarding-directing-traffic-to-a-ssh-client-729153/)

JustinKubicek 05-28-2009 02:28 PM

Port forwarding: Directing traffic to a ssh client
 
Hello everyone,
I'll give you all of the information I have. I'm using UVNC and SingleClick, so far I've gotten it all to work correctly. Here how things work so far, the user downloads the server and it connects to a viewer that is listening on xxx.xxx.xxx.xxx:5500. My problem is that I might be at yyy.yyy.yyy.yyy behind a router. I was wounding it I could open the port on my machine (yyy.yyy.yyy.yyy) and bring that port to xxx.xxx.xxx.xxx:5500, so when the user opens their server to connect to me, xxx.xxx.xxx.xxx forwards all of the traffic to my viewer at yyy.yyy.yyy.yyy:5500. I know that this concept does not only apply to UVNC, so you answers do not need to be specific. Also, there might be a chance that I'll be viewing from a windows machine so I might need to use cygwin or putty. I've gotten it to work part way if I use ssh -g -R *:5500:72.15.37.156:5500 root@host, but only the remote machine has access to the port, I need other machines to be redirected.

thank you for all of your input!

Justin

ramram29 05-29-2009 12:20 PM

The viewer uses random non service ports 1024 to 65535. There is no way to tell what port the viewer is using - it picks them randomly. The server uses only one port 5500 (Usually 5900 or 5800). VNC is simple - clients connect to server. What exactly are you trying to do?

JustinKubicek 05-29-2009 03:43 PM

Thanks for your response. The whole thing gets confusing with SingeClick and VNC, but I can try to explain it in a different way. Lets say I have a domain name, example.com, that points to node1, and I'm at node2. Node1 isn't running a webserver, but I have one running at node2. I want to connect to node1 with node2 using ssh, so when someone visits example.com they see the website that is located at node2. I hope this makes more sense.

Thanks again,
Justin

jamescondron 05-29-2009 03:48 PM

Port forwarding, its in your router config

JustinKubicek 05-29-2009 08:35 PM

Thats how I do it now... The idea here is if I'm at a hotel, or dialing to the internet using a cell phone, etc.

As an update I've gotten it to work using a reverse ssh tunnel. Here is the command:

ssh -R *:80:*:80 host1

The problem now is the only computer that can acess the port on the remote machine, is the remote machine. I need other computers to be able to connect to the remote machine.

Thanks...this whole thing is starting to work.

Justin

JustinKubicek 05-31-2009 12:00 PM

I got it working I had to enable GatewayPorts in /etc/ssh_config and /etc/sshd_config...as layed out in this document, under "Port Forward Security". Thanks for everyone's help!

I wrote a blog post about this at http://www.justinkblog.com/2009/06/u...ile-youre.html.


All times are GMT -5. The time now is 12:38 PM.