show line

To display the status of a line, use the command show line. This is not a privileged command and can be executed by any user. On an eight-port terminal server, show line gives output like this:

Router>show line
 TTY TYP     Tx/Rx      A Modem  Roty AccO AccI  Uses    Noise   Overruns
   0 CTY               -    -      -    -    -     0        0        0/0
   1 TTY   9600/9600   -    -      -    -    -     3      542        0/0
*  2 TTY   9600/9600   -    -      -    -    -     1        0        0/0
   3 TTY  38400/38400  - RIisCD    -    -    -     1        0        0/0
I  4 TTY  38400/38400  - inout     -    -    -    25        0        0/0
I  5 TTY  38400/38400  - inout     -    -    -  3940        0        0/0
I  6 TTY  38400/38400  - inout     -    -    -  1483        0        0/0
I  7 TTY  38400/38400  - inout     -    -    -   364        0        0/0
I  8 TTY  38400/38400  - inout     -    -    -    12        0        0/0

Table 4-2 shows what the fields in this report mean.

Table 4-2. Fields in a show line display

Column

Meaning

1st column

I = line is idle; * = line is active.

TTY

Actual line number.

TYP

Type of line: CTY (console), AUX, TTY, VTY, LPT.

TX/RX

Transmit and receive baud rates for this line.

A

Autobaud (automatic baud rate detection) is active.

Modem

Type of modem signal configured for this line (callin, callout, cts-req, dtr-act, inout, RIisCd).

Roty

Rotary group configured for this line.

AccO, AccI

Access lists for this line, both output and input (see access-class in Chapter 15).

Uses

Number of connections made to this line since the router was booted.

Noise

Number of times noise was detected on this line. Can be used to gauge line quality.

Overruns

Number of buffer overruns that have occurred on this line, in the format hardware/software. Hardware overruns occur when the hardware receives data from the software faster than it can process it. Software overruns occur when the software receives data from the hardware faster than it can process it. A bad cable could cause overruns.

You can retrieve more detailed information by selecting a single line:

Router>show line 5
 Tty Typ     Tx/Rx     A Modem  Roty AccO AccI  Uses    Noise   Overruns
A  5 TTY  38400/38400  - inout     -    -    -  3969        0      0/0

Line 5, Location: "", Type: ""
Length: 24 lines, Width: 80 columns
Baud rate (TX/RX) is 38400/38400, no parity, 1 stopbits, 8 databits
Status: Ready, Active, No Exit Banner, Async Interface Active
Capabilities: Hardware Flowcontrol In, Hardware Flowcontrol Out
  Modem Callout, Modem RI is CD, Line usable as async interface
Modem state: Ready
Special Chars: Escape  Hold  Stop  Start  Disconnect  Activation
                ^^x    none   -     -       none
Timeouts:    Idle EXEC    Idle Session   Modem Answer  Session   Dispatch
             0:00:30        never                        none     not set
Session limit is not set.
Time since activation: 2:08:08
Editing is enabled.
History is enabled, history size is 10.
Full user help is disabled
Allowed transports are lat telnet rlogin mop.  Preferred is lat.
No output characters are padded
No special data dispatching characters
Modem hardware state: CTS DSR  DTR RTS
Line is running PPP for address 192.101.187.165.
0 output packets queued, 1 input packets.
 Async Escape map is 00000000000000000101000000000000
Group codes:    0
  Interface Async5: (passive, compression on)
    Rcvd:    5711 total, 4516 compressed, 0 errors
             0 dropped, 0 buffer copies, 0 buffer failures
    Sent:    5085 total, 4032 compressed,
             138729 bytes saved, 3943290 bytes sent
             1.3 efficiency improvement factor
    Connect: 16 rx slots, 16 tx slots, 1275 long searches, 765 misses
             84% hit ratio, five minute miss rate 0 misses/sec, 1 max

The first part of this report has the same format given in Table 4-2. However, the rest of the report goes into great detail about the line’s characteristics. Table 4-3 shows what these additional fields mean.

Table 4-3. Fields in a show line for a single port

Field

Meaning

Line

TTY line number.

Location

Value of the location keyword set for this line. See location in Chapter 15.

Type

Value specified by the line configuration.

Length

Terminal display length in characters.

Width

Terminal display width in characters.

Baud

Transmit (TX) and receive (RX) baud rates.

Status

State of the line (ready, connected/disconnected, active/inactive, exit banner).

Capabilities

How or for what this line can be used.

Modem state

Control state of the modem. If not Ready, suspect a modem problem.

Special chars

Settings of characters defined for this line.

Timeouts

Timeouts as specified by the configurations.

Session limit

Maximum number of sessions for this line. Controlled by the session-limit command.

Time since activation

Time elapsed since line activation (i.e., how long the line has been considered active).

Editing

Whether command-line editing is enabled.

History

Length of the command history buffer. Set by the user with the history command.

Full user help

Whether the full-help command has been activated for this line.

Transport methods

Transport mechanisms allowed on this line. See the transport command for more information.

Character padding

See the padding command.

Data dispatching characters

Whether any data-dispatching characters are configured. See dispatch-character for more information.

Line protocol

The protocol and address specified for this line.

Output/input packets

Queued packet counts for this line.

Group codes

AT group codes for this line.

Reverse Telnet

When a user telnets to a router, she is “logged on” directly to the router. Cisco adds a special twist: if you telnet to a special port on the router, the router redirects the incoming telnet connection back out a selected asynchronous line, rather than internally accepting the incoming connection. This is called “reverse telnet.” Here are two telnet commands you might give on your Unix or Windows workstation:

% telnet router1             
               Telnet directly into router1
% telnet router1 2001        
               Telnet to port 2001 on router1

The first telnet command connects to the standard telnet port (TCP port 23; remember that we’re now talking about TCP ports, not the router’s physical ports) and initiates a virtual terminal session with the router. The second command is tricky. It connects to TCP port 2001; the router maps this port to one of its asynchronous lines. The router performs any login requirements, then connects the telnet session to the mapped line. The mapping is simple: just subtract 2000 from the port used for the telnet connection. So in this example, the user would be connected to asynchronous line 1 (tty1). Line 2 (tty2) would be 2002, and so on. If a modem is connected to tty1, the user would be talking directly to the modem.

The only catch to this mapping is the AUX port. The number of the AUX port is the last TTY port, plus 1. So, on a router with 18 TTY ports, the AUX port would be port 2019 (the last TTY, port 2018, plus 1). On a router with no TTY interfaces, the AUX port would be port 2001.

In addition to port 2000, ports 4000 and 6000 can be used. Port 4000 plus the tty1 gives you a raw TCP port, which is usually for sending data directly to a printer. On port 2000, each carriage return is translated into a carriage return plus a linefeed. Port 6000 is just like port 2000, except it turns off the carriage-return translation.

Reverse telnet requires that the TTY line be configured to allow outbound connections. Here’s how you do this:

Router(config)#line tty2
Router(config-line)#modem inout

The modem inout command allows both incoming and outgoing connections. Another way to configure the line is:

Router(config)#line tty2
Router(config-line)#modem callout

The modem callout command allows only outgoing connections.

Another useful command for reverse telnet is ip alias . This command lets you assign an IP address to a reverse telnet connection. In other words, the router associates an IP address with a reverse telnet port. If you telnet to this address, the router will connect you directly to the specified port. For example, assume that a router has an Ethernet interface with an address of 10.1.1.1. The following commands configure it to route incoming telnet connections for the addresses 10.1.1.2, 10.1.1.3, and 10.1.1.4 to asynchronous ports 1 through 3:

interface ethernet0
 ip address 10.1.1.1 255.255.255.0
 no shutdown
!
! Now configure our reverse telnet IP address
ip alias 10.1.1.2 2001
ip alias 10.1.1.3 2002
ip alias 10.1.1.4 2003

Now, when you telnet to 10.1.1.2, you will be connected to the device that is connected to port 1.

Common Configuration Items

This section summarizes the configuration items you are likely to encounter when configuring a line on a router or a terminal server.

Communication parameters

These useful commands set the low-level physical parameters of a line. To set the line speed (baud) you can use the speed , txspeed, or rxspeed commands. For databits, stop bits, and parity, use the commands databits , stopbits, and parity, respectively. For automatic baud rate detection, use the autobaud command.

For flow control, use the flowcontrol command, which takes as arguments none, software, or hardware. In a modern environment, hardware flow control is almost always appropriate.

Transport type

The transport command defines which protocols can be used to connect to a line. The default protocol is none, which means that no incoming connections are allowed. The command transport input telnet specifies that telnet can be used as an incoming protocol, but no other protocols are allowed.

You can also specify the preferred protocol to use after a user has connected to a line. By default, the preferred protocol is telnet. Therefore, when users are connected to the router, they can type a hostname, and the router will assume they want to telnet to a device. To disable this behavior, use the command transport preferred none .

Session limits and timeouts

IOS provides two ways to limit the number of ongoing sessions. To limit the number of sessions allowed on a line, use the session-limit command. To limit a session’s idle time, use the session-timeout command. If the session is idle longer than the specified time, the router will automatically log the user out. Note that these commands apply to the configuration of lines and not to the router as a whole.

Special characters and key sequences

IOS allows you to specify a number of special characters that control the interaction between a user and the router. The activation character is the character that starts a terminal session when it is typed at a vacant terminal. The default activation character is Return; you can set it to another value using the activation-character command. Other special characters are the disconnect character and the hold character, both of which have no defaults. The disconnect character disconnects (terminates) a session, while the hold character pauses a session until any other key is pressed. These characters are set using the disconnect-character and hold-character commands.

All three of these commands apply to lines; the argument for each command is the ASCII value for the character. For example, to set the disconnect character for line 2 to Ctrl-d (ASCII value 4), use the following commands:

Router(config)#line 2
Router(config-line)#disconnect-character 4

Get CISCO IOS in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.