配置终端访问服务器<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

1. 实验目的

(1) 配置终端访问服务器,并制作一个简单的菜单;

(2) 使用终端访问服务器控制路由器;

2 :实验环境:

如下图所示的拓扑结构R0是终端服务器通过R0我们可以登陆到下面的任何一个交换机和路由器

<?xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" />

实验步骤:

1 进入R0进行如下的配置

Router>en

Router#config t

Router(config)# enable secret cisco

// 以上是配置进入特权模式的密码,防止他人修改终端服务器的配置

Router(config)# no ip domain-lookup

// 以上禁止路由器查找DNS 服务器,防止我们输入错误命令时的长时间等待

Router(config)# line vty 0 15

Router(config-line)# no login

Router(config-line)# logging synchronous

Router(config-line)# no exec-timeout

// 以上允许任何人不需密码就可以telnet 该终端服务器,并且即使长时间不输入命令也不

超时自动logout 出来

Router(config-line)#exit

Router(config)#int 5/0

Router(config-if)#ip add 192.168.1.1 255.255.255.0

Router(config-if)#no shut

Router(config-if)#exit

Router(config)# no ip routing

// 由于终端服务器不需要路由功能,所以关闭路由功能,这时终端服务器相当于一台计算机

Router(config)# ip default-gateway 192.168.1.1

// 配置网关,允许他人从别的网段telnet 该终端服务器

Router(config)#end

Router#sh line

// 以上是查看终端服务器上异步模块的各异步口所在的线路编号,tty 表示的就是异步模块

Router#config t

Router(config)# line 33 48

Router(config-line)# transport input all

// 进入线路模式下,线路允许所有传入,实际上我们只允许telnet 进入即可

Router(config-line)#exit

Router(config)# int loopback0

Router(config-if)# ip address <?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />1.1.1.1 255.255.255.255

// 以上配置loopback0 接口的ip 地址,loopback 接口是一个逻辑上的接口,路由器上可以

任意创建几乎无穷多的loopback 接口,该接口可以永远是UP 的。loopback 接口经常用于

测试等。

Router (config-if)#exit

Router (config)#ip host R1 2033 1.1.1.1

Router (config)#ip host R2 2034 1.1.1.1

Router (config)#ip host R3 2035 1.1.1.1

Router (config)#ip host R4 2036 1.1.1.1

Router (config)#ip host S1 2037 1.1.1.1

Router (config)#ip host S2 2038 1.1.1.1

// 从终端服务器控制各路由器,是通过反向telnet 实现的,此时telnet 的端口号为线路编

号加上2000,例如line 33,其端口号为2033,如果要控制line 33 线路上连接的路由器,

我们可以采用:“telnet 1.1.1.1 2033命令。然而这样命令很长,为了方便,所以我们

使用“ip host”命令定义一系列的主机名,这样可以之间输入“R1”控制line 33 线路上

连接的路由器了。

Router (config)#alias exec cr1 clear line 33

Router (config)#alias exec cr2 clear line 34

Router (config)#alias exec cr3 clear line 35

Router (config)#alias exec cr4 clear line 36

Router (config)#alias exec cs1 clear line 37

Router (config)#alias exec cs2 clear line 38

Router (config)#alias exec cs3 clear line 39

// 以上是定义了一系列的命令别名,例如“cr1=clear line 33,“clear line”命令

的作用是清除线路

Router (config)#privilege exec level 0 clear line

Router (config)#privilege exec level 0 clear

// 以上是使得我们在用户模式下也能使用“clear line”和“clear”命令

2 :由于是模拟的实验环境我们要配置路由的名子和交换机的名子

在真实的环境中这一步是不要的

3 :在PC0通过telnet命令到R0然后在

登陆到其他的路由和交换机

小结

这个实验在PK中是做不出来的我用小凡可以

下面是在一个书上面看到的关于这个的实验命令觉得很好就借鉴下与各位多多交流