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


service tcp-keepalives-in

To generate keepalive packets on idle incoming network connections (initiated by the remote host), use the service tcp-keepalives-in global configuration command.

service tcp-keepalives-out

To generate keepalive packets on idle outgoing network connections (initiated by a user), use the service tcp-keepalives-out global configuration command.

P.S  –  Use of this feature can reduce the affects of DoS attacks on the device as connections that do not respond to the keepalives will be terminated and no longer consume system resources.