原创作品,转载请注明出处,可在网络自由传播,但不得用于商业目的。
-------------------------------------------
网络拓朴:
四台路由器,TermServ 为访问服务器,通过console访问R1 R2 R3 这三台路由器.
主要是在TermServ上进行配置,其它路由器可不配置。
在配置网络配置文件时我将TermServ放在了第一台路由器的位置,这时TermServ的console的端口为2000,R1为2001类推,这样看起来直观一些,如果把TermServ后面,可对路由器采用手动指定端口的方法。
网络的net 配置文件:
autostart = false
[localhost]
port = 7200
udp = 10000
workingdir = f:\lab\3640\
[[3640]]
image = f:\lab\c3640-telco-124-13.bin
ram = 64
confreg = 0x2102
idlepc = 0x6100bf2c
exec_area = 64
mmap = false
slot1 = NM-4T
[[router TermServ]]
model=3640
e0/0 = NIO_gen_eth:\Device\NPF_{1D0AB987-6689-4B46-8AF5-27395AD05B0B} #此接口为本机的loopback接口,关于如何添加loopback接口,请查看
[[router R1]]
model=3640
e0/0 = R3 e0/0
[[router R2]]
model=3640
s1/0 = R3 s1/1
[[router R3]]
model=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 #注意这不是vty
TermServ(config-line)#transport input all
TermServ(config-line)#no exec
TermServ(config-line)#
在模拟器上不能执行,因为没有tty的硬件。会出现下面的提示:
TermServ(config)#line 1 4
No physical hardware support for line 1
基本配置:
在Windows中设置本地loopback接口的ip地址为172.27.5.1/16.
为TermServ的e0/0 设置IP
TermServ#config t
Enter configuration commands, one per line. End with CNTL/Z.
TermServ(config)#int e0/0
TermServ(config-if)#ip add 172.27.5.3 255.255.255.0
TermServ(config-if)#no shut
TermServ(config-if)#
配置主机列表:
TermServ#config t
Enter configuration commands, one per line. End with CNTL/Z.
TermServ(config)#no ip domain-lookup
TermServ(config)#ip host R1 2001 172.27.5.1
TermServ(config)#ip host R2 2002 172.27.5.1
TermServ(config)#ip host R3 2003 172.27.5.1
TermServ(config)#end
TermServ#
*Mar 1 01:46:22.991: %SYS-5-CONFIG_I: Configured from console by console
TermServ#
访问:
TermServ#R1
Translating "R1"
Trying R1 (172.27.5.1, 2001)... Open
Connected to Dynamips VM "R1" (ID 1, type c3600) - Console port
R1#
TermServ#R2
Translating "R2"
Trying R2 (172.27.5.1, 2002)... Open
Connected 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, Width: 80 columns
Baud rate (TX/RX) is 9600/9600, no parity, 2 stopbits, 8 databits
Status: Ready, Modem Signals Polled
Capabilities: none
Modem state: Ready
Group codes: 0
Modem hardware state: noCTS noDSR DTR RTS
Special Chars: Escape Hold Stop Start Disconnect Activation
^^x none - - none
Timeouts: Idle EXEC Idle Session Modem Answer Session Dispatch
00:10:00 never none not set
Idle Session Disconnect Warning
never
Login-sequence User Response
00:00:30
Autoselect Initial Wait
not set
Modem type is unknown.
Session limit is not set.
Time since activation: never
Editing is enabled.
History is enabled, history size is 20.
DNS resolution in show commands is enabled
Full user help is disabled
Allowed input transports are none.
Allowed output transports are lat pad v120 lapb-ta telnet rlogin.
Preferred transport is lat.
No output characters are padded
No special data dispatching characters
TermServ#
如果想让modem的访问线路返回到空闲状态,使用clear line x:
TermServ# clear line 129
[confirm]
[OK]
TermServ#
阅读(2304) | 评论(1) | 转发(0) |