1.1
实验任务
在网络中为路由器配置Loopback地址,组建OSPF的Stubby区域、主干区域和NSSA区域,配置虚链路和RIP路由协议。
1.2
实验环境和网络拓扑
1.3
完成标准
(1)
按照拓扑图要求连接路由器,在R1和R2间配置Stu区域,在R2和R3间配置虚链路,在R3和R4 间配置主干区,在R4和R5间配置NSSA区域,在R5和R6间配置RIP路由。
(2)
检查路由表,所有路由器间都能通信。
2
.详细操作步骤
Step 1:
配置路由器
路由器R1配置如下:
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#ho R1
R1(config)#interface loopback 0 //配置Loopback地址
R1(config-if)#ip address 1.1.1.1 255.0.0.0
R1(config-if)#interface f0/0 //配置端口IP
R1(config-if)#ip address 192.168.10.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#exit
*Dec 8 21:22:42.559: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Dec 8 21:22:43.559: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R1(config)#interface f0/0
R1(config-if)#duplex full //设置端口全双工模式
R1(config-if)#exit
R1(config)#router ospf 1 //配置进程为1的OSPF
R1(config-router)#network 192.168.10.0 0.0.0.255 area 1 //配置区域1的网段
R1(config-router)#area 1 stub //配置区域1为末梢区域
R1(config-router)#exit
*Dec 8 21:31:14.959: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on FastEthernet0/0 from LOADING to FULL, Loading Done
R1(config)#exit
路由器R2配置如下:
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#ho R2
R2(config)#interface loopback 0 //配置Loopback地址
R2(config-if)#ip address 2.2.2.2 255.0.0.0
R2(config-if)#interface f1/1 //配置端口IP
R2(config-if)#ip address 192.168.10.2 255.255.255.0
R2(config-if)#no shut
*Dec 8 21:23:38.195: %LINK-3-UPDOWN: Interface FastEthernet1/1, changed state to up
*Dec 8 21:23:39.195: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/1, changed state to up
R2(config-if)#interface f0/0 //配置端口IP
R2(config-if)#ip address 192.168.20.1 255.255.255.0
R2(config-if)#no shut
*Dec 8 21:24:06.279: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Dec 8 21:24:07.279: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R2(config-if)#duplex full //设置端口全双工模式
R2(config-if)#exit
R2(config)#router ospf 2 //配置进程为2的OSPF
R2(config-router)#network 192.168.10.0 0.0.0.255 area 1 //配置区域1的网段
R2(config-router)#area 1 stub //配置区域1为末梢区域
*Dec 8 21:31:14.311: %OSPF-5-ADJCHG: Process 2, Nbr 1.1.1.1 on FastEthernet1/1
from LOADING to FULL, Loading Done
R2(config-router)#network 192.168.20.0 0.0.0.255 area 2 //配置区域2的网段
R2(config-router)#exit
*Dec 8 21:32:22.555: %OSPF-5-ADJCHG: Process 2, Nbr 3.3.3.3 on FastEthernet0/0 from LOADING to FULL, Loading Done
R2(config)#router ospf 2
R2(config-router)#area 2 virtual-link 3.3.3.3 //配置区域2虚链路为R3的RID
R2(config-router)#exit
*Dec 8 21:38:31.471: %OSPF-5-ADJCHG: Process 2, Nbr 3.3.3.3 on OSPF_VL0 from LOADING to FULL, Loading Done
R2(config)#exit
路由器R3配置如下:
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#ho R3
R3(config)#interface loopback 0 //配置Loopback地址
R3(config-if)#ip address 3.3.3.3 255.0.0.0
R3(config-if)#interface f1/1 //配置端口IP
R3(config-if)#ip address 192.168.20.2 255.255.255.0
R3(config-if)#no shut
R3(config-if)#interface f0/0 //配置端口IP
R3(config-if)#ip address 192.168.30.1 255.255.255.0
R3(config-if)#no shut
R3(config-if)#
*Dec 8 21:26:20.175: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Dec 8 21:26:21.175: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R3(config-if)#duplex full //设置端口全双工模式
R3(config-if)#exit
R3(config)#router ospf 3 //配置进程为3的OSPF
R3(config-router)#network 192.168.20.0 0.0.0.255 area 2 //配置区域2的网段
*Dec 8 21:32:22.947: %OSPF-5-ADJCHG: Process 3, Nbr 2.2.2.2 on FastEthernet1/1 from LOADING to FULL, Loading Done
R3(config-router)#network 192.168.30.0 0.0.0.255 area 0 //配置区域0的网段-骨干区域
R3(config-router)#exit
*Dec 8 21:33:11.855: %OSPF-5-ADJCHG: Process 3, Nbr 4.4.4.4 on FastEthernet0/0from LOADING to FULL, Loading Done
*Dec 8 21:37:51.639: %OSPF-4-ERRRCV: Received invalid packet: mismatch area ID, from backbone area must be virtual-link but not found from 192.168.20.1, FastEthernet1/1
R3(config)#router ospf 3
R3(config-router)#area 2 virtual-link 2.2.2.2 //配置区域2虚链路为R2的RID
R3(config-router)#exit
路由器R4配置如下:
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#ho R4
R4(config)#interface loopback 0 //配置Loopback地址
R4(config-if)#ip address 4.4.4.4 255.0.0.0
R4(config-if)#interface f1/1 //配置端口IP
R4(config-if)#ip address 192.168.30.2 255.255.255.0
R4(config-if)#no shut
*Dec 8 21:27:10.603: %LINK-3-UPDOWN: Interface FastEthernet1/1, changed state to up
*Dec 8 21:27:11.603: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/1, changed state to up
R4(config-if)#interface f0/0 //配置端口IP
R4(config-if)#ip address 192.168.40.1 255.255.255.0
R4(config-if)#no shut
*Dec 8 21:27:30.795: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Dec 8 21:27:31.795: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R4(config-if)#duplex full //设置端口全双工模式
R4(config-if)#exit
R4(config)#router ospf 4 //配置进程为4的OSPF
R4(config-router)#network 192.168.30.0 0.0.0.255 area 0 //配置区域0的网段-骨干区域
*Dec 8 21:33:12.371: %OSPF-5-ADJCHG: Process 4, Nbr 3.3.3.3 on FastEthernet1/1from LOADING to FULL, Loading Done
R4(config-router)#network 192.168.40.0 0.0.0.255 area 3 //配置区域3的网段
R4(config-router)#area 3 nssa //配置区域3为NSSA区域
R4(config-router)#exit
*Dec 8 21:34:29.371: %OSPF-5-ADJCHG: Process 4, Nbr 5.5.5.5 on FastEthernet0/0from LOADING to FULL, Loading Done
R4(config)#exit
路由器R5配置如下:
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#ho R5
R5(config)#interface loopback 0 //配置Loopback地址
R5(config-if)#ip address 5.5.5.5 255.0.0.0
R5(config-if)#interface f1/1 //配置端口IP
R5(config-if)#ip address 192.168.40.2 255.255.255.0
R5(config-if)#no shut
R5(config-if)#
*Dec 8 21:28:23.147: %LINK-3-UPDOWN: Interface FastEthernet1/1, changed state to up
*Dec 8 21:28:24.147: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/1, changed state to up
R5(config-if)#interface f0/0 //配置端口IP
R5(config-if)#ip address 192.168.50.1 255.255.255.0
R5(config-if)#no shut
R5(config-if)#
*Dec 8 21:28:40.935: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Dec 8 21:28:41.935: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R5(config-if)#duplex full //设置端口全双工模式
R5(config-if)#exit
R5(config)#router ospf 5 //配置进程为5的OSPF
R5(config-router)#network 192.168.40.0 0.0.0.255 area 3 //配置区域3的网段
R5(config-router)#area 3 nssa //配置区域3为NSSA区域
*Dec 8 21:34:29.667: %OSPF-5-ADJCHG: Process 5, Nbr 4.4.4.4 on FastEthernet1/1 from LOADING to FULL, Loading Done
R5(config-router)#exit
R5(config)#router rip //配置RIP路由协议
R5(config-router)#version 2 //版本2
R5(config-router)#network 192.168.50.0 //路由到R5所在网段
R5(config-router)#redistribute ospf 5 metric 10 //重分发进程5的OSPF度量值10
R5(config-router)#exit
R5(config)#router ospf 5
R5(config-router)#redistribute rip subnets //重分发RIP路由所有子网
R5(config-router)#exit
R5(config)#exit
路由器R6配置如下:
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#ho R6
R6(config)#interface loopback 0 //配置Loopback地址
R6(config-if)#ip address 6.6.6.6 255.0.0.0
R6(config-if)#interface f1/1 //配置端口IP
R6(config-if)#ip address 192.168.50.2 255.255.255.0
R6(config-if)#no shut
R6(config-if)#exit
*Dec 8 21:29:31.367: %LINK-3-UPDOWN: Interface FastEthernet1/1, changed state to up
*Dec 8 21:29:32.367: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/1, changed state to up
R6(config)#router rip //配置RIP路由协议
R6(config-router)#version 2 //版本2
R6(config-router)#network 192.168.50.0 //路由到R5所在网段
R6(config-router)#network 6.0.0.0 //路由到Loopback网段
R6(config-router)#exit
Step 2:
检查各路由器上的路由表
路由器R1路由表显示如下:
C 1.0.0.0/8 is directly connected, Loopback0
//1.0.0.0/8网段直连,环路0
O IA 192.168.30.0/24 [110/3] via 192.168.10.2, 00:00:31, FastEthernet0/0
//OSPF Inter-Area 区域内192.168.30.0/24网段 [路径110/代价3]通过192.168.10.2 时间31秒,端口F0/0
C 192.168.10.0/24 is directly connected, FastEthernet0/0
//192.168.10.0/24网段直连,端口F0/0
O IA 192.168.40.0/24 [110/4] via 192.168.10.2, 00:00:31, FastEthernet0/0
//OSPF Inter-Area 区域内192.168.40.0/24 网段[路径110/代价4]通过192.168.10.2 时间31秒端口F0/0
O IA 192.168.20.0/24 [110/2] via 192.168.10.2, 00:01:21, FastEthernet0/0
//OSPF Inter-Area 区域内192.168.20.0/24网段 [路径110/代价2]通过192.168.10.2 时间21秒端口F0/0
O*IA 0.0.0.0/0 [110/2] via 192.168.10.2, 00:01:21, FastEthernet0/0
//OSPF 候选默认 Inter-Area 区域内 0.0.0.0/0网段[路径110/代价2]通过192.168.10.2 时间21秒端口F0/0
路由器R2路由表显示如下:
C 2.0.0.0/8 is directly connected, Loopback0
O 192.168.30.0/24 [110/2] via 192.168.20.2, 00:00:45, FastEthernet0/0
C 192.168.10.0/24 is directly connected, FastEthernet1/1
O IA 192.168.40.0/24 [110/3] via 192.168.20.2, 00:00:45, FastEthernet0/0
O E2 6.0.0.0/8 [110/20] via 192.168.20.2, 00:00:45, FastEthernet0/0
//OSPF External Type 2 外部路径类型2 6.0.0.0/8网段[路径110/代价20]通过192.168.20.2 时间45秒,端口F0/0
C 192.168.20.0/24 is directly connected, FastEthernet0/0
O E2 192.168.50.0/24 [110/20] via 192.168.20.2, 00:00:45, FastEthernet0/0
//OSPF External Type 2 外部路径类型2 192.168.50.0/24网段[路径110/代价20]通过192.168.20.2 时间45秒,端口F0/0
路由器R3路由表显示如下:
C 3.0.0.0/8 is directly connected, Loopback0
C 192.168.30.0/24 is directly connected, FastEthernet0/0
O IA 192.168.10.0/24 [110/2] via 192.168.20.1, 00:00:51, FastEthernet1/1
O IA 192.168.40.0/24 [110/2] via 192.168.30.2, 00:00:51, FastEthernet0/0
O E2 6.0.0.0/8 [110/20] via 192.168.30.2, 00:00:41, FastEthernet0/0
C 192.168.20.0/24 is directly connected, FastEthernet1/1
O E2 192.168.50.0/24 [110/20] via 192.168.30.2, 00:00:41, FastEthernet0/0
路由器R4路由表显示如下:
C 192.168.30.0/24 is directly connected, FastEthernet1/1
C 4.0.0.0/8 is directly connected, Loopback0
O IA 192.168.10.0/24 [110/3] via 192.168.30.1, 00:00:58, FastEthernet1/1
C 192.168.40.0/24 is directly connected, FastEthernet0/0
O N2 6.0.0.0/8 [110/20] via 192.168.40.2, 00:00:58, FastEthernet0/0
//OSPF NSSA External Type 2 非纯末梢区域外部路径类型2 6.0.0.0/8网段[路径110/代价20]通过192.168.40.2 时间58秒,端口F0/0
O IA 192.168.20.0/24 [110/2] via 192.168.30.1, 00:00:58, FastEthernet1/1
O N2 192.168.50.0/24 [110/20] via 192.168.40.2, 00:00:58, FastEthernet0/0
//OSPF NSSA External Type 2 非纯末梢区域外部路径类型2 192.168.50.0/24网段[路径110/代价20]通过192.168.40.2 时间58秒,端口F0/0
路由器R5路由表显示如下:
O IA 192.168.30.0/24 [110/2] via 192.168.40.1, 00:03:46, FastEthernet1/1
C 5.0.0.0/8 is directly connected, Loopback0
O IA 192.168.10.0/24 [110/4] via 192.168.40.1, 00:01:04, FastEthernet1/1
C 192.168.40.0/24 is directly connected, FastEthernet1/1
R 6.0.0.0/8 [120/1] via 192.168.50.2, 00:00:09, FastEthernet0/0
//RIP 6.0.0.0/8网段[路径120/代价1]通过192.168.50.2 时间9秒,端口F0/0
O IA 192.168.20.0/24 [110/3] via 192.168.40.1, 00:03:46, FastEthernet1/1
C 192.168.50.0/24 is directly connected, FastEthernet0/0
路由器R6路由表显示如下:
R 192.168.30.0/24 [120/10] via 192.168.50.1, 00:00:12, FastEthernet1/1
R 192.168.10.0/24 [120/10] via 192.168.50.1, 00:00:12, FastEthernet1/1
R 192.168.40.0/24 [120/10] via 192.168.50.1, 00:00:12, FastEthernet1/1
C 6.0.0.0/8 is directly connected, Loopback0
R 192.168.20.0/24 [120/10] via 192.168.50.1, 00:00:12, FastEthernet1/1
C 192.168.50.0/24 is directly connected, FastEthernet1/1
Step 3:
连通性检查
正向R1连通性检查:
R1#ping 192.168.10.2
//R2区域1端口
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.10.2, timeout is 2 seconds:
//正在发送5个100字节ICMP网间控制报文协议回应到192.168.10.2,超时2秒
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 28/57/116 ms
//成功率为100分之一百 (5.5),往返 最小/平均/最大 = 28/57/116 毫秒
R1#ping 192.168.20.1
//R2区域2端口
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.20.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 28/58/120 ms
R1#ping 192.168.20.2
//R3区域2端口
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.20.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 64/99/168 ms
R1#ping 192.168.30.1
//R3区域0端口
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.30.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 76/99/136 ms
R1#ping 192.168.30.2
//R4区域0端口
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.30.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 92/112/168 ms
R1#ping 192.168.40.1
//R4区域3端口
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.40.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 64/114/152 ms
R1#ping 192.168.40.2
//R5区域3端口
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.40.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 124/164/248 ms
R1#ping 192.168.50.1
//R5 RIP端口
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.50.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 140/180/264 ms
R1#ping 192.168.50.2
//R6 RIP端口
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.50.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 156/224/308 ms
反向R6连通性检查:
R6#ping 192.168.50.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.50.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 28/68/140 ms
R6#ping 192.168.40.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.40.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 32/68/152 ms
R6#ping 192.168.40.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.40.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 60/96/168 ms
R6#ping 192.168.30.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.30.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 60/89/184 ms
R6#ping 192.168.30.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.30.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 76/130/200 ms
R6#ping 192.168.20.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.20.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 100/136/208 ms
R6#ping 192.168.20.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.20.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 124/173/232 ms
R6#ping 192.168.10.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.10.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 144/198/276 ms
R6#ping 192.168.10.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.10.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 156/198/260 ms
3
.实验总结
l
非纯末梢网络NSSA (Not-So-Stubby Area) 允许外部路由通告到OSPF自治系统内部,同时保留AS的其余部分的Stub区域特性。为做到这点,在NSSA区域内的ASBR将始发类型7的LSA来通告那些外部的目的网络。这些NSSA外部的LSA将在整个NSSA区域中进行泛洪,但会在ABR路由器的地方被阻塞。
l
Cisco路由器可执行两种类型的地址汇总:区域间路由汇总(Inter-area summarization) 和外部路由汇总(External route summarization)。
l
现实网络存在多种路由协议,且这些网络需要互联互通,那么至少有一台路由器运行多种路由协议来实现不同网络之间的通信。由此,路由重分发的问题不可避免。
l
运用虚链路的目的在于:通过一个非骨干区域连接一个区域到骨干区域或通过一个非骨干区域连接一个分段的骨干区域两边的部分区域。