拓扑图
要求
1.R4为ISP,其上只能配置IP地址: R4与其他所有直连设备间使用公有IP
2.R3---R5/6/7为MGRE环境,R3为中心站点
3.整个OSPF环境IP地址为172.16.0.0/16
4.所有设备均可访问R4的环回
5.减少LSA的更新量,加快收敛,保障更新安全
6.全网可达
实验思路
1、根据实验要求对172.16.0.0/16网段进行子网划分,方便之后的子网汇总,从而实现对路由条目的减少。
2、对各个设备进行IP地址的配置,及环回接口的配置。
3、对R3、R5、R6、R7设备进行MGRE环境的配置,R3为中心站点,并在这四个路由器上而配置到ISP的缺省路由,实现对边界路由器的私网互通。
4、对各个路由器进行配置OSPF协议并进行宣告,让其各个路由器获取其他网段的路由拓扑信息,从而获取路由条目。
5、将域外路由通过重发布实现OSPF内可以互通。
6、对需要做特殊区域的区域做特殊区域的配置
7、对边界路由器配置NAT协议从而实现可以对公网的访问
IP划分:172.16.0.0/16
172.16.0.0/19 ------area0
172.16.0.0/24 -------P2P骨干
172.16.1.0/24 -------MA骨干
172.16.1.0/29
172.16.2.0/24 — 用户网段
172.16.3.0/24 — 用户网段
172.16.4.0/24 — 用户网段
172.16.32.0/19 ------area1
172.16.32.0/24 -------P2P骨干
172.16.33.0/24 -------MA骨干
172.16.33.0/29
172.16.34.0/24 —r1环回
172.16.35.0/24 —r2环回
172.16.36.0/24 —r3环回
172.16.64.0/19 ------area2
172.16.64.0/24 -------P2P骨干
172.16.65.0/24 -------MA骨干
172.16.65.0/29
172.16.65.8/29
172.16.66.0/24 —r11环回
172.16.96.0/19 ------area3
172.16.96.0/24 -------P2P骨干
172.16.97.0/24 -------MA骨干
172.16.97.0/29
172.16.97.8/29
172.16.98.0/24 —r8环回
172.16.128.0/19 ------area4
172.16.128.0/24 -------P2P骨干
172.16.129.0/24 -------MA骨干
172.16.129.0/29
172.16.130.0/24 —r9环回
172.16.131.0/24 —r10环回
172.16.160.0/19 ------rip
172.16.160.0/20 —r12环回
172.16.176.0/20 —r12环回
配制公网IP
[R3]int s4/0/0
[R3-Serial4/0/0]ip add 34.0.0.1 24
[R4]int l0
[R4-LoopBack0]ip add 4.4.4.4 24
[R4-LoopBack0]int s3/0/0
[R4-Serial3/0/0]ip add 34.0.0.2 24
[R4-Serial3/0/0]int s4/0/0
[R4-Serial4/0/0]ip add 45.0.0.2 24
[R4-Serial4/0/0]int s4/0/1
[R4-Serial4/0/1]ip add 46.0.0.2 24
[R4-Serial4/0/1]int s3/0/1
[R4-Serial3/0/1]ip add 47.0.0.2 24
[R5]int s4/0/0
[R5-Serial4/0/0]ip add 45.0.0.1 24
[R6]int s4/0/0
[R6-Serial4/0/0]ip add 46.0.0.1 24
[R7]int s4/0/0
[R7-Serial4/0/0]ip add 47.0.0.1 24
测试
配置公网的路由
[R3]ip route-static 0.0.0.0 0 34.0.0.2
[R5]ip route-static 0.0.0.0 0 45.0.0.2
[R6]ip route-static 0.0.0.0 0 46.0.0.2
[R7]ip route-static 0.0.0.0 0 47.0.0.2
测试
构建MGRE网络
[R3]int t0/0/0
[R3-Tunnel0/0/0]ip add 172.16.1.1 29
[R3-Tunnel0/0/0]tunnel-protocol gre p2mp
[R3-Tunnel0/0/0]source 34.0.0.1
[R5]int t0/0/0
[R5-Tunnel0/0/0]ip add 172.16.1.2 29
[R5-Tunnel0/0/0]tunnel-protocol gre p2mp
[R5-Tunnel0/0/0]source Serial 4/0/0
[R5-Tunnel0/0/0]nhrp entry 172.16.1.1 34.0.0.1 register
[R6]int t0/0/0
[R6-Tunnel0/0/0]ip add 172.16.1.3 29
[R6-Tunnel0/0/0]tunnel-protocol gre p2mp
[R6-Tunnel0/0/0]source Serial 4/0/0
[R6-Tunnel0/0/0]nhrp entry 172.16.1.1 34.0.0.1 register
[R7]int t0/0/0
[R7-Tunnel0/0/0]ip add 172.16.1.4 29
[R7-Tunnel0/0/0]tunnel-protocol gre p2mp
[R7-Tunnel0/0/0]source Serial 4/0/0
[R7-Tunnel0/0/0]nhrp entry 172.16.1.1 34.0.0.1 register
查看R3中动态mp
测试连通性
开启R3的伪广播
[R3]int t0/0/0
[R3-Tunnel0/0/0]nhrp entry multicast dynamic
配置私有IP
Area1:
[R1]int l0
[R1-LoopBack0]ip add 172.16.34.1 24
[R1-LoopBack0]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 172.16.33.1 29
[R2]int l0
[R2-LoopBack0]ip add 172.16.35.1 24
[R2-LoopBack0]int g0/0/0
[R2-GigabitEthernet0/0/0]ip add 172.16.33.2 29
[R3]int l0
[R3-LoopBack0]ip add 172.16.36.1 24
[R3-LoopBack0]int g0/0/0
[R3-GigabitEthernet0/0/0]ip add 172.16.33.3 29
测试
Area0:
[R5]int l0
[R5-LoopBack0]ip add 172.16.2.1 24
[R6]int l0
[R6-LoopBack0]ip add 172.16.3.1 24
[R7]int l0
[R7-LoopBack0]ip add 172.16.4.1 24
Area2:
[R6]int g0/0/0
[R6-GigabitEthernet0/0/0]ip add 172.16.65.1 29
[R11]int l0
[R11-LoopBack0]ip add 172.16.66.1 24
[R11-LoopBack0]int g0/0/1
[R11-GigabitEthernet0/0/1]ip add 172.16.65.2 29
[R11-GigabitEthernet0/0/1]int g0/0/0
[R11-GigabitEthernet0/0/0]ip add 172.16.65.9 29
[R12]int g0/0/0
[R12-GigabitEthernet0/0/0]ip add 172.16.65.10 29
测试
Area3:
[R7]int g0/0/0
[R7-GigabitEthernet0/0/0]ip add 172.16.97.1 29
[R8]int l0
[R8-LoopBack0]ip add 172.16.98.1 24
[R8-LoopBack0]int g0/0/1
[R8-GigabitEthernet0/0/1]ip add 172.16.97.2 29
[R8-GigabitEthernet0/0/1]ip g0/0/0
[R8-GigabitEthernet0/0/0]ip add 172.16.97.9 29
[R9]int g0/0/1
[R9-GigabitEthernet0/0/1]ip add 172.16.97.10 29
测试
Area4:
[R9]int l0
[R9-LoopBack0]ip add 172.16.130.1 24
[R9-LoopBack0]int g0/0/0
[R9-GigabitEthernet0/0/0]ip add 172.16.129.1 29
[R10]int l0
[R10-LoopBack0]ip add 172.16.131.1 24
[R10-LoopBack0]int g0/0/0
[R10-GigabitEthernet0/0/0]ip add 172.16.129.2 29
测试
Rip:
[R12]int l0
[R12-LoopBack0]ip add 172.16.160.1 20
[R12-LoopBack0]int l1
[R12-LoopBack1]ip add 172.16.176.1 20
配置OSPF动态路由
[R1]ospf 1 router-id 1.1.1.1
[R1-ospf-1]area 1
[R1-ospf-1-area-0.0.0.1]network 172.16.34.1 0.0.0.0
[R1-ospf-1-area-0.0.0.1]network 172.16.33.1 0.0.0.0
[R2]ospf router-id 2.2.2.2
[R2-ospf-1]area 1
[R2-ospf-1-area-0.0.0.1]network 172.16.35.1 0.0.0.0
[R2-ospf-1-area-0.0.0.1]network 172.16.33.2 0.0.0.0
[R3]ospf router-id 3.3.3.3
[R3-ospf-1]area 1
[R3-ospf-1-area-0.0.0.1]network 172.16.36.1 0.0.0.0
[R3-ospf-1-area-0.0.0.1]network 172.16.33.3 0.0.0.0
[R3-ospf-1-area-0.0.0.1]q
[R3-ospf-1]area 0
[R3-ospf-1-area-0.0.0.0]network 172.16.1.1 0.0.0.0
[R5]ospf router-id 5.5.5.5
[R5-ospf-1]area 0
[R5-ospf-1-area-0.0.0.0]network 172.16.2.1 0.0.0.0
[R5-ospf-1-area-0.0.0.0]network 172.16.1.2 0.0.0.0
[R6]ospf 1 router-id 6.6.6.6
[R6-ospf-1]area 0
[R6-ospf-1-area-0.0.0.0]network 172.16.3.1 0.0.0.0
[R6-ospf-1-area-0.0.0.0]network 172.16.1.3 0.0.0.0
[R6-ospf-1-area-0.0.0.1]q
[R6-ospf-1]area 2
[R6-ospf-1-area-0.0.0.2]network 172.16.65.1 0.0.0.0
[R7]ospf 1 router-id 7.7.7.7
[R7-ospf-1]area 0
[R7-ospf-1-area-0.0.0.0]network 172.16.4.1 0.0.0.0
[R7-ospf-1-area-0.0.0.0]network 172.16.1.4 0.0.0.0
[R7-ospf-1-area-0.0.0.0]q
[R7-ospf-1]area 3
[R7-ospf-1-area-0.0.0.3]network 172.16.97.1 0.0.0.0
[R8]ospf 1 router-id 8.8.8.8
[R8-ospf-1]area 3
[R8-ospf-1-area-0.0.0.3]network 172.16.98.1 0.0.0.0
[R8-ospf-1-area-0.0.0.3]network 172.16.97.2 0.0.0.0
[R8-ospf-1-area-0.0.0.3]network 172.16.97.9 0.0.0.0
[R9]ospf 1 router-id 9.9.9.9
[R9-ospf-1]area 3
[R9-ospf-1-area-0.0.0.3]ne
[R9-ospf-1-area-0.0.0.3]network 172.16.97.10 0.0.0.0
[R9-ospf-1-area-0.0.0.3]q
[R9-ospf-1]area 4
[R9-ospf-1-area-0.0.0.4]network 172.16.130.1 0.0.0.0
[R9-ospf-1-area-0.0.0.4]network 172.16.129.1 0.0.0.0
[R10]ospf 1 router-id 10.10.10.10
[R10-ospf-1]area 4
[R10-ospf-1-area-0.0.0.4]ne
[R10-ospf-1-area-0.0.0.4]network 172.16.131.1 0.0.0.0
[R10-ospf-1-area-0.0.0.4]network 172.16.129.2 0.0.0.0
[R11]ospf 1 router-id 11.11.11.11
[R11-ospf-1]area 2
[R11-ospf-1-area-0.0.0.2]ne
[R11-ospf-1-area-0.0.0.2]network 172.16.66.1 0.0.0.0
[R11-ospf-1-area-0.0.0.2]network 172.16.65.2 0.0.0.0
[R11-ospf-1-area-0.0.0.2]network 172.16.65.9 0.0.0.0
[R12]ospf 1 router-id 12.12.12.12
[R12-ospf-1]area 2
[R12-ospf-1-area-0.0.0.2]network 172.16.65.10 0.0.0.0
[R12]rip 1
[R12-rip-1]vers 2
[R12-rip-1]network 172.16.0.0
检查邻接关系表
修改R3,R5,R6,R7MGRE接口类型为 broadcast ;并将R5,R6,R7隧道接口优先级改为0
[R3]int t0/0/0
[R3-Tunnel0/0/0]ospf network-type broadcast
[R5]int t0/0/0
[R5-Tunnel0/0/0]ospf network-type broadcast
[R5-Tunnel0/0/0]ospf dr-priority 0
[R6]int t0/0/0
[R6-Tunnel0/0/0]ospf network-type broadcast
[R6-Tunnel0/0/0]ospf dr-priority 0
[R7]int t0/0/0
[R7-Tunnel0/0/0]ospf network-type broadcast
[R7-Tunnel0/0/0]ospf dr-priority 0
此时查看R5路由表中没有area4和rip中的路由信息
使用重发布的方式导入rip路由和area4的路由信息
[R12]ospf 1
[R12-ospf-1]import-route rip
再次查看
查看R10路由
修改R9在area4上的进程为ospf2
[R9-ospf-1]area 4
[R9-ospf-1-area-0.0.0.4]undo network 172.16.129.1 0.0.0.0
[R9-ospf-1-area-0.0.0.4]undo network 172.16.130.1 0.0.0.0
[R9-ospf-1]q
[R9]ospf 2
[R9-ospf-2]area 4
[R9-ospf-2-area-0.0.0.4]network 172.16.129.1 0.0.0.0
[R9-ospf-2-area-0.0.0.4]network 172.16.130.1 0.0.0.0
此时在R9上对ospf进程1和进程2进行双向重发布
[R9]ospf 1
[R9-ospf-1]import-route ospf 2
[R9-ospf-1]q
[R9]ospf 2
[R9-ospf-2]import-route ospf 1
再次查看R10
测试ospf私网互通
私网上网
R1,R2缺省指向R3,R3上接口有nat
R8,R9,R10缺省指向R7,R7上接口有nat
R11,R12缺省指向R6,R6上接口有nat
减少LSA的更新量
将area1,2,3,4路由条目分别汇总给area0
[R3]ospf 1
[R3-ospf-1]area 1
[R3-ospf-1-area-0.0.0.1]ab
[R3-ospf-1-area-0.0.0.1]abr-summary 172.16.32.0 255.255.224.0
[R6]ospf 1
[R6-ospf-1]area 2
[R6-ospf-1-area-0.0.0.2]ab
[R6-ospf-1-area-0.0.0.2]abr-summary 172.16.64.0 255.255.224.0
[R7]ospf 1
[R7-ospf-1]area 3
[R7-ospf-1-area-0.0.0.3]ab
[R7-ospf-1-area-0.0.0.3]abr-summary 172.16.96.0 255.255.224.0
[R12]ospf 1
[R12-ospf-1]abr
[R12-ospf-1]a
[R12-ospf-1]as
[R12-ospf-1]asbr-summary 172.16.160.0 255.255.224.0
Area4:
[R9]ospf 1
[R9-ospf-1]asbr-summary 172.16.128.0 255.255.224.0
查看R5LSA数量
优化其他区域
Area1:调成完全末梢区域
[R1]ospf 1
[R1-ospf-1]area 1
[R1-ospf-1-area-0.0.0.1]stub
[R2]ospf 1
[R2-ospf-1]area 1
[R2-ospf-1-area-0.0.0.1]stub
[R3]ospf 1
[R3-ospf-1]area 1
[R3-ospf-1-area-0.0.0.1]stub no-summary
同时R1上也有缺省指向R3
Area2:调成完全NSSA
[R12]ospf 1
[R12-ospf-1]area 2
[R12-ospf-1-area-0.0.0.2]nssa
[R11]ospf 1
[R11-ospf-1]area 2
[R11-ospf-1-area-0.0.0.2]nssa
[R6]ospf 1
[R6-ospf-1]area 2
[R6-ospf-1-area-0.0.0.2]nssa no-summary
再次查看
同时R11上也有缺省指向R6
查看R5中路由条目已达最少
Area3:调成完全末梢区域
[R7]ospf 1
[R7-ospf-1]area 3
[R7-ospf-1-area-0.0.0.3]nssa no
[R7-ospf-1-area-0.0.0.3]nssa no-s
[R7-ospf-1-area-0.0.0.3]nssa no-summary
[R8]ospf 1
[R8-ospf-1]area 3
[R8-ospf-1-area-0.0.0.3]nssa
[R9]ospf 1
[R9-ospf-1]area 3
[R9-ospf-1-area-0.0.0.3]nssa
Area4:在R9上做的双向重发布修改为单向重发布
[R9]ospf 2
[R9-ospf-2]undo import-route ospf 1
R9给R10上缺省
[R9]ospf 2
[R9-ospf-2]de
[R9-ospf-2]default-
[R9-ospf-2]default-route-advertise
防止环路:
[R3]ip route-static 172.16.32.0 19 NULL 0
[R6]ip route-static 172.16.64.0 19 NULL 0
[R7]ip route-static 172.16.96.0 19 NULL 0
[R9]ip route-static 172.16.128.0 19 NULL 0
[R12]ip route-static 172.16.160.0 19 NULL 0
配置NET,使所有设备均可以访问R4的环回
[R3]acl 2000
[R3-acl-basic-2000]ru
[R3-acl-basic-2000]rule e
[R3-acl-basic-2000]rule p
[R3-acl-basic-2000]rule permit s
[R3-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[R3-acl-basic-2000]q
[R3]int s4/0/0
[R3-Serial4/0/0]nat o
[R3-Serial4/0/0]nat outbound 2000
[R6]acl 2000
[R6-acl-basic-2000]ru
[R6-acl-basic-2000]rule p
[R6-acl-basic-2000]rule permit s
[R6-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[R6-acl-basic-2000]q
[R6]int s4/0/0
[R6-Serial4/0/0]nat o
[R6-Serial4/0/0]nat outbound 2000
[R7]acl 2000
[R7-acl-basic-2000]ru
[R7-acl-basic-2000]rule p
[R7-acl-basic-2000]rule permit s
[R7-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[R7-acl-basic-2000]q
[R7]int s4/0/0
[R7-Serial4/0/0]nat o
[R7-Serial4/0/0]nat outbound 2000
所有设备均可以访问R4的环回