Manoj Reddy's Reference Guide

clear tcp

To clear a TCP connection, use the clear tcp privileged EXEC command.

clear tcp {line line-number | local host-nameportremote host-nameport | tcb address}

Syntax Description

line    line-number 

TTY line number of the TCP connection to clear.

local  host-name  port 
remote  host-name  port 

Local router's host name and port and remote router's host name and port of the TCP connection to clear.

tcb  address 

Transmission Control Block (TCB) address of the TCP connection to clear. The TCB address is an internal identifier for the end point.

Command Modes

Privileged EXEC

Command History

ReleaseModification
11.1

This command was introduced.

Usage Guidelines

The clear tcp command is particularly useful for clearing hung TCP connections.

The clear tcp line line-numbercommand terminates the TCP connection on the specified TTY line. Additionally, all TCP sessions initiated from that TTY line are terminated.

The clear tcp local host-nameportremote host-nameportcommand terminates the specific TCP connection identified by the host name/port pair of the local and remote router.

The clear tcp tcb addresscommand terminates the specific TCP connection identified by the TCB address.

Examples

The following example clears a TCP connection using its TTY line number. The show tcp command displays the line number (tty2) that is used in the clear tcp command.

Router# show tcp

    tty2, virtual tty from host router20.cisco.com
    Connection state is ESTAB, I/O status: 1, unread input bytes: 0
    Local host: 171.69.233.7, Local port: 23
    Foreign host: 171.69.61.75, Foreign port: 1058

    Enqueued packets for retransmit: 0, input: 0, saved: 0

    Event Timers (current time is 0x36144):
    Timer          Starts    Wakeups            Next
    Retrans             4          0             0x0
    TimeWait            0          0             0x0
    AckHold             7          4             0x0

    SendWnd             0          0             0x0
    KeepAlive           0          0             0x0
    GiveUp              0          0             0x0
    PmtuAger            0          0             0x0

    iss: 4151109680  snduna: 4151109752  sndnxt: 4151109752     sndwnd:  24576
    irs: 1249472001  rcvnxt: 1249472032  rcvwnd:       4258  delrcvwnd:     30

    SRTT: 710 ms, RTTO: 4442 ms, RTV: 1511 ms, KRTT: 0 ms
    minRTT: 0 ms, maxRTT: 300 ms, ACK hold: 300 ms

Router# clear tcp line 2
    [confirm]
     [OK]

The following example clears a TCP connection by specifying its local router host name and port and its remote router host name and port. The show tcp brief command displays the local (Local Address) and remote (Foreign Address) host names and ports to use in the clear tcp command.

Router# show tcp brief
    TCB       Local Address           Foreign Address        (state)
    60A34E9C  router1.cisco.com.23      router20.cisco.1055  ESTAB

Router# clear tcp local router1 23 remote router20 1055
    [confirm]
     [OK]

The following example clears a TCP connection using its TCB address. The show tcp brief command displays the TCB address to use in the clear tcp command.

Router# show tcp brief
    TCB       Local Address           Foreign Address        (state)
    60B75E48  router1.cisco.com.23      router20.cisco.1054  ESTAB

Router# clear tcp tcb 60B75E48
    [confirm]
     [OK]

Related Commands

CommandDescription
show tcp Displays the status of TCP connections.
show tcp brief Displays a concise description of TCP connection endpoints.

Printed for apswan@ctr.ap.nic.in on Wed Mar 5 22:32:57 PST 2003

All material in this document copyright 2000 Cisco Systems, Inc. All rights reserved. No material may be reproduced or distributed without written permission of Cisco Systems, Inc.