终端服务器的配置GNS
dynagen/dynamips 终端服务器配置网络拓朴: 四台路由器,TermServ 为访问服务器,通过console访问R1 R2 R3 这三台路由器. 主要是在TermServ上进行配置,其它路由器可不配置。 在配置网络配置文件时我将TermServ放在了第一台路由器的位置,这时TermServ的console的端口为2000,R1为2001类推,这样看起来直观一些,如果把TermServ后面,可对路由器采用手动指定端口的方法。 网络的net 配置文件: autostart = false localhost port = 7200 udp = 10000 workingdir = f:lab3640 3640 image = f:labc3640-telco-124-13.bin ram = 64 confreg = 0×2102 idlepc = 0x6100bf2c exec_area = 64 mmap = false slot1 = NM-4T router TermServ model=3640 e0/0 = NIO_gen_eth:DeviceNPF_1D0AB987-6689-4B46-8AF5-27395AD05B0B #此接口为本机的loopback接口,router R1model=3640e0/0 = R3 e0/0router R2model=3640s1/0 = R3 s1/1 router R3model=3640 工作原理:dynamips启动时,各路由器的console口,被自动重定向动本机的200x等端口上,在系统中可通过telnet localhost 2000类似形式来访问,配置TermServ上的e0/0端口连接到本地loopback接口,并配置其连通,就可以通过telnet 到loopback接口IP上的2000端口进行访问。 和其实设备的区别:(这个真的还未搞过,呵呵)在配置上面,真实设备使用的是TermServ 的loopback接口的IP地址,dynamips使用的是TermServ的e0/0连接到的本机的loopback接口的IP地址。一个通过以太口连接的,一个是能过aux口连接的。在真实连接时会使用TTY线路,需要对TTY line进行配置。如:TermServ(config)#line 1 4 #注意这不是vtyTermServ(config-line)#transport input allTermServ(config-line)#no execTermServ(config-line)#在模拟器上不能执行,因为没有tty的硬件。会出现下面的提示:TermServ(config)#line 1 4No physical hardware support for line 1基本配置:在Windows中设置本地loopback接口的ip地址为172.27.5.1/16.为TermServ的e0/0 设置IPTermServ#config tEnter configuration commands, one per line. End with CNTL/Z.TermServ(config)#int e0/0TermServ(config-if)#ip add 172.27.5.3 255.255.255.0TermServ(config-if)#no shutTermServ(config-if)#配置主机列表:TermServ#config tEnter configuration commands, one per line. End with CNTL/Z.TermServ(config)#no ip domain-lookupTermServ(config)#ip host R1 2001 172.27.5.1TermServ(config)#ip host R2 2002 172.27.5.1TermServ(config)#ip host R3 2003 172.27.5.1TermServ(config)#endTermServ#*Mar 1 01:46:22.991: %SYS-5-CONFIG_I: Configured from console by consoleTermServ#访问:TermServ#R1Translating "R1"Trying R1 (172.27.5.1, 2001) OpenConnected to Dynamips VM "R1" (ID 1, type c3600) Console portR1#TermServ#R2Translating "R2"Trying R2 (172.27.5.1, 2002) OpenConnected to Dynamips VM "R2" (ID 2, type c3600) Console port R2# TermServ#R3 Translating "R3" Trying R3 (172.27.5.1, 2003) Open Connected to Dynamips VM "R3" (ID 3, type c3600) Console port R3# TermServ# OK可以成功访问了,登陆到其它路由器后,按ctrl+shift+6,再按x返回。 注意问题:输入R1登陆到R1后,再用ctrl+shift+6, x 返回到TermServ后,就不能再用R1登陆,因为2001端口已经占用,而无法登陆。这时应当使用会话号来登陆(不清楚真实路由器有没有这个限制)。例如: TermServ#show session Conn Host Address Byte Idle Conn Name * 1 R1 172.27.5.1 0 2 R1 2 R2 172.27.5.1 0 5 R2 3 R3 172.27.5.1 0 5 R3 TermServ#1 Resuming connection 1 to R1 . R1# TermServ#2 Resuming connection 2 to R2 . R2# TermServ# 断开指定会话,使用disconnect sessionID: R2# TermServ#show session Conn Host Address Byte Idle Conn Name 1 R1 172.27.5.1 0 0 R1 * 2 R2 172.27.5.1 0 0 R2 3 R3 172.27.5.1 0 6 R3 TermServ#disconnect 1 Closing connection to R1 confirm TermServ#show session Conn Host Address Byte Idle Conn Name * 2 R2 172.27.5.1 0 0 R2 3 R3 172.27.5.1 0 6 R3 TermServ# 查看当前连接用户: TermServ#sh user Line User Host(s) Idle Location * 0 con 0 R1 00:00:02 R2 00:02:35 R3 00:08:27 Interface User Mode Idle Peer Address TermServ# 在真实路由器环境中,我们一般通过modem连接到TermServ再对其它路由器进行控制管理。可以使用show line来查看modem到路由器的连接情况。 TermServ#show line Tty Typ Tx/Rx A Modem Roty AccO AccI Uses Noise Overruns Int * 0 CTY - - - - - 8 0 0/0 129 AUX 9600/9600 - - - - - 0 0 0/0 130 VTY - - - - - 0 0 0/0 131 VTY - - - - - 0 0 0/0 132 VTY - - - - - 0 0 0/0 133 VTY - - - - - 0 0 0/0 134 VTY - - - - - 0 0 0/0 Line(s) not in async mode -or- with no hardware support: 1-128 TermServ#sh line 129 Tty Typ Tx/Rx A Modem Roty AccO AccI Uses Noise Overruns Int 129 AUX 9600/9600 - - - - - 0 0 0/0 Line 129, Location: "", Type: "" Length: 24 lines,