路由交换实验一 --------静态路由设置
实验拓扑:
实验步骤:
1.根据实验拓扑对路由器R1、R2、R3配置IP地址(将IP地址的第二个字节修改为自己的班级,第三个字节修改为自己的后两位学号,每个路由器的S1/0配置为DCE)
R1作为主机使用配置命令·
R1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#no ip routing
R1(config)#ip default-gateway 192.2.52.2
R1(config)#interface
R1(config)#interface f0/0
R1(config-if)#ip address 192.2.52.1 255.255.255.0
R1(config-if)#no shutdown
R2配置命令:
R2#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#interface f0/0
R2(config-if)#ip address 192.2.52.2 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#interface s1/0
R2(config-if)#ip address 193.2.52.1 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#interface s1/1
R2(config-if)#ip address 194.2.52.2 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#interface s1/0
R2(config-if)#clock rate 64000
R2(config-if)#
R3配置命令:
R3#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
R3(config)#interface f0/0
R3(config-if)#ip address 196.2.52.2 255.255.255.0
R3(config-if)#no shutdown
R3(config-if)#interface s1/0
R3(config-if)#ip address 195.2.52.1 255.255.255.0
R3(config-if)#clock rate 64000
R3(config-if)#no shutdown
R3(config-if)#interface s1/1
R3(config-if)#ip address 193.2.52.2 255.255.255.0
R3(config-if)#no shutdown
R4配置命令:
R4#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
R4(config)#interface f0/0
R4(config-if)#ip address 197.2.52.2 255.255.255.0
R4(config-if)#no shutdown
R4(config-if)#interface s1/0
R4(config-if)#ip address 194.2.52.1 255.255.255.0
R4(config-if)#clock rate 64000
R4(config-if)#no shutdown
R4(config-if)#interface s1/1
R4(config-if)#ip address 195.2.52.2 255.255.255.0
R4(config-if)#no shutdown
R4(config-if)#
2.给每个PC配置合适的IP地址和网关
R5配置命令:
R5#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
R5(config)#no ip routing
R5(config)#ip default-gateway 196.2.52.2
R5(config)#interface f0/0
R5(config-if)#ip address 196.2.52.1 255.255.255.0
R5(config-if)#no shutdown
R5(config-if)#
R6配置命令:
R6#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
R6(config)#no ip routing
R6(config)#ip default-gateway 197.2.52.2
R6(config)#interface f0/0
R6(config-if)#ip address 197.2.52.1 255.255.255.0
R6(config-if)#no shutdown
R6(config-if)#
问题一:主机R5pingR6能不能ping通?
答:不能ping通,因为中间节点路由器还没有配置静态路由,icmp请求报文并不知道如何到达目的网络
3.给每个路由器配置静态路由,使得每个主机之间都能ping通
R2路由器静态路由配置命令:
R2#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)# ip route 195.2.52.0 255.255.255.0 193.2.52.2
R2(config)# ip route 196.2.52.0 255.255.255.0 193.2.52.2
R2(config)# ip route 197.2.52.0 255.255.255.0 194.2.52.1
R2(config)#
R3路由器静态路由配置命令:
R3#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
R3(config)#ip route 192.2.52.0 255.255.255.0 193.2.52.1
R3(config)#ip route 194.2.52.0 255.255.255.0 193.2.52.1
R3(config)#ip route 197.2.52.0 255.255.255.0 195.2.52.2
R3(config)#
R4路由器静态路由配置命令:
R4#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
R4(config)#ip route 192.2.52.0 255.255.255.0 194.2.52.2
R4(config)#ip route 193.2.52.0 255.255.255.0 194.2.52.2
R4(config)#ip route 196.2.52.0 255.255.255.0 195.2.52.1
R4(config)#
问题2:
配置后查看路由表,看看和原来不同,在主机上能否相互ping通?
R2路由表:
R3路由表:
R4路由表:
主机互相ping测试:(结果显示已经可以连通)
问题三:
此时在路由器R2上关闭接口S1/0,在主机R5上尝试ping主机R1和R3?
R2#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#interface s1/0
R2(config-if)#shutdown
R2(config-if)#
*Mar 12 14:06:04.167: %LINK-5-CHANGED: Interface Serial1/0, changed state to administratively down
*Mar 12 14:06:05.167: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/0, changed state to down
R2(config-if)#
经测试在主机R5上ping不通主机R1(如下图)
4.在路由器R2和R3上增加浮动路由,实现链路备份
R2配置命令:
R2(config)#ip route 197.2.52.0 255.255.255.0 193.2.52.2 50
R2(config)#ip route 196.2.52.0 255.255.255.0 194.2.52.1 50
R3配置命令:
R3(config)#ip route 192.2.52.0 255.255.255.0 195.2.52.2 50
R3(config)#ip route 197.2.52.0 255.255.255.0 193.2.52.1 50
问题四:在路由器R2上查看路由表,看到的结果是什么?此时关闭路由器R2的S1/0接口,再次查看路由器R2的路由表有什么变化?
答:在路由器R2上查看路由表并没有什么变化,但是当关闭路由器R2的S1/0接口之后再次查看路由表时,路由表多出了所设置的浮动路由条目。
问题五:此时在路由器R2上关闭接口S1/0,在主机R5上能否ping通主机R1呢?能否ping通主机R6呢?
答:关闭路由器R2的S1/0接口,主机5仍能ping通主机R1(因为路由器R3上存在浮动路由)
关闭路由器R2的s1/0接口,主机5仍能ping通主机R6(因为R2的s1/0接口并不影响主机R5到主机R6的链路)
5.在R4上设置静态路由实现负载均衡
R4配置命令:
R4#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
R4(config)#ip route 192.2.52.0 255.255.255.0 195.2.52.1
R4(config)#ip route 196.2.52.0 255.255.255.0 194.2.52.2
R4(config)#end
在R4上查看路由表,发现路由表中去向192.2.52.0网段和去向196.2.52.0网段的链路多了两条,实现了负载均衡
6.在路由器R2上实现远程登陆
R2配置命令:
R2#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#username ZHJIAB secret 70052
R2(config)#line vty 0 4
R2(config-line)#login local
R2(config-line)#
主机R6配置命令:
R6#
R6#telnet 192.2.52.2
Trying 192.2.52.2 ... Open
User Access Verification
Username: ZHJIAB
Password:
R2>
问题7:在主机R6上尝试能否telnet路由器R2?如果可以,能否进入特权模式?不能的话通过什么配置可以进入特权模式?
答:在主机R6上telnet路由器R2之后不能进入特权模式,原因是未设置特权模式密码
回到路由器R2设置特权模式密码
在主机R6上telnet路由器R2之后尝试进入特权模式