Can ping but not ssh

[I think I figure out: the router/firewall does not allow any port other than 22 to be forward to the host machine...]

Strange. SSH refused on any port other than 22. Can ping my desktop(host) from my laptop, but cannot ssh. it always says 'operation timed out'. It only works with the default port 22. Have to change back.

sshd is enabled in /etc/rc.conf


changed the port to 77, 1777, 17777, but none works.

Can ssh on the host machine: ssh localhost


Code:
ssh -p xxxx user@ip
cannot connect to host ip port xxxx: operation timed out
Code:
sockstat -4p 1777
USER     COMMAND    PID   FD PROTO  LOCAL ADDRESS         FOREIGN ADDRESS
root     sshd       17798 4  tcp4   *:1777                *:*

Code:
grep 777 /etc/services
multiling-http  777/tcp    #Multiling HTTP
multiling-http  777/udp    #Multiling HTTP

Code:
#sysctl -a | grep portrange
net.inet.ip.portrange.randomtime: 45
net.inet.ip.portrange.randomcps: 10 
net.inet.ip.portrange.randomized: 1 
net.inet.ip.portrange.reservedlow: 0
net.inet.ip.portrange.reservedhigh: 1023
net.inet.ip.portrange.hilast: 65535     
net.inet.ip.portrange.hifirst: 49152    
net.inet.ip.portrange.last: 65535       
net.inet.ip.portrange.first: 10000      
net.inet.ip.portrange.lowlast: 600      
net.inet.ip.portrange.lowfirst: 1023
 
Next time you have an issue like this, do a simple test to see if you can complete a tcp handshake.

% nc -zvw 1 <host_here> <port_here>

If that is not successful, there is no need to continue trying to troubleshoot at the application layer.
 
anomie said:
Next time you have an issue like this, do a simple test to see if you can complete a tcp handshake.

% nc -zvw 1 <host_here> <port_here>

If that is not successful, there is no need to continue trying to troubleshoot at the application layer.

Thanks. very helpful.
 
Back
Top