The line Command

The line command specifies which line or group of lines you want to configure by entering the line configuration mode. It doesn’t actually do the configuration; it is followed by other commands that set up the specific properties you want. Here’s the syntax of the line command:

line [aux | console | tty | vty] starting-line-number ending-line-number

The possible line types are aux, console, tty, and vty. These line types are discussed individually in this chapter. The following example shows how to use the line command to configure some properties of the router’s console interface:

Router>enable                              
            Enter the privileged command mode
Router#config terminal                     
            Enter configuration mode
Router(config)#line console 0              
            Select the console line
Router(config-line)#exec-timeout 30 0      
            Set the timeout to 30 minutes
Router(config-line)#exit                   
            Exit the line configuration mode
Router(config)#exit                        
            Exit the configuration mode
Router#

If you want to apply line commands to more than one line, you can specify the starting and ending numbers of a group of lines. For example, say you want to apply the command exec-timeout to TTY lines 5 through 10. Instead of typing this command five times, you can configure the entire group with one line command:

Router(config)#line tty 5 10
Router(config-line)#exec-timeout 30 0

Absolute and Relative Line Numbering

When you’re typing the line command, you give it “relative” line numbers: the first TTY is tty0,[2] the first virtual terminal is vty0, and so on. This numbering scheme is intuitive and convenient. Internally, the router uses an absolute numbering scheme to keep track of the lines. It would be nice if you could ignore the router’s internal bookkeeping, but a number of commands use absolute line numbers when reporting information about a line’s status.

Absolute line numbers are calculated by their location on the router, in the order of CTY, TTY, AUX, and then VTY. The console port is first; its absolute line number is zero (0). The TTY ports are next, starting at absolute line number 1 and continuing for the number of TTY lines on the router. If you have eight TTY ports, absolute numbers 1 through 8 will be the TTYs on your router. Next is the AUX port, whose absolute line number is the last TTY number plus 1. Finally, the VTYs begin at the AUX port’s number plus 1. Table 4-1 clarifies absolute and relative line numbering.

Table 4-1. Absolute and relative line numbers

Line type

Absolute number

Relative number

Console (CTY)

0

0

TTY1

1

1

TTY2

2

2

TTY3

3

3

...

...

...

TTYn

n

n

AUX

n+1

0

VTY0

n+2

0

VTY1

n+3

1

VTY2

n+4

2

VTY3

n+5

3

To view this table on the router, use the command show users all. The first column of the output shows the absolute line number, followed by the line type, followed by the line’s relative number:

Router>show users all
     Line     User      Host(s)            Idle Location
   0 con 0                                 00:00:00
   1 tty 1             incoming            6 10.3.21.229
   2 tty 2             incoming            6 10.3.21.229
   3 tty 3             incoming            6 10.3.21.229
   4 tty 4                                 00:00:00
   5 tty 5                                 00:00:00
   6 tty 6                                 00:00:00
   7 tty 7             incoming             3d13h 10.208.8.103
   8 tty 8             incoming             3d13h 10.208.8.103
   9 tty 9             incoming             3d13h 10.208.8.103
  10 tty 10            incoming             3d08h 10.226.76.6
  11 tty 11            incoming             3d08h 10.226.76.6
  12 tty 12            incoming             3d08h 10.226.76.6
  13 tty 13                                00:00:00
  14 tty 14                                00:00:00
  15 tty 15                                00:00:00
  16 tty 16                                00:00:00
  17 aux 0                                 00:00:00
* 18 vty 0             idle                0 10.10.187.204
  19 vty 1                                 00:00:00
  20 vty 2                                 00:00:00
  21 vty 3                                 00:00:00


[2] On some routers, like the 2600, TTY numbering depends on the placement of modules on the router’s chassis. On a device such as this, TTY numbers don’t necessarily start at 0; depending on how modules are installed, they might start at 32 or some other number. Likewise, the AUX port may be 65, depending on card placement.

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.