实验11 ospf综合实验
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
OSPF综合实验
一、实验拓扑图,如图1.1所示:
图1.1 ospf综合实验拓扑图
二、实验要求:
1.要求全网互通
2.R1、R5之间链路断开后,全网仍能互通
3.R2永远为DR
4.区域34为NSSA区域
5.在区域0中仅出现2.2.0.0/22 的汇总路由
6.除R3之外,所有路由仅有3.3.0.0/22的路由
7.区域0中所有接口及虚链路做密文认证,认证密钥为cisco
8.在R5上产生默认路由
三、实验配置:
1.预配置:
//R1上的预配置
R1(config)#int lo 0
R1(config-if)#ip add 1.1.1.1 255.255.255.0
R1(config-if)#int s3/0
R1(config-if)#ip add 123.0.0.1 255.255.255.0
R1(config-if)#no sh
R1(config-if)#int s2/2
R1(config-if)#ip add 15.0.0.1 255.255.255.0
R1(config-if)#no sh
//R2上的预配置
R2(config)#int lo 0
R2(config-if)#ip add 2.2.0.2 255.255.255.0 R2(config-if)#int lo 1
R2(config-if)#ip add 2.2.1.2 255.255.255.0 R2(config-if)#int lo 2
R2(config-if)#ip add 2.2.2.2 255.255.255.0 R2(config-if)#int lo 3
R2(config-if)#ip add 2.2.3.2 255.255.255.0 R2(config-if)#int s3/0
R2(config-if)#ip add 123.0.0.2 255.255.255.0 R2(config-if)#no sh
R2(config-if)#int f0/0
R2(config-if)#ip add 25.0.0.2 255.255.255.0 R2(config-if)#no sh
//R3上的预配置
R3(config)#int lo 0
R3(config-if)#ip add 3.3.0.3 255.255.255.0 R3(config-if)#int lo 1
R3(config-if)#ip add 3.3.1.3 255.255.255.0 R3(config-if)#int lo 2
R3(config-if)#ip add 3.3.2.3 255.255.255.0 R3(config-if)#int lo 3
R3(config-if)#ip add 3.3.3.3 255.255.255.0 R3(config-if)#int s3/0
R3(config-if)#ip add 123.0.0.3 255.255.255.0 R3(config-if)#no sh
R3(config-if)#int s2/2
R3(config-if)#ip add 34.0.0.3 255.255.255.0 R3(config-if)#no sh
//R4上的预配置
R4(config)#int lo 0
R4(config-if)#ip add 4.4.4.4 255.255.255.0 R4(config-if)#int f0/0
R4(config-if)#ip add 25.0.0.4 255.255.255.0 R4(config-if)#no sh
R4(config-if)#int s2/1
R4(config-if)#ip add 34.0.0.4 255.255.255.0 R4(config-if)#no sh
//R5上的预配置
R5(config)#int lo 0
R5(config-if)#ip add 5.5.5.5 255.255.255.0 R5(config-if)#int lo 1
R5(config-if)#ip add 10.0.0.1 255.255.255.0
R5(config-if)#int f0/0
R5(config-if)#ip add 25.0.0.5 255.255.255.0
R5(config-if)#no sh
R5(config-if)#int s2/1
R5(config-if)#ip add 15.0.0.5 255.255.255.0
R5(config-if)#no sh
2.各路由器的上的具体配置:
//R1上的具体配置
R1(config)#interface Loopback0
R1(config-if)# ip ospf authentication message-digest //启用链路MD5认证
R1(config-if)# ip ospf message-digest-key 1 md5 cisco //配置key ID及密匙
R1(config-if)#interface Serial2/2
R1(config-if)# ip ospf authentication message-digest
R1(config-if)# ip ospf message-digest-key 1 md5 cisco
R1(config-if)#interface Serial3/0
R1(config-if)# encapsulation frame-relay //帧中继封装
R1(config-if)# frame-relay map ip 123.0.0.2 102 broadcast //帧中继类型配置为广播R1(config-if)# no arp frame-relay //关闭ARP
R1(config-if)# no frame-relay inverse-arp//关闭inverse-arp
R1(config-if)# ip ospf network broadcast //配置OSPF网络位broadcast
R1(config-if)# ip ospf priority 0 //S3/0的DR/BDR的选举权
R1(config-if)#router ospf 1
R1(config-router)# router-id 1.1.1.1
R1(config-router)# area 123 range 2.2.0.0 255.255.252.0
//配置虚链路且开启md5认证
R1(config-router)#$irtual-link 2.2.2.2 message-digest-key 1 md5 cisco
R1(config-router)# network 1.1.1.1 0.0.0.0 area 0
R1(config-router)# network 15.0.0.1 0.0.0.0 area 0
R1(config-router)# network 123.0.0.1 0.0.0.0 area 123
//R2上的具体配置
R2(config-if)#interface Serial3/0
R2(config-if)# encapsulation frame-relay
R2(config-if)# ip ospf network broadcast
R2(config-if)# ip ospf priority 10
R2(config-if)# no arp frame-relay
R2(config-if)# frame-relay map ip 123.0.0.1 201 broadcast
R2(config-if)# frame-relay map ip 123.0.0.3 203 broadcast
R2(config-if)# no frame-relay inverse-arp
R2(config-if)#router ospf 1
R2(config-router)# router-id 2.2.2.2
R2(config-router)#$rtual-link 5.5.5.5 message-digest-key 1 md5 cisco
R2(config-router)# area 123 range 2.2.0.0 255.255.252.0//手动汇总
R2(config-router)#$irtual-link 1.1.1.1 message-digest-key 1 md5 cisco
R2(config-router)# network 2.2.0.0 0.0.255.255 area 123
R2(config-router)# network 25.0.0.2 0.0.0.0 area 25
R2(config-router)# network 123.0.0.2 0.0.0.0 area 123
//R3上的具体配置
R3(config)#interface Serial3/0
R3(config-if)# encapsulation frame-relay
R3(config-if)# ip ospf network broadcast
R3(config-if)# ip ospf priority 0
R3(config-if)# no arp frame-relay
R3(config-if)# frame-relay map ip 123.0.0.2 302 broadcast
R3(config-if)# no frame-relay inverse-arp
R3(config-if)#router eigrp 1
R3(config-router)# network 3.3.0.0 0.0.255.255
R3(config-router)# no auto-summary
R3(config-router)#router ospf 1
R3(config-router)# router-id 3.3.3.3
R3(config-router)# area 34 nssa
R3(config-router)# summary-address 3.3.0.0 255.255.252.0//域间汇总
R3(config-router)# redistribute eigrp 1 subnets //重分布eigrp路由进ospf R3(config-router)# network 34.0.0.3 0.0.0.0 area 34
R3(config-router)# network 123.0.0.3 0.0.0.0 area 123
//R4上的具体配置
R4(config-router)#router rip//开启rip进程
R4(config-router)# version 2
R4(config-router)# network 4.0.0.0
R4(config-if)#router ospf 1
R4(config-router)# router-id 4.4.4.4
R4(config-router)#$rtual-link 5.5.5.5 message-digest-key 1 md5 cisco
R4(config-router)# area 34 nssa
R4(config-router)# redistribute rip subnets//重分布rip进ospf
R4(config-router)# network 25.0.0.4 0.0.0.0 area 25
R4(config-router)# network 34.0.0.4 0.0.0.0 area 34
//R5上的具体配置
R5(config)#interface Loopback0
R5(config-if)# ip ospf authentication message-digest
R5(config-if)# ip ospf message-digest-key 1 md5 cisco
R5(config-if)#interface Serial2/1
R5(config-if)# ip ospf authentication message-digest
R5(config-if)# ip ospf message-digest-key 1 md5 cisco
R5(config-if)#router ospf 1
R5(config-router)# router-id 5.5.5.5
R5(config-router)#$rtual-link 4.4.4.4 message-digest-key 1 md5 cisco
R5(config-router)#$rtual-link 2.2.2.2 message-digest-key 1 md5 cisco
R5(config-router)# network 5.5.5.5 0.0.0.0 area 0
R5(config-router)# network 15.0.0.5 0.0.0.0 area 0
R5(config-router)# network 25.0.0.5 0.0.0.0 area 25
R5(config-router)# default-information originate always //产生默认路由
四、实验调试:
1.查看R1上的路由表
R1(config-line)#do sh ip rout
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is 15.0.0.5 to network 0.0.0.0
34.0.0.0/24 is subnetted, 1 subnets
O IA 34.0.0.0 [110/129] via 15.0.0.5, 00:40:45, Serial2/2
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
2.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
O 2.2.2.2/32 [110/65] via 123.0.0.2, 00:40:45, Serial3/0
O 2.2.0.0/22 is a summary, 00:40:45, Null0
O 2.2.3.2/32 [110/65] via 123.0.0.2, 00:40:45, Serial3/0
O 2.2.0.2/32 [110/65] via 123.0.0.2, 00:40:45, Serial3/0
O 2.2.1.2/32 [110/65] via 123.0.0.2, 00:40:45, Serial3/0
3.0.0.0/22 is subnetted, 1 subnets
O E2 3.3.0.0 [110/20] via 123.0.0.3, 00:40:45, Serial3/0
4.0.0.0/24 is subnetted, 1 subnets
O E2 4.4.4.0 [110/20] via 15.0.0.5, 00:40:46, Serial2/2
5.0.0.0/32 is subnetted, 1 subnets
O 5.5.5.5 [110/65] via 15.0.0.5, 00:40:46, Serial2/2
25.0.0.0/24 is subnetted, 1 subnets
O IA 25.0.0.0 [110/65] via 123.0.0.2, 00:40:46, Serial3/0
[110/65] via 15.0.0.5, 00:40:46, Serial2/2
123.0.0.0/24 is subnetted, 1 subnets
C 123.0.0.0 is directly connected, Serial3/0
15.0.0.0/24 is subnetted, 1 subnets
C 15.0.0.0 is directly connected, Serial2/2
O*E2 0.0.0.0/0 [110/1] via 15.0.0.5, 00:40:46, Serial2/2
以上输出表明,R1上已经可以全网访问,收敛已完成。
2.在R1上查看ospf数据库:
R1(config-line)# do sh ip os da
OSPF Router with ID (1.1.1.1) (Process ID 1)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
1.1.1.1 1.1.1.1 1893 0x8000000B 0x002251 4
2.2.2.2 2.2.2.2 1 (DNA) 0x80000006 0x0023F5 2
4.4.4.4 4.4.4.4 2 (DNA) 0x80000006 0x00CE09 1
5.5.5.5 5.5.5.5 1701 0x8000000F 0x00E6BF 5
Summary Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
2.2.0.0 1.1.1.1 633 0x80000002 0x00B441
2.2.0.0 2.2.2.2 28 (DNA) 0x80000002 0x00141E
25.0.0.0 2.2.2.2 1014 (DNA) 0x80000002 0x000F0B
25.0.0.0 4.4.4.4 1521 (DNA) 0x80000002 0x00D23F
25.0.0.0 5.5.5.5 186 0x80000005 0x00AE5C
34.0.0.0 4.4.4.4 1521 (DNA) 0x80000002 0x00D5F3
123.0.0.0 1.1.1.1 1634 0x80000004 0x00A2D7
123.0.0.0 2.2.2.2 1014 (DNA) 0x80000002 0x0088EF
Summary ASB Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
3.3.3.3 1.1.1.1 389 0x80000004 0x004F99
3.3.3.3 2.2.2.2 755 (DNA) 0x80000002 0x0035B1
4.4.4.4 2.2.2.2 755 (DNA) 0x80000002 0x008E93
4.4.4.4
5.5.5.5 444 0x80000004 0x0030E3
5.5.5.5 2.2.2.2 515 (DNA) 0x80000002 0x0060BD
5.5.5.5 4.4.4.4 765 (DNA) 0x80000002 0x0024F1
以上输出表明,Area 0上只具有2.2.0.0/24的汇总路由,没有明细路由。
3.将R1的S2/2接口shutdown,查看其路由表:
R1(config-line)# int s2/2
R1(config-if)#sh
R1(config-if)#
*Aug 5 17:13:05.775: %OSPF-5-ADJCHG: Process 1, Nbr 5.5.5.5 on Serial2/2 from FULL to DOWN, Neighbor Down: Interface down or detached
R1(config-if)#
*Aug 5 17:13:07.743: %LINK-5-CHANGED: Interface Serial2/2, changed state to administratively down
*Aug 5 17:13:08.743: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial2/2, changed state to down
R1(config-if)#do ship rout
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is 123.0.0.2 to network 0.0.0.0
34.0.0.0/24 is subnetted, 1 subnets
O IA 34.0.0.0 [110/130] via 123.0.0.2, 00:00:04, Serial3/0
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
2.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
O 2.2.2.2/32 [110/65] via 123.0.0.2, 00:47:03, Serial3/0
O 2.2.0.0/22 is a summary, 00:47:03, Null0
O 2.2.3.2/32 [110/65] via 123.0.0.2, 00:47:03, Serial3/0
O 2.2.0.2/32 [110/65] via 123.0.0.2, 00:47:03, Serial3/0
O 2.2.1.2/32 [110/65] via 123.0.0.2, 00:47:03, Serial3/0
3.0.0.0/22 is subnetted, 1 subnets
O E2 3.3.0.0 [110/20] via 123.0.0.3, 00:00:04, Serial3/0
4.0.0.0/24 is subnetted, 1 subnets
O E2 4.4.4.0 [110/20] via 123.0.0.2, 00:00:04, Serial3/0
5.0.0.0/32 is subnetted, 1 subnets
O 5.5.5.5 [110/66] via 123.0.0.2, 00:00:04, Serial3/0
25.0.0.0/24 is subnetted, 1 subnets
O IA 25.0.0.0 [110/65] via 123.0.0.2, 00:00:04, Serial3/0
123.0.0.0/24 is subnetted, 1 subnets
C 123.0.0.0 is directly connected, Serial3/0
15.0.0.0/24 is subnetted, 1 subnets
O 15.0.0.0 [110/129] via 123.0.0.2, 00:00:04, Serial3/0
O*E2 0.0.0.0/0 [110/1] via 123.0.0.2, 00:00:04, Serial3/0
以上输出结果表明,R1与R5间的链路down以后,任然能全网互通。
4.在R2上查看ospf邻居信息:
R2(config-line)#do shipos ne
Neighbor ID Pri State Dead Time Address Interface
1.1.1.1 0 FULL/ - - 123.0.0.1
OSPF_VL1
5.5.5.5 0 FULL/ - - 25.0.0.5
OSPF_VL0
4.4.4.4 1 FULL/BDR 00:00:32 2
5.0.0.4
FastEthernet0/0
5.5.5.5 1 FULL/DROTHER 00:00:30 25.0.0.5
FastEthernet0/0
1.1.1.1 0 FULL/DROTHER 00:00:36 123.0.0.1
Serial3/0
3.3.3.3 0 FULL/DROTHER 00:00:38 123.0.0.3
Serial3/0
以上输出说明,R2为DR。