LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 04-30-2012, 10:41 AM   #1
boubalos
LQ Newbie
 
Registered: Apr 2012
Location: Beijing
Distribution: Debian, Ubuntu
Posts: 8

Rep: Reputation: Disabled
ssh connection frequently get killed by the remote server


There was no problem to log in the remote computer, which never needed a second try. However, the connection frequently got killed by the remote server, sometime when I logged in for 1 minute, sometime even when I just logged in.

Could any one tell me what or how to locate where the problem is?
 
Old 04-30-2012, 01:11 PM   #2
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,604

Rep: Reputation: 415Reputation: 415Reputation: 415Reputation: 415Reputation: 415
Try setting the following in your /etc/ssh/sshd_config file and restarting SSH on the remote server.

TCPKeepAlive yes
 
Old 05-01-2012, 05:06 AM   #3
boubalos
LQ Newbie
 
Registered: Apr 2012
Location: Beijing
Distribution: Debian, Ubuntu
Posts: 8

Original Poster
Rep: Reputation: Disabled
I tried the suggestion, but that did not help..

Thanks any way.

Quote:
Originally Posted by Kustom42 View Post
Try setting the following in your /etc/ssh/sshd_config file and restarting SSH on the remote server.

TCPKeepAlive yes
 
Old 05-01-2012, 10:24 AM   #4
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,845
Blog Entries: 31

Rep: Reputation: 180Reputation: 180
Is your connection within the same LAN, or does it go over a router to some other LAN? If the latter, is it local or over the internet? Any chance you have two different paths to the same remote computer?

Can you see the connection status in the output of "tcpdump" on both ends at the same time before the connection drops? I am curious if the source port number matches and whether the addresses are translated.
 
Old 05-01-2012, 09:22 PM   #5
boubalos
LQ Newbie
 
Registered: Apr 2012
Location: Beijing
Distribution: Debian, Ubuntu
Posts: 8

Original Poster
Rep: Reputation: Disabled
Thank you so much.

I first ssh a remote pc over internet, this connection never has problem. Then within this ssh, I ssh another pc(192.168.88.5) over LAN, it is local, and the problem occurs. Sorry that I am not familar with network protocol. However, I tried ping 192.168.88.5, and 100% packages are successfully tranmited.

Should I track the problem use "tcpdump"? My remote PC uses UBUNTU, it has tcpdump command.The pc(192.168.88.5) uses CENTOS, and it did have installed tcpdump, however, it is strange that it does not have the tcpdump command but the tcptraceroute command.

Quote:
Originally Posted by Skaperen View Post
Is your connection within the same LAN, or does it go over a router to some other LAN? If the latter, is it local or over the internet? Any chance you have two different paths to the same remote computer?

Can you see the connection status in the output of "tcpdump" on both ends at the same time before the connection drops? I am curious if the source port number matches and whether the addresses are translated.
 
Old 05-01-2012, 09:30 PM   #6
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,845
Blog Entries: 31

Rep: Reputation: 180Reputation: 180
Quote:
Originally Posted by boubalos View Post
I first ssh a remote pc over internet, this connection never has problem. Then within this ssh, I ssh another pc(192.168.88.5) over LAN,
Can you explain what you mean by "within this ssh"? I can think of more than one thing for this, so I need to narrow it down. Can you show both ssh command lines in full?

Quote:
Originally Posted by boubalos View Post
Should I track the problem use "tcpdump"? My remote PC uses UBUNTU, it has tcpdump command.The pc(192.168.88.5) uses CENTOS, and it did have installed tcpdump, however, it is strange that it does not have the tcpdump command but the tcptraceroute command.
I don't know if this will be needed, yet, until I know the answer for above.
 
Old 05-02-2012, 01:03 AM   #7
boubalos
LQ Newbie
 
Registered: Apr 2012
Location: Beijing
Distribution: Debian, Ubuntu
Posts: 8

Original Poster
Rep: Reputation: Disabled
first, ssh the remote PC by internet
>ssh 166.111.XX.XXX

after log in, ssh the pc in LAN in the same terminal
>ssh 192.168.88.5

which means the remote PC connects both the internet(by ip 166.111.XX.XXX) and the local LAN (by ip 192.168.88.6). I need to log in the remote PC in order to access the PC in the local LAN(ip is 192.168.88.5)

thanks.

Quote:
Originally Posted by Skaperen View Post
Can you explain what you mean by "within this ssh"? I can think of more than one thing for this, so I need to narrow it down. Can you show both ssh command lines in full?

I don't know if this will be needed, yet, until I know the answer for above.
 
Old 05-02-2012, 09:10 AM   #8
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,845
Blog Entries: 31

Rep: Reputation: 180Reputation: 180
Quote:
Originally Posted by boubalos View Post
first, ssh the remote PC by internet
>ssh 166.111.XX.XXX

after log in, ssh the pc in LAN in the same terminal
>ssh 192.168.88.5

which means the remote PC connects both the internet(by ip 166.111.XX.XXX) and the local LAN (by ip 192.168.88.6). I need to log in the remote PC in order to access the PC in the local LAN(ip is 192.168.88.5)
What you have here are 2 logins. One from host A to host B. One from host B to host C, done from the session started by the previous.

Now which connection is getting killed by which remote?

Last edited by Skaperen; 05-02-2012 at 09:15 AM.
 
Old 05-02-2012, 10:58 AM   #9
boubalos
LQ Newbie
 
Registered: Apr 2012
Location: Beijing
Distribution: Debian, Ubuntu
Posts: 8

Original Poster
Rep: Reputation: Disabled
from host B to host C (i.e. the ssh connection in the LAN)

thank you so much.

Quote:
Originally Posted by Skaperen View Post
What you have here are 2 logins. One from host A to host B. One from host B to host C, done from the session started by the previous.

Now which connection is getting killed by which remote?

Last edited by boubalos; 05-02-2012 at 10:59 AM.
 
Old 05-02-2012, 06:43 PM   #10
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,845
Blog Entries: 31

Rep: Reputation: 180Reputation: 180
Quote:
Originally Posted by boubalos View Post
from host B to host C (i.e. the ssh connection in the LAN)

thank you so much.
So when that connection gets dropped, the connection from A to B is still up, and you can still type commands to host B.

Can you get to the physical console for host B at some point in time to debug from there by trying to connect from B to C there?
 
Old 05-03-2012, 05:29 AM   #11
boubalos
LQ Newbie
 
Registered: Apr 2012
Location: Beijing
Distribution: Debian, Ubuntu
Posts: 8

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Skaperen View Post
So when that connection gets dropped, the connection from A to B is still up, and you can still type commands to host B.
Yes.

Quote:
Originally Posted by Skaperen View Post
Can you get to the physical console for host B at some point in time to debug from there by trying to connect from B to C there?
Your suggestion is good, unluckily, I am currently in anther city, so can not access the physical console for host B. I can access the the physical console after a few days, will try the suggestion and report the results.

Thank you so much, Skaperen.
 
Old 05-03-2012, 11:02 AM   #12
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,845
Blog Entries: 31

Rep: Reputation: 180Reputation: 180
Can you login as root on C, run screen, and do a tcpdump in the screen session to watch and save the packets ... and likewise on B ... to see what might be causing the connection drop?
 
Old 05-08-2012, 12:53 AM   #13
boubalos
LQ Newbie
 
Registered: Apr 2012
Location: Beijing
Distribution: Debian, Ubuntu
Posts: 8

Original Poster
Rep: Reputation: Disabled
Now, I can access the physical machine of remote PC B. Even I directly use PC B to ssh PC C, the problem occurs. After a few tries, I am sure that the problem is caused by the ssh-client of this PC.

I rebooted the PC, ran Knoppix (which is a live Linux CD), and all problems disappeared.

Thank all of you above.

Quote:
Originally Posted by Skaperen View Post
Can you login as root on C, run screen, and do a tcpdump in the screen session to watch and save the packets ... and likewise on B ... to see what might be causing the connection drop?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't SSH to remote machine: Connection closed by remote host Avatar Linux - Networking 35 10-23-2017 01:21 AM
Ubuntu Karmic 9.10 Server with lamp frequently drops connection qhhatman Linux - Server 5 03-22-2010 10:36 PM
frequently slow ssh connection heriL Linux - Networking 1 03-23-2008 06:25 AM
Remote Desktop through NetBSD, losing connection frequently bhalpin Linux - Networking 2 03-08-2008 11:02 AM
SSH hangs frequently over wireless connection smith_cc Linux - Wireless Networking 1 01-03-2007 07:37 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 07:29 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration