You are not logged in.

#1 2013-12-18 07:34:58

rezahousseini
Member
Registered: 2013-09-06
Posts: 17

SSH refuses to connect randomly

I have a server which I access over ssh. But sometimes my system refuses to connect, either by domain name or by IP. Altough the server is still accessible from another computer.
Sometimes restarting solves the problem but not everytime. Is there a known reason for that? I searched the web but didn't find any hints.

Trying the Troubleshoot [1] section from the Arch Wiki didn't help either.

Thanks for any hints!

Cheers Reza



[1] https://wiki.archlinux.org/index.php/Se … leshooting

Offline

#2 2013-12-18 07:40:00

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: SSH refuses to connect randomly

What does "refuses to connect mean"? Run it with the verbose flags and paste actual error messages.
Also, please include details about how you connect: public key, password, PUTTY etc.

Currently, you have not provided enough information for anyone to offer any real help.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2013-12-18 08:36:09

rezahousseini
Member
Registered: 2013-09-06
Posts: 17

Re: SSH refuses to connect randomly

Sorry for my ignorance, here my output:

I get the following error message

    ssh: connect to host 160.XX.XX.XX port 22: Connection timed out

When I run it with the verbose flag I get

    OpenSSH_6.4, OpenSSL 1.0.1e 11 Feb 2013
    debug1: Reading configuration data /home/hous/.ssh/config
    debug1: Reading configuration data /etc/ssh/ssh_config
    debug2: ssh_connect: needpriv 0
    debug1: Connecting to 160.XX.XX.XX [160.XX.XX.XX] port 22.
    debug1: connect to address 160.XX.XX.XX port 22: Connection timed out
    ssh: connect to host 160.XX.XX.XX port 22: Connection timed out

my ~/.ssh/config file looks like this

    ForwardX11 yes
    ForwardX11Trusted yes
    SendEnv WINDOWID

And the output of ss -tnlp looks like

    State      Recv-Q Send-Q        Local Address:Port          Peer Address:Port
    LISTEN     0      50                127.0.0.1:33333                    *:*      users:(("java",1497,30))
    LISTEN     0      128                       *:22                       *:*     
    LISTEN     0      128               127.0.0.1:631                      *:*     
    LISTEN     0      50                127.0.0.1:58442                    *:*      users:(("java",1497,6))
    LISTEN     0      128                      :::22                      :::*     
    LISTEN     0      128                     ::1:631                     :::*     

Any other information?

Cheers

Last edited by rezahousseini (2013-12-18 08:54:05)

Offline

#4 2013-12-18 14:30:25

R00KIE
Forum Fellow
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 4,734

Re: SSH refuses to connect randomly

'mtr -rnc4 160.XX.XX.XX' and/or 'tcptraceroute -n 160.XX.XX.XX' should help you find out where packets are getting lost, you'll have to go from there and find out why packets are getting lost.


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

#5 2013-12-18 15:26:11

rezahousseini
Member
Registered: 2013-09-06
Posts: 17

Re: SSH refuses to connect randomly

Hello ROOKIE I tried your solutions but can't interpret the results:

Start: Wed Dec 18 16:24:30 2013
HOST: myhost.com      Loss%   Snt   Last   Avg  Best  Wrst StDev
  1.|-- 160.XX.XX.X                0.0%     4    0.3   1.5   0.3   4.7   2.0
  2.|-- ???                       100.0     4    0.0   0.0   0.0   0.0   0.0

this looks for me that there was 4 successfull attempt at sending a packet?

Last edited by rezahousseini (2013-12-18 15:26:51)

Offline

#6 2013-12-18 17:29:27

R00KIE
Forum Fellow
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 4,734

Re: SSH refuses to connect randomly

That means the second host contacted (probably your destination) isn't replying to pings, which all by itself doesn't mean much.

On other notes, you seem to be playing with public IPs, so I'd say you should contact the network administrator for help before you cause trouble.

I also don't know if it is a good idea to have a hostname that conflicts / is equal to a public registered domain name (unless you're up to no good, in which case you can look for help somewhere else).


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

#7 2014-01-06 06:59:18

rezahousseini
Member
Registered: 2013-09-06
Posts: 17

Re: SSH refuses to connect randomly

It's not related to the network or the server. I can connect anytime from another host, even from the same PC with another operating system. It's really a problem with my Arch Linux. When I do a restart the connection goes dis-functional and after some time (it must have something to do with my actions) it works again and I have no idea what does causing it.

Offline

Board footer

Powered by FluxBB