简介
本文档介绍如何使用菜单选项来管理连接到路由器终端服务器的设备的访问。
先决条件
要求
Cisco 建议您了解以下主题:
使用的组件
本文档中的信息基于带有异步模块(如HWIC-8A)的第2代集成多业务路由器(ISR G2)。
本文档中的信息都是基于特定实验室环境中的设备编写的。本文档中使用的所有设备最初均采用原始(默认)配置。如果您的网络处于活动状态,请确保您了解所有命令的潜在影响。
配置
网络图

配置
步骤1.在路由器上配置环回接口并为其分配IP地址。
Terminalserver(config)#interface loopback 1
Terminalserver(config-if)#ip address 10.1.1.1 255.255.255.0
步骤2.检查从终端服务器到终端设备的物理连接,并记下每台设备对应的行号。HWIC-8A提供8条线路,如输出所示。
Terminalserver#show line
Tty Line Typ Tx/Rx A Modem Roty AccO AccI Uses Noise Overruns Int
* 0 0 CTY - - - - - 7 0 0/0 -
1 1 AUX 9600/9600 - - - - - 0 0 0/0 -
2 2 TTY 9600/9600 - - - - - 0 0 0/0 -
0/0/0 3 TTY 9600/9600 - DTR-Act - - - 2 3 0/0 -
0/0/1 4 TTY 9600/9600 - DTR-Act - - - 3 2 0/0 -
0/0/2 5 TTY 9600/9600 - DTR-Act - - - 0 0 0/0 -
0/0/3 6 TTY 9600/9600 - DTR-Act - - - 0 0 0/0 -
0/0/4 7 TTY 9600/9600 - DTR-Act - - - 0 0 0/0 -
0/0/5 8 TTY 9600/9600 - DTR-Act - - - 0 0 0/0 -
0/0/6 9 TTY 9600/9600 - DTR-Act - - - 0 0 0/0 -
0/0/7 10 TTY 9600/9600 - DTR-Act - - - 0 0 0/0 -
步骤3.如下一示例所示,为每个设备配置IP主机映射。端口号可以通过将2000添加到每台设备对应的线路号中获得。例如,连接到端口0/0/1的设备的线路号为4,如前面的输出所示。用于连接设备的端口号为2004(2000+4)。
Terminalserver(config)#ip host R1 2003 10.1.1.1
Terminalserver(config)#ip host R2 2004 10.1.1.1
步骤4.要配置菜单选项,您可以首先配置终端服务器的标语或标题,如下例所示:
Terminalserver(config)#menu cisco title $
Enter TEXT message. End with the character '$'.
++++++++++++++++++++++++++++++++++++++++++++++++
welcome to the Terminal Server
To exit from the device, use CTRL+SHIFT+6 then press x
++++++++++++++++++++++++++++++++++++++++++++++++
$
步骤5.需要配置此命令,因为它提供了在菜单中进行选择的选项。
Terminalserver(config)#menu cisco prompt $
Enter TEXT message. End with the character '$'.
Choose your option
$
步骤6.您必须配置线路模式,以在选择选项后强制按Enter。如果不使用此命令,则菜单直接在选择选项后运行。
Terminalserver(config)#menu cisco line-mode
步骤7.要设置新连接,请使用以下菜单命令。
Terminalserver(config)#menu cisco command 1 telnet 10.1.1.1 2003
Terminalserver(config)#menu cisco text 1 login to R1
步骤8.此菜单命令可打开新连接或恢复已配置主机的连接。
Terminalserver(config)#menu cisco command 2 resume R2 / connect telnet R2
Terminalserver(config)#menu cisco text 2 login to R2
步骤9.要在屏幕进入菜单后将其清除,请使用此命令。
Terminalserver(config)#menu cisco clear-screen
步骤10.为了在屏幕顶部显示用户状态,使用此命令。
Terminalserver(config)#menu main status-line
步骤11.需要配置这些菜单命令以退出菜单。
Terminalserver(config)#menu cisco command e menu-exit
Terminalserver(config)#menu cisco text e menu-exit
步骤12.要退出终端服务器连接,请使用以下菜单命令。
Terminalserver(config)#menu cisco command q exit
Terminalserver(config)#menu cisco text q disconnect from terminal server
步骤13.当用户通过Telnet或Secure Shell(SSH)登录时,在VTY线路下配置这些命令以自动执行菜单。
Terminalserver(config)#line vty 0 4
Terminalserver(config-line)#autocommand menu cisco
Terminalserver(config-line)#login local
Terminalserver(config-line)#transport input ssh
Terminalserver(config-line)#transport output all
验证
此部分确认您的配置工作正常。
通过Telnet连接到R1
Terminalserver#menu cisco
++++++++++++++++++++++++++++++++++++++++++++
welcome to the Terminal Server
To exit from the device, use CTRL+SHIFT+6 then press x
++++++++++++++++++++++++++++++++++++++++++++
1 login to R1
2 login to R2
e menu-exit
q disconnect from terminal server
Choose your option
1
R1#
Terminalserver#show sessions
Conn Host Address Byte Idle Conn Name
* 1 10.1.1.1 10.1.1.1 0 0 10.1.1.1
Telnet至R2
++++++++++++++++++++++++++++++++++++++++++++
welcome to the Terminal Server
To exit from the device, use CTRL+SHIFT+6 then press x
++++++++++++++++++++++++++++++++++++++++++++
1 login to R1
2 login to R2
e menu-exit
q disconnect from terminal server
Choose your option
2
Terminalserver#show sessions
Conn Host Address Byte Idle Conn Name
1 10.1.1.1 10.1.1.1 0 0 10.1.1.1
* 2 10.1.1.1 10.1.1.1 0 0
从“菜单”选项退出。
++++++++++++++++++++++++++++++++++++++++++++
welcome to the Terminal Server
To exit from the device, use CTRL+SHIFT+6 then press x
++++++++++++++++++++++++++++++++++++++++++++
1 login to R1
2 login to R2
e menu-exit
q exit
Choose your option
e
Terminalserver#
从终端服务器退出。
++++++++++++++++++++++++++++++++++++++++++++
welcome to the Terminal Server
To exit from the device, use CTRL+SHIFT+6 then press x
++++++++++++++++++++++++++++++++++++++++++++
1 login to R1
2 login to R2
e menu-exit
q exit
Choose your option
q
Terminalserver con0 is now available
Press RETURN to get started.
故障排除
当您尝试从终端服务器连接到终端设备时,有时会看到这些错误。
Terminalserver#telnet R1
Trying R1 (10.1.1.1, 2003)...
% Connection refused by remote host
要解决此问题,您需要从终端服务器中清除相应的行,如下例所示:
Terminalserver#clear line 3
[confirm]
[OK]
Terminalserver#telnet R1
Trying R1 (10.1.1.1,2003)...open
R1>
相关信息