"channel 3: open failed: connect failed: Connection ref

I have several computers on my office network that are each running OSXvnc. The configuration is identical:

Internal IP address 192.168.1.1 has SSHd running on port 55100 and OSXvnc listening on port 5901
Internal IP address 192.168.1.2 has SSHd running on port 55200 and OSXvnc listening on port 5902
Internal IP address 192.168.1.3 has SSHd running on port 55300 and OSXvnc listening on port 5903
…etc.

The internal IP addresses are fixed. The router has port forwarding enabled so I can SSH into the appropriate machine by specifying the port number.

So, from home, to get on machine 192.168.1.4 using a vnc client I go into terminal and type:

ssh -L 5904:localhost:5904 -p 55400 myusername@[external IP address]

This starts up the SSH session, no problem. Then in my VNC client I would connect to localhost:5904 to administer that machine.

For no reason I can tell, some machines have decided to stop allowing me to connect. I can SSH into all of them through the router and firewall, no problem, and lsof shows OSXvnc-server listening on the correct ports. But some of the machines, which used to work and have not been changed, now just say “The server closed the connection” and in the terminal SSH session I get the message “channel 3: open failed: connect failed: Connection refused”.

I have checked the router and software firewalls, there is no problem, the correct port is open in all cases.

This is driving me nuts and preventing me from doing my job. The configuration is the same on all machines except for the port numbers, which are all set correctly according to the scheme above, and, like I said, used to work on all of them and now without rhyme nor reason has stopped allowing me to connect on some but not others.

Doing a ps from terminal on one of the machines which I can SSH but not vnc into shows


root      399   0.0  0.2    18644    588 std- S    10:39PM   0:00.05  31   0:00.04   0:00.01 sh /Library/StartupItems/OSXvnc/OSXvnc-keepalive /Applications/OSXvnc.app/OSXvnc-server -rfbport 5904 -desktop Number4-Computer.local -restartonuserswitch N -keyboardLoading N -pressModsForKeys N -swapButtons -rendezvous N -rfbauth /Library/StartupItems/OSXvnc/.osxvncauth
root      401   0.0  0.7    53288   2452 std- S    10:39PM   0:00.27  31   0:00.08   0:00.19 /Applications/OSXvnc.app/OSXvnc-server -rfbport 5904 -desktop Number4-Computer.local -restartonuserswitch N -keyboardLoading N -pressModsForKeys N -swapButtons -rendezvous N -rfbauth /Library/StartupItems/OSXvnc/.osxvncauth
number4   466   0.0  0.1    18128    332 std  R    11:27PM   0:00.01  29   0:00.01   0:00.00 grep vnc

Anyone have any idea what is going wrong?

The only thing I can think of that might help you out. Try not using “localhost” in the SSH tunnel construction because on some machines this will resolve to the IPv6 address which can cause problems if not properly configured.

Instead use “127.0.0.1” in those commands and see if that helps.

Amazing… that was the problem. I wish that was clearly documented somewhere. (Or did I not RTFM?) Thanks a million for the assist!

Well, the OSXvnc documentation is something we are actively working on improving but in this case it is documented in the FAQ (if you know where to look):

http://www.redstonesoftware.com/osxvnc/OSXvnc.html#SSH

Glad that solved it for you!