Wednesday, July 20, 2011

Top Ten Cisco IOS Commands - 3) sh line, sh users

A good understanding of terminal connections is important when administering Cisco devices.
The Cisco IOS command "show line" gives you a snapshot of which terminal "lines" are in use...

R1# sh line
   Tty Line   Typ     Tx/Rx    A Modem  Roty  Uses  Noise Overruns  Int
        0    0    CTY              -    -      -    -    -         0      0    0/0      -
*      1    1    AUX 115200/115200- inout     -    3      0   53/0      -
*   514  514 VTY              -    -      -    -    -    80     0    0/0      -
    515  515 VTY              -    -      -    -    -     2      0    0/0      -
    516  516 VTY              -    -      -    -    -     0      0    0/0      -
    517  517 VTY              -    -      -    -    -     0      0    0/0      -
    518  518 VTY              -    -      -    -    -     0      0    0/0      -
    519  519 VTY              -    -      -    -    -     0      0    0/0      -
    520  520 VTY              -    -      -    -    -     0      0    0/0      -
    521  521 VTY              -    -      -    -    -     0      0    0/0      -
    522  522 VTY              -    -      -    -    -     0      0    0/0      -
    523  523 VTY              -    -      -    -    -     0      0    0/0      -
    524  524 VTY              -    -      -    -    -     0      0    0/0      -
    525  525 VTY              -    -      -    -    -     0      0    0/0      -
    526  526 VTY              -    -      -    -    -     0      0    0/0      -
    527  527 VTY              -    -      -    -    -     0      0    0/0      -
    528  528 VTY              -    -      -    -    -     0      0    0/0      -
    529  529 VTY              -    -      -    -    -     0      0    0/0      -

Line(s) not in async mode -or- with no hardware support:
2-513

The terminal types are CTY=console, AUX=auxilliary, and VTY=virtual terminal.
The console and auxilliary ports are serial connections and the vty lines are for remote connections over the network using telnet or ssh.

The console port is typically used when setting up the device for the first time or in disaster recovery type scenarios when an IOS image upgrade isn't cooperating, or the device doesn't have a valid IOS image, for example.

The auxiliary port is typically used by a modem for "out-of-band" access as a backup connection for when the network is having issues. It's almost as good as the console port, but, doesn't give you rommon access.

You can manually disconnect any of these lines with the following command...

R1# clear line <x>
[confirm] <------------press enter here
 [OK]

Additionally, sometimes you'll want to know what IP addresses are connected. Use the "sh users" command for this...

R1# sh users
    Line       User       Host(s)              Idle           Location
  514    vty 0                idle                    2d00h   10.10.0.2
  515    vty 1                idle                 00:01:01  10.10.11.23
*516    vty 2                idle                 00:00:00  10.10.11.12

  Interface    User               Mode         Idle             Peer Address
  Se0/2/0:0                       Sync PPP     00:00:00
  Se0/2/1:0                       Sync PPP     00:00:00
  Se0/2/2:0                       Sync PPP     00:00:00
  Mu1                               Sync PPP     00:00:00    192.168.101.20

Here the asterisk by line 516 shows my IP address. Also, try the command "who" on some IOS versions. It does pretty much the same thing.

No comments:

Post a Comment