一、实验拓扑
二、实验需求
1、R4为ISP,其上只配置IP地址;R4与其他所直连设备间均使用公有IP;
3、整个OSPF环境IP基于172.16.0.0/16划分;除了R12有两个环回,其他路由器均有一个环回IP
5、减少LSA的更新量,减少路由表的路由条目,加快收敛,保障更新安全;
三、实验思路
1、根据实验要求对172.16.0.0/16网段进行子网划分,配置IP地址。
2、对R3,R5,R6,R7设备进行MGRE环境的配置,将R3设置为中心站点,在R3上创建中心站点域,R5、R6、R7加入中心站点域;并都配置指向ISP的缺省路由,实现对边界路由器的私网互通。
3、对各个路由器进行配置OSPF协议并进行宣告。
4、所有设备都可访问到R4(ISP),将域外路由通过重发布实现OSPF内互通;
5、对需要做特殊区域的区域做特殊区域的配置,对边界路由器配置NAT协议。
四、实验步骤
1、配置IP地址
[AR1]int g0/0/0
[AR1-GigabitEthernet0/0/0]ip add 172.16.32.1 19
[AR1-GigabitEthernet0/0/0]int l0
[AR1-LoopBack0]ip add 172.16.34.1 24[AR2]int g0/0/0
[AR2-GigabitEthernet0/0/0]ip add 172.16.32.2 19
[AR2-GigabitEthernet0/0/0]int l0
[AR2-LoopBack0]ip add 172.16.35.2 24[AR3]int g0/0/0
[AR3-GigabitEthernet0/0/0]ip add 172.16.32.3 19
[AR3-GigabitEthernet0/0/0]int l0
[AR3-LoopBack0]ip add 172.16.36.3 24
[AR3-LoopBack0]int s4/0/0
[AR3-Serial4/0/0]ip add 34.0.0.3 24[AR4]int s4/0/0
[AR4-Serial4/0/0]ip add 34.0.0.4 24
[AR4-Serial4/0/0]int s4/0/1
[AR4-Serial4/0/1]ip add 45.0.0.4 24
[AR4-Serial4/0/1]int s3/0/0
[AR4-Serial3/0/0]ip add 46.0.0.4 24
[AR4-Serial3/0/0]int g0/0/0
[AR4-GigabitEthernet0/0/0]ip add 47.0.0.4 24
[AR4-GigabitEthernet0/0/0]int l0
[AR4-LoopBack0]ip add 172.16.2.4 24[AR5]int s4/0/0
[AR5-Serial4/0/0]ip add 45.0.0.5 24
[AR5-Serial4/0/0]int l0
[AR5-LoopBack0]ip add 172.16.3.5 24[AR6]int s4/0/0
[AR6-Serial4/0/0]ip add 46.0.0.6 24
[AR6-Serial4/0/0]int g0/0/0
[AR6-GigabitEthernet0/0/0]ip add 172.16.65.1 30
[AR6-GigabitEthernet0/0/0]int l0
[AR6-LoopBack0]ip add 172.16.4.6 24[AR7]int g0/0/0
[AR7-GigabitEthernet0/0/0]ip add 47.0.0.7 24
[AR7-GigabitEthernet0/0/0]int g0/0/1
[AR7-GigabitEthernet0/0/1]ip add 172.16.97.1 30
[AR7-GigabitEthernet0/0/1]int l0
[AR7-LoopBack0]ip add 172.16.5.7 24[AR8]int g0/0/0
[AR8-GigabitEthernet0/0/0]ip add 172.16.97.2 30
[AR8-GigabitEthernet0/0/0]int g0/0/01
[AR8-GigabitEthernet0/0/1]ip add 172.16.97.5 30
[AR8-GigabitEthernet0/0/1]int l0
[AR8-LoopBack0]ip add 172.16.98.8 24[AR9]int g0/0/0
[AR9-GigabitEthernet0/0/0]ip add 172.16.97.6 30
[AR9-GigabitEthernet0/0/0]int g0/0/1
[AR9-GigabitEthernet0/0/1]ip add 172.16.129.1 30
[AR9-GigabitEthernet0/0/1]int l0
[AR9-LoopBack0]ip add 172.16.130.9 24[AR10]int g0/0/0
[AR10-GigabitEthernet0/0/0]ip add 172.16.129.2 30
[AR10-GigabitEthernet0/0/0]int lo0
[AR10-LoopBack0]ip add 172.16.131.10 24[AR11-GigabitEthernet0/0/0]ip add 172.16.65.2 30
[AR11-GigabitEthernet0/0/0]int g0/0/1
[AR11-GigabitEthernet0/0/1]ip add 172.16.65.5 30
[AR11-GigabitEthernet0/0/1]int l0
[AR11-LoopBack0]ip add 172.16.66.11 24[AR12]int g0/0/0
[AR12-GigabitEthernet0/0/0]ip add 172.16.65.6 30
[AR12-GigabitEthernet0/0/0]int l0
[AR12-LoopBack0]ip add 172.16.160.12 24
[AR12-LoopBack0]int lo1
[AR12-LoopBack1]ip add 172.16.161.12 24
2、R3-R5、R6、R7为MGRE环境,R3为中心站点;
(1)配置到达ISP的缺省路由
[AR3]ip route-static 0.0.0.0 0 34.0.0.4
[AR5]ip route-static 0.0.0.0 0 45.0.0.4
[AR6]ip route-static 0.0.0.0 0 46.0.0.4
[AR7]ip route-static 0.0.0.0 0 47.0.0.4
(2)配置MGRE环境
# 中心站点R3
[AR3]int t0/0/0
[AR3-Tunnel0/0/0]ip add 172.16.6.1 24
[AR3-Tunnel0/0/0]tunnel-protocol gre p2mp
[AR3-Tunnel0/0/0]source 34.0.0.3
[AR3-Tunnel0/0/0]nhrp network-id 100
[AR3-Tunnel0/0/0]nhrp entry multicast dynamic
# 分站点
[AR5]int t0/0/0
[AR5-Tunnel0/0/0]ip add 172.16.6.2 24
[AR5-Tunnel0/0/0]tunnel-protocol gre p2mp
[AR5-Tunnel0/0/0]source s4/0/0
[AR5-Tunnel0/0/0]nhrp network-id 100
[AR5-Tunnel0/0/0]nhrp entry 172.16.6.1 34.0.0.3 register [AR6]int t0/0/0
[AR6-Tunnel0/0/0]ip add 172.16.6.3 24
[AR6-Tunnel0/0/0]tunnel-protocol gre p2mp
[AR6-Tunnel0/0/0]source s4/0/0
[AR6-Tunnel0/0/0]nhrp network-id 100
[AR6-Tunnel0/0/0]nhrp entry 172.16.6.1 34.0.0.3 register [AR7]int t0/0/0
[AR7-Tunnel0/0/0]ip add 172.16.6.4 24
[AR7-Tunnel0/0/0]tunnel-protocol gre p2mp
[AR7-Tunnel0/0/0]source g0/0/0
[AR7-Tunnel0/0/0]nhrp network-id 100
[AR7-Tunnel0/0/0]nhrp entry 172.16.6.1 34.0.0.3 register
查看是否配置成功
3、配置OSPF环境
(1)宣告网段
除了AR4,其他设备都要在对应区域中宣告网段
……
……
[AR12]rip 1
[AR12-rip-1]v 2
[AR12-rip-1]network 172.16.0.0
(2)修改MGRE类型为P2MP类型来与其他路由建立邻居关系
[AR3]int t0/0/0
[AR3-Tunnel0/0/0]ospf network-type p2mp[AR5-Tunnel0/0/0]ospf network-type p2mp[AR6-Tunnel0/0/0]ospf network-type p2mp[AR7-Tunnel0/0/0]ospf network-type p2mp
4、所有设备均可访问R4的环回;
重发布导入area 4 的路由和rip路由
[AR9-ospf-2]import-route ospf 1
[AR9-ospf-1]import-route ospf 2
[AR12-ospf-1]import-route rip 1
[AR12-ospf-1]rip 1
[AR12-rip-1]import-route ospf 1
配置NAT,做公私网转换
[AR3]acl 2000
[AR3-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[AR3-acl-basic-2000]q
[AR3]int s4/0/0
[AR3-Serial4/0/0]nat outbound 2000[AR7]acl 2000
[AR7-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[AR7-acl-basic-2000]q
[AR7]int g0/0/0
[AR7-GigabitEthernet0/0/0]nat outbound 2000[AR6]acl 2000
[AR6-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[AR6-acl-basic-2000]q
[AR6]int s4/0/0
[AR6-Serial4/0/0]nat outbound 2000
5、减少LSA的更新量,减少路由表的路由条目,加快收敛,保障更新安全;
为减少LSA更新量,需要做汇总和特殊区域
为避免环路,配置空接口路由
[AR3]ospf 1
[AR3-ospf-1]area 1
[AR3-ospf-1-area-0.0.0.1]abr-summary 172.16.32.0 255.255.224.0
[AR3]ip route-static 172.16.32.0 19 null 0[AR6]ospf 1
[AR6-ospf-1]area 2
[AR6-ospf-1-area-0.0.0.2]abr-summary 172.16.64.0 255.255.224.0
[AR6]ip route-static 172.16.64.0 19 null 0[AR7]ospf 1
[AR7-ospf-1]area 3
[AR7-ospf-1-area-0.0.0.3]abr-summary 172.16.96.0 255.255.224.0
[AR7]ip route-static 172.16.96.0 19 null 0[AR9]ospf 1
[AR9-ospf-1]area 4
[AR9-ospf-1-area-0.0.0.4]abr-summary 172.16.128.0 255.255.224.0
[AR9-ospf-1-area-0.0.0.4]q
[AR9]ip route-static 172.16.128.0 19 null 0 [AR12]ospf 1
[AR12-ospf-1]area 2
[AR12-ospf-1-area-0.0.0.2]abr-summary 172.16.64.0 255.255.224.0
[AR12]ip route-static 172.16.64.0 19 null 0
特殊区域
[AR1]ospf 1
[AR1-ospf-1]area 1
[AR1-ospf-1-area-0.0.0.1]stub[AR2]ospf 1
[AR2-ospf-1]area 1
[AR2-ospf-1-area-0.0.0.1]stub# 只有ABR,没有ASBR,搭建完全末梢
[AR3]ospf 1
[AR3-ospf-1]area 1
[AR3-ospf-1-area-0.0.0.1]stub no-summary
# 区域2,区域3中存在ASBR,可搭建非完全末梢区域
[AR6]ospf 1
[AR6-ospf-1]area 2
[AR6-ospf-1-area-0.0.0.2]nssa no-summary
[AR11]ospf 1
[AR11-ospf-1]area 2
[AR11-ospf-1-area-0.0.0.2]nssa
[AR12]ospf 1
[AR12-ospf-1]area 2
[AR12-ospf-1-area-0.0.0.2]nssa
[AR7]ospf 1
[AR7-ospf-1]area 3
[AR7-ospf-1-area-0.0.0.3]nssa no-import-route
[AR8]ospf 1
[AR8-ospf-1]area 3
[AR8-ospf-1-area-0.0.0.3]nssa
[AR9]ospf 1
[AR9-ospf-1]area 3
[AR9-ospf-1-area-0.0.0.3]nssa
加快收敛
[AR3]int t0/0/0
[AR3-Tunnel0/0/0]ospf timer hello 5
[AR5]int t0/0/0
[AR5-Tunnel0/0/0]ospf timer hello 5
[AR6]int t0/0/0
[AR6-Tunnel0/0/0]ospf timer hello 5
[AR7]int t0/0/0
[AR7-Tunnel0/0/0]ospf timer hello 5
6、全网可达;