Previous section   Next section

Recipe 3.8 Changing the Number of VTYs

3.8.1 Problem

You want to increase or decrease the number of users who can simultaneously telnet to the router.

3.8.2 Solution

If you want to increase the number of VTY ports available on the router for remote access, you just need to create a reference to the additional lines in the configuration as follows:

Router1#configure terminal 
Enter configuration commands, one per line.  End with CNTL/Z.
Router1(config)#line vty 0 9
Router1(config-line)#end
Router1#

This command defines the characteristics for a range of VTY ports from 0 to 9. Since ports 0 to 4 exist by default, this has the effect of creating ports 5 through 9.

3.8.3 Discussion

By default, most Cisco routers provide five VTYs for remote access. However, the default number of VTYs is often insufficient, and increasing the number can be quite useful. This is particularly true in lab or training environments that require a large number of concurrent sessions on a particular router. In addition, organizations that disable EXEC timeouts (as shown in Recipe 3.9) often require a larger number of VTYs to prevent locking administrators out of their routers.

The router can support up to 181 virtual terminals. However, it is extremely rare to actually need more than about 20. Keep in mind that additional virtual terminals will utilize system resources, so don't go overboard. You must explicitly configure all of the new VTY lines with passwords, access classes, EXEC timeouts, transport protocols, and so forth.

To view the newly created VTY terminals, use the show users all EXEC command:

Router1#show users all
    Line       User       Host(s)              Idle       Location
   0 con 0                                     00:00:00 
  65 aux 0                                     00:00:00 
  66 vty 0     ijbrown    idle                 01:15:29 freebsd.oreilly.com
  67 vty 1     kdooley    idle                 00:12:17 freebsd.oreilly.com
* 68 vty 2     weak       idle                 00:00:00 freebsd.oreilly.com
  69 vty 3                                     00:00:00 
  70 vty 4                                     00:00:00 
  71 vty 5                                     00:00:00 
  72 vty 6                                     00:00:00 
  73 vty 7                                     00:00:00 
  74 vty 8                                     00:00:00 
  75 vty 9                                     00:00:00 
   
  Interface      User        Mode                     Idle     Peer Address
   
Router1#

Five new VTY lines are now available on this router (ports 5 through 9).

To remove the newly created VTY lines, use the no version of the command:

Router1#configure terminal 
Enter configuration commands, one per line.  End with CNTL/Z.
Router1(config)#no line vty 5
Router1(config)#end
Router1#show users all
    Line       User       Host(s)              Idle       Location
   0 con 0                                     00:00:00 
  65 aux 0                                     00:00:00 
* 66 vty 0     ijbrown    idle                 00:00:00 freebsd.oreilly.com
  67 vty 1                                     00:00:00 
  68 vty 2                                     00:00:00 
  69 vty 3                                     00:00:00 
  70 vty 4                                     00:00:00 
   
  Interface      User        Mode                     Idle     Peer Address
   
Router1#

You cannot create or delete VTY lines out of order. Adding VTY line 20 automatically creates lines numbered from 5 to 20. Similarly, removing VTY line 5 implicitly removes all lines above line 5 (as illustrated in the previous example).

The router will not allow you to remove the original five virtual terminals. If you do attempt to delete them, the router produces the following warning message:

Router1#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Router1(config)#no line vty 4
% Can't delete last 5 VTY lines
Router1(config)#end
Router1#

3.8.4 See Also

Recipe 3.9; Recipe 3.10; Recipe 3.16


  Previous section   Next section
Top