Changing the Number of VTYs

Changing the Number of VTYs

Problem

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

Solution

If you want to increase the number of VTY ports available on the router for remote access, 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)#exit
Router1(config)#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.

Discussion

By default, most Cisco routers provide five virtual terminals (VTYs) for remote access. Often the default number of VTYs is not sufficient 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 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 over board. 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#

There are five new VTY lines available on this router (VTY 59).

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 will automatically create lines numbered from 5 to 20. Similarly, removing VTY line 5 will implicitly remove 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 will produce 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#

See Also