Clear vty (ssh/telnet) connection

Cisco specific stuff and tips

Clear vty (ssh/telnet) connection

Postby lik » Thu Oct 25, 2012 8:33 pm

To clear a vty (ssh/telnet) connection on Cisco router we have to clear the specific line.
To find this line we can use the following command:
Code: Select all
router#who

For example a router has a vty connection from a host with ip 10.10.10.10 on line 3:
Code: Select all
router#who
    Line       User       Host(s)              Idle       Location
   2 vty 1                idle                 00:00:02 10.11.10.11
   3 vty 2     root       idle                 00:00:06 10.10.10.10
*  5 vty 4     admin      idle                 00:00:00 192.168.17.67

  Interface      User        Mode                     Idle     Peer Address

Note, your current active connection is marked with '*' asterix. No suicide, pls.
To clear connection on line 3 we use the following command:
Code: Select all
router#clear line 3
[confirm]
 [OK]
router#

And check result of our actions:
Code: Select all
router#who
    Line       User       Host(s)              Idle       Location
   2 vty 1                idle                 00:00:02 10.11.10.11
*  5 vty 4     admin      idle                 00:00:00 192.168.17.67

  Interface      User        Mode                     Idle     Peer Address


Another possible solution is to remove connection from the socket table by clearig associated TCB (Transmission Control Block):
Code: Select all
router#show tcp brief
TCB       Local Address           Foreign Address        (state)
51594BC8  192.168.5.1.22         10.11.12.11.45581  FINWAIT1
5158C398  192.168.5.1.22      10.11.10.11.1904     ESTAB

Code: Select all
router#clear tcp tcb 5158C398
lik
Founder
Founder
 
Posts: 497
Joined: Wed Dec 15, 2010 3:21 am

Return to Cisco tips

 


  • Related topics
    Replies
    Views
    Last post
cron