Click to See Complete Forum and Search --> : SSH Port Forwarding to a port in use...
williamp0044
06-28-2005, 01:43 PM
I currently have two computer one running Linux and the other running Windows. I am trying to get ssh port forwarding to work except that when I type ssh -L port:host1:port host2 the port forwarding goes trough only if the port is not being used by an application. I have a server application running on port 8129 on the windows machine and what I want is for any requests to port 8129 on the Linux machine to be forwarded to the windows machine so the server application can respond accordingly. But when I use the method stated above there seems to be a conflict, either the port forward will work but the server application is not able to start on that port or the server application works but the port forward will not go trough. How can I accomplish my task?
Sorry if everything sounds soo vague I could fully get my thoughts into words....
bassman
06-28-2005, 02:05 PM
Post the exact command you are using (without smilies :D). By the way, are you inserting credentials like your username after the command?
williamp0044
06-28-2005, 04:51 PM
The smiley face is a result of the forum options. The actual code is:
ssh -L 666: Ra :666 Thoth
This is the code without spaces in between the 666. The credentials are not a problem because I am always able to get by that.
bassman
06-28-2005, 04:57 PM
Originally posted by williamp0044
The smiley face is a result of the forum options. The actual code is:
ssh -L 666: Ra :666 Thoth
This is the code without spaces in between the 666. The credentials are not a problem because I am always able to get by that.
I was joking about the smileys.
The command seems OK :confused: What do you mean by "the port forwarding goes trough only if the port is not being used by an application." What port are you referring to? The destination port, on Ra? Or the "source" port (the local, from which the data is redirected)?
Are those the ports you are actually using or is that just an example? Wasn't it 8129? On Linux you'll only be able to bind a reserved port if you run ssh with root privileges (which isn't very safe). If you're using those ports, try using something out of the reserved rangem the error may reside there (doubtfully, it should report another error before, but it won't hurt to try). Any firewalls on the way?
williamp0044
06-28-2005, 06:46 PM
Ok so Thoth is the windows machine and on Thoth there is a program called BeyondTV which runs a server on the port 8129. Now what I am trying to do is get my linux computer (Ra) to act as a router by forwarding any requests given to Ra on port 8129 to Thoth on port 8129. The only thing is that the ssh port forwarding mechanism and the beyondtv sever seem to have a port conflict. I would sometimes get an error from BeyondTV stating that the port is in use (this is when the port forwarding command was sucessful and the port forwarding command is only sucessful is the BeyondTV server is not already running).
williamp0044
06-28-2005, 06:48 PM
Sorry my methods of explaining things are not understandable. For me its one of those thigns I can picture perfectly in my head but cannot express my thoughts accordingly.
bassman
06-28-2005, 07:03 PM
Originally posted by williamp0044
I would sometimes get an error from BeyondTV stating that the port is in use (this is when the port forwarding command was sucessful and the port forwarding command is only sucessful is the BeyondTV server is not already running).
That shouldn't happen - you're not running any other software that binds/listens/uses port 8129 on the Windows machine, are you? On what port is the ssh session server running on the Windows machine? Do check it: start a command line and run "netstat -a", see what comes up on port 8129. I'm guessing you're trying to run the ssh server on the same port as BeyondTV.
williamp0044
06-28-2005, 10:35 PM
The ssh server runs on port 22. There is an error with BeyondTV only when I try to run the tunneling command.
bassman
06-29-2005, 05:09 AM
What does netstat say?
williamp0044
06-29-2005, 02:48 PM
Here is the output for netstat:
Active Connections
Proto Local Address Foreign Address State
TCP thoth:22 thoth:0 LISTENING
TCP thoth:http thoth:0 LISTENING
TCP thoth:epmap thoth:0 LISTENING
TCP thoth:microsoft-ds thoth:0 LISTENING
TCP thoth:1025 thoth:0 LISTENING
TCP thoth:1028 thoth:0 LISTENING
TCP thoth:1029 thoth:0 LISTENING
TCP thoth:1031 thoth:0 LISTENING
TCP thoth:1755 thoth:0 LISTENING
TCP thoth:3389 thoth:0 LISTENING
TCP thoth:3483 thoth:0 LISTENING
TCP thoth:5800 thoth:0 LISTENING
TCP thoth:5900 thoth:0 LISTENING
TCP thoth:8129 thoth:0 LISTENING
TCP thoth:8130 thoth:0 LISTENING
TCP thoth:8131 thoth:0 LISTENING
TCP thoth:8132 thoth:0 LISTENING
TCP thoth:8134 thoth:0 LISTENING
TCP thoth:8135 thoth:0 LISTENING
TCP thoth:9000 thoth:0 LISTENING
TCP thoth:9090 thoth:0 LISTENING
TCP thoth:31038 thoth:0 LISTENING
TCP thoth:51334 thoth:0 LISTENING
TCP thoth:1028 localhost:8131 ESTABLISHED
TCP thoth:1029 localhost:8132 ESTABLISHED
TCP thoth:1031 localhost:8134 ESTABLISHED
TCP thoth:8131 localhost:1028 ESTABLISHED
TCP thoth:8132 localhost:1029 ESTABLISHED
TCP thoth:8134 localhost:1031 ESTABLISHED
TCP thoth:netbios-ssn thoth:0 LISTENING
TCP thoth:5900 192.168.1.104:1453 ESTABLISHED
UDP thoth:epmap *:*
UDP thoth:microsoft-ds *:*
UDP thoth:isakmp *:*
UDP thoth:1026 *:*
UDP thoth:1030 *:*
UDP thoth:1755 *:*
UDP thoth:1900 *:*
UDP thoth:3483 *:*
UDP thoth:ntp *:*
UDP thoth:1034 *:*
UDP thoth:ntp *:*
UDP thoth:netbios-ns *:*
UDP thoth:netbios-dgm *:*
UDP thoth:1900 *:*
bassman
06-29-2005, 03:23 PM
Wait a minute; Ra is the Linux box, and Toth is the Windows box, correct? Try this command: "ssh -L 8129:Toth:8129 Thoth" or "ssh -L 8129:127.0.0.1:8129 Thoth"
williamp0044
06-29-2005, 04:31 PM
Would that forward requests from Ra to Thoth?
bassman
06-29-2005, 05:10 PM
Yes, try it ;) If you issue "ssh -L 1234:A:5678 B" you're really saying "whatever comes to this network adapter, destinated to port 1234, should be forwarded to ssh server running on B, that will decrypt it and forward it to A on port 5678". So it sure looks like a syntax error that got by us both.
williamp0044
06-30-2005, 12:33 AM
I keep getting:
bind: Address already in use
channel_setup_fwd_listener: cannont listen to port: 8129
bassman
06-30-2005, 05:00 AM
Run netstat on the Linux machine and re-run the command in verbose mode: "ssh -v -L 8129:Toth:8129 Thoth". Post they're output here. You don't have to poast the whole output of netstat just what results for port 8129 (netstat -a | grep 8129)
broadmind
01-04-2006, 11:17 AM
I currently have two computer one running Linux and the other running Windows. I am trying to get ssh port forwarding to work except that when I type ssh -L port:host1:port host2 the port forwarding goes trough only if the port is not being used by an application. I have a server application running on port 8129 on the windows machine and what I want is for any requests to port 8129 on the Linux machine to be forwarded to the windows machine so the server application can respond accordingly. But when I use the method stated above there seems to be a conflict, either the port forward will work but the server application is not able to start on that port or the server application works but the port forward will not go trough. How can I accomplish my task?
Sorry if everything sounds soo vague I could fully get my thoughts into words....
Your command seems fine. What seems to be happening, is that the port you are using on your local machine is already in use. You might be running the same server as in your remote windows box, perhaps. Can you either uninstall the server off your local box, or use an alternate port? e.g. ssh -L 5200:host1:8129 host2 so that you can connect to the localhost on port 5200 (possibly unnused)?
SysOpt.com
Copyright Internet.com Inc. All Rights Reserved.