Document ID: 14957
Updated: Nov 19, 2007
Contents
Prerequisites
This document explains how to use service tcp-keepalives to clear hung telnet sessions.
Before You Begin
Requirements
There are no specific prerequisites for this document.
Components Used
This document is not restricted to specific software and hardware versions.
The information presented in this document was created from devices in a specific lab environment. All of the devices used in this document started with a cleared (default) configuration. If you are working in a live network, ensure that you understand the potential impact of any command before using it.
Conventions
Refer to Cisco Technical Tips Conventions for more information on document conventions.
Background
This topology allows for a remote terminal user to gain access to a server across a network using an autocommand telnet in the configuration of Router 2.
If, however, Router 2 is reloaded for any reason, the terminal will not be able to get back into the server. Upon attempting to activate the connection, the user will see a "Connection refused by remote host" message. This message appears because the server believes that the previous telnet session is still connected, thus blocking a new session.
This situation could be remedied by a network administrator by issuing the clear line command on Router 1, but this approach has two major shortcomings:
-
Network administrators may be unavailable to clear the line when needed.
-
For security reasons, the enable password command is not likely to be given out to users.
One solution is for Router 1 to clear the TTY line when the connection to Router 2 is lost for any reason. TCP keepalives can resolve this problem. Turn on TCP keepalives on both routers so that one router will notice when the connection to the other router goes away; otherwise, the far end has no way to know that a reboot or other connection loss has happened. TCP keepalives are non-configurable on the CLI and the keepalives can be changed through programming.
To enable TCP keepalives on the routers, use the following configuration commands:
Router1# config term Router1(config)# service tcp-keepalives-in Router1(config)# service tcp-keepalives-out Router1(config)# end
Related Information
Open a Support Case (Requires a Cisco Service Contract.)
Related Cisco Support Community Discussions
The Cisco Support Community is a forum for you to ask and answer questions, share suggestions, and collaborate with your peers.
Refer to Cisco Technical Tips Conventions for information on conventions used in this document.