1,R4为ISP,其上只能配置IP地址;R4与其他所有直连设备间匀使用公有IP
2,R3-R5/6/7为MGRE环境,R3为中心站点
3,整个osPF环境1P基于172.16.0.0/16划分,所有设备且设备环回地址均可访问R4的环回;
4,减少LSA的更新量,加快收敛,保障更新安全;全网可达
对整个拓扑进行IP地址划分,先将区域划为OSPF和RIP区域2个区域,主机位饥借1位,掩码加1。
172.16.0.0 16 →172.16.0.0 17 和 172.16.128.0 17
172.16.0.0 17 用于OSPF区域,172.16.128.0 17用于RIP
由于OSPF区域由5部分组成,将172.16.0.0 17 进行子网划分。2的3次172方大于5,主机位借3位,掩码加3。
172.16.0.0 20——用于AREA 0
172.16.16.0 20——用于AREA 1
172.16.32.0 20——用于AREA 2
172.16.48.0 20——用于AREA 3
172.16.64.0 20——用于AREA 4
172.16.80.0 20——预留
172.16.96.0 20——预留
172.16.112.0 20——预留
一:对整个路由器接口IP地址进行配置
R1
R2
R3
R4
R5
R6
R7
R8
R9
R10
R11
R12
二:先对A 0起MGRE环境
R3-R5/6/7为MGRE环境,R3为中心站点。起MGRE环境前,保证A 0区域全网PING通
R3,R5,R6,R7使用默认缺省路由指向R4
[R3]ip route-static 0.0.0.0 0 34.0.0.4
[R5]IP route-static 0.0.0.0 0 45.0.0.4
[R6]ip route-static 0.0.0.0 0 46.0.0.4
[R7]ip route-static 0.0.0.0 0 47.0.0.4
R3
[R3]int t 0/0/0
[R3-Tunnel0/0/0]ip add 172.16.0.1 24
[R3-Tunnel0/0/0]tunnel-protocol gre p2mp
[R3-Tunnel0/0/0]source 34.0.0.3
[R3-Tunnel0/0/0]nhrp entry multicast dynamic
R4充当ISP不进行IP地址配置
R5
[R5]INT T 0/0/0
[R5-Tunnel0/0/0]ip add 172.16.0.2 24
[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.0.1 34.0.0.3 register
R6
[R6]int t 0/0/0
[R6-Tunnel0/0/0]ip add 172.16.0.3 24
[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.0.1 34.0.0.3 register
R7
[R7]int t 0/0/0
[R7-Tunnel0/0/0]ip add 172.16.0.4 24
[R7-Tunnel0/0/0]tunnel-protocol gre p2mp
[R7-Tunnel0/0/0]source GigabitEthernet 0/0/0
[R7-Tunnel0/0/0]nhrp entry 172.16.0.1 34.0.0.3 register
使用R3进行栈道模拟测试
MGRE环境搭建成功
三:对所以OSPF区域启动OSPF
R3
[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]a 0
[R3-ospf-1-area-0.0.0.0]network 172.16.0.1 0.0.0.0
R5
[R5]ospf 1 router-id 5.5.5.5
[R5-ospf-1]a 0
[R5-ospf-1-area-0.0.0.0]network 172.16.0.0 0.0.255.255
R6
[R6]ospf 1 router-id 6.6.6.6
[R6-ospf-1]a 0
[R6-ospf-1-area-0.0.0.0]network 172.16.0.3 0.0.0.0
[R6-ospf-1-area-0.0.0.0]network 172.16.2.1 0.0.0.0
R7
[R6]ospf 1 router-id 7.7.7.7
[R6-ospf-1]a 0
[R6-ospf-1-area-0.0.0.0]network 172.16.0.0 0.15.255.255
OSPF启动后,将R3,R5,R6,R7更改接口类型P2MP
当接口类型修改为P2MP后,不用进行主客选举
[R3]int t 0/0/0
[R3-Tunnel0/0/0]ospf network-type p2mp
[R5]int t 0/0/0
[R5-Tunnel0/0/0]ospf network-type p2mp
[R6]int t 0/0/0
[R6-Tunnel0/0/0]ospf network-type p2mp
[R7]int t 0/0/0
[R7-Tunnel0/0/0]ospf network-type p2mp
A 1(区域一)
R1
[R1]ospf 1 router-id 1.1.1.1
[R1-ospf-1]a 1
[R1-ospf-1-area-0.0.0.1]network 0.0.0.0 255.255.255.255
R2
[R2]ospf 1 rou
[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]a 1
[R2-ospf-1-area-0.0.0.1]netw
[R2-ospf-1-area-0.0.0.1]network 0.0.0.0 255.255.255.255
R3
[R3]ospf 1
[R3-ospf-1]a 1
[R3-ospf-1-area-0.0.0.1]netw
[R3-ospf-1-area-0.0.0.1]network 172.16.16.0 0.15.255.255
[R3-ospf-1-area-0.0.0.1]
A 2(区域二)
R6
[R6]ospf 1 router-id 6.6.6.6
[R6-ospf-1]a 2
[R6-ospf-1-area-0.0.0.2]netw
[R6-ospf-1-area-0.0.0.2]network 172.16.33.1 0.0.0.0
[R6-ospf-1-area-0.0.0.2]
R11
[R11]ospf 1 router-id 11.11.11.11
[R11-ospf-1]a 2
[R11-ospf-1-area-0.0.0.2]network 0.0.0.0 255.255.255.255
R12
[R12]ospf 1 rou
[R12]ospf 1 router-id 12.12.12.12
[R12-ospf-1]a 2
[R12-ospf-1-area-0.0.0.2]netw
[R12-ospf-1-area-0.0.0.2]network 172.16.33.6 0.0.0.0
[R12-ospf-1-area-0.0.0.2]
R12使用RIP启动172.16.128.0.0 网段
[R12]rip 1
[R12-rip-1]ver 2
[R12-rip-1]network 172.16.0.0
A 3(区域三)
R7
[R7]ospf 1 router-id 7.7.7.7
[R7-ospf-1]a 3
[R7-ospf-1-area-0.0.0.3]network 172.16.49.1 0.0.0.0
R8
[R8]ospf 1 router-id 8.8.8.8
[R8-ospf-1]a 3
[R8-ospf-1-area-0.0.0.3]network 0.0.0.0 255.255.255.255
R9
[R9]ospf 1 router-id 9.9.9.9
[R9-ospf-1]a 3
[R9-ospf-1-area-0.0.0.3]network 172.16.49.6 0.0.0.0
A 4(区域四)
R9
[R9]ospf 2 router-id 9.9.9.9
[R9-ospf-2]a 4
[R9-ospf-2-area-0.0.0.4]network 172.16.64.0 0.15.255.255
R10
[R10]ospf 1 router-id 10.10.10.10
[R10-ospf-1]a 4
[R10-ospf-1-area-0.0.0.4]network 0.0.0.0 255.255.255.255
四:将路由器的所有用户环回改为broadcast类型
[R1]int l 0
[R1-LoopBack0]ospf network-type broadcast
[R2]int l 0
[R2-LoopBack0]ospf network-type broadcast
[R3]int l 0
[R3-LoopBack0]ospf network-type broadcast
[R5]int l 0
[R5-LoopBack0]ospf network-type broadcast
[R6]int l 0
[R6-LoopBack0]ospf network-type broadcast
[R7]int l 0
[R7-LoopBack0]ospf network-type broadcast
[R8]int l 0
[R8-LoopBack0]ospf network-type broadcast
[R9]int l 0
[R9-LoopBack0]ospf network-type broadcast
[R10]int l 0
[R10-LoopBack0]ospf network-type broadcast
[R11]int l 0
[R11-LoopBack0]ospf network-type broadcast
[R12]int l 0
[R12-LoopBack0]ospf network-type broadcast
[R12-LoopBack0]int l 1
[R12-LoopBack1]ospf network-type broadcast
五:R12和R9进行重发布
R12
[R12]ospf 1
[R12-ospf-1]import-route rip 1
R9
[R9]ospf 1
[R9-ospf-1]import-route ospf 2
[R9-ospf-1]ospf 2
[R9-ospf-2]import-route ospf 1
到此全网OSPF启动成功
使用R5进行测试
全网路由可达,R4除外
六:对整个网路进行优化
A 1在R3上进行区域汇总
[R3]ospf 1
[R3-ospf-1]a 1
[R3-ospf-1-area-0.0.0.1]abr-summary 172.16.16.0 255.255.240.0
A 2在R6上进行区域汇总
[R6]ospf 1
[R6-ospf-1]a 2
[R6-ospf-1-area-0.0.0.2]abr-summary 172.16.32.0 255.255.240.0
A 3在R7上进行区域汇总
[R7]ospf 1
[R7-ospf-1]a 3
[R7-ospf-1-area-0.0.0.3]abr-summary 172.16.48.0 255.255.240.0
A 4在R9上进行汇总
[R9]ospf 1
[R9-ospf-1]asbr-summary 172.16.64.0 255.255.240.0
R12对RIP网段进行区域汇总
[R12]ospf 1
[R12-ospf-1]asbr-summary 172.16.128.0 255.255.128.0
将A 1(区域一)路由OSPF 1 改为stub
[R1]ospf 1
[R1-ospf-1]a 1
[R1-ospf-1-area-0.0.0.1]stub
[R2]ospf 1
[R2-ospf-1]a 1
[R2-ospf-1-area-0.0.0.1]stub
[R3]ospf 1
[R3-ospf-1]a 1
[R3-ospf-1-area-0.0.0.1]stub no-summary
将A 2(区域二)路由OSPF 1 改为nssa
[R6]ospf 1
[R6-ospf-1]a 2
[R6-ospf-1-area-0.0.0.2]nssa no-summary
[R11]ospf 1
[R11-ospf-1]a 2
[R11-ospf-1-area-0.0.0.2]nssa
[R12]ospf 1
[R12-ospf-1]a 2
[R12-ospf-1-area-0.0.0.2]nssa
将A 3(区域三)路由OSPF 1 改为nssa
[R7]ospf 1
[R7-ospf-1]a 3
[R7-ospf-1-area-0.0.0.3]nssa no-summary
[R8]ospf 1
[R8-ospf-1]a 3
[R8-ospf-1-area-0.0.0.3]nssa
[R9]ospf 1
[R9-ospf-1]a 3
[R9-ospf-1-area-0.0.0.3]nssa
[R9]ospf 2
[R9-ospf-2]default-route-advertise
七:做端口映射
R3
[R3]acl number 2000
[R3-acl-basic-2000]rule 5 permit source 172.16.16.0 0.0.15.255
[R3]int s4/0/0
[R3-Serial4/0/0]nat outbound 2000
[R6]acl number 2000
[R6-acl-basic-2000]rule 15 permit source 172.16.128.0 0.0.64.255
[R6-acl-basic-2000]rule 5 permit source 172.16.32.0 0.0.15.255
[R6]int s4/0/0
[R6-Serial4/0/0]nat outbound 2000
[R7]acl number 2000
[R7-acl-basic-2000]rule 5 permit source 172.16.48.0 0.0.15.255
[R7-acl-basic-2000]rule 15 permit source 172.16.64.0 0.0.15.255
[R7-GigabitEthernet0/0/0]nat outbound 2000
成功访问R4