- 实验拓扑

- 实验要求
1、R4为ISP,其上只配置IP地址;R4与其他所直连设备间均使用公有IP;
2、R3-R5、R6、R7为MGRE环境,R3为中心站点;
3、整个OSPF环境IP基于172.16.0.0/16划分;除了R12有两个环回,其他路由器均有一个环回IP
4、所有设备均可访问R4的环回;
5、减少LSA的更新量,加快收敛,保障更新安全;
6、全网可达;
三、实验思路
1、划分网段地址(子网划分)并配置接口IP地址
2、设置公网流量全网通,和私网网段在ospf动态路由下全网通
3、R3-R5、R6、R7为MGRE环境,R3为中心站点;分别给R3、R5、R6、R7构建隧道接口,接口封装协议为MGRE
4、再将隧道网段以ospf动态路由宣告
5、解决ospf下的MGRE的问题,在中心站点R3开启伪广播
6、解决ospf下的MGRE的DR与BDR选举混乱的情况
7、减少LSA的更新量,减少骨干区域和非骨干区域LSA条目
8、加快收敛,修改ospf的hello时间
8、保障更新安全,做区域间认证或接口间认证
9、所有设备均可访问R4的环回;使用NAT技术
四、实验步骤
1、IP地址规划将172.16.0.0/16为大网段划分
首先在划分之前我们需要先分析整个组网中用到了几个路由协议,在这份拓扑中一共有两大动态路由协议分别是ospf和rip所以要先将大网段一分为2,但rip中的网段很少可以不用给rip单独分大网段,
其次在ospf中拥有明显的区域,所以我们可以按区域划分,但如果给一个区域划分的网段过大会造成路由风暴的问题,一般一个区域网段的可用IP为200---300之间,所以我们可以先将掩码16网段的大网直接划分为掩码24的网段
172.16.0.0/24 area 0
172.16.0.0/25 R4回环
172.16.128/25 R5回环
172.16.1.0/24 area 1
172.16.1.0 /29 骨干链路
172.16.1.64/26 R1回环
172.16.1.128/26 R2回环
172.16.1.192/26 R3回环
172.16.2.0/24 area 2
172.16.2.0/30 链路网段
172.16.2.4/30 链路网段
172.16.2.64/26 回环网段
172.16.2.128/26 回环网段
172.16.3.0/24 area 3
172.16.3.0/30 链路网段
172.16.3.4/30 链路网段
172.16.3.64/26 回环网段
172.16.3.128/26 回环网段
172.16.3.192/26
172.16.4.0/24 area 4
172.16.4.0/26 链路网段
172.16.4.0/30 链路网段
172.16.4.64/26 回环网段
172.16.4.128/26 回环网段
172.16.5.0/24 rip
172.16.6.0/24 隧道网段
地址划分完成后配置IP地址
2 、配置静态缺省路由使得公网通
r3ip route-static 0.0.0.0 0 34.0.0.2
r5ip route-static 0.0.0.0 0 45.0.0.2
r6ip route-static 0.0.0.0 0 46.0.0.2
r7ip route-static 0.0.0.0 0 47.0.0.2
测试公网是否全通

3 **、**私网网段在ospf动态路由下全网通
Area 1
R1:
ospf 1 router-id 1.1.1.1
area 0.0.0.1
network 172.16.1.1 0.0.0.0
network 172.16.1.65 0.0.0.0
R2:
ospf 1 router-id 2.2.2.2
area 0.0.0.1
network 172.16.1.2 0.0.0.0
network 172.16.1.129 0.0.0.0
R3:
ospf 1 router-id 3.3.3.3
area 0.0.0.0
network 172.16.6.1 0.0.0.0
area 0.0.0.1
network 172.16.1.3 0.0.0.0
network 172.16.1.193 0.0.0.0
R5:
ospf 1 router-id 5.5.5.5
area 0.0.0.0
network 172.16.0.65 0.0.0.0
network 172.16.6.2 0.0.0.0
R6:
ospf 1 router-id 6.6.6.6
area 0.0.0.0
network 172.16.0.129 0.0.0.0
network 172.16.6.3 0.0.0.0
area 0.0.0.2
network 172.16.2.1 0.0.0.0
R7:
ospf 1 router-id 7.7.7.7
area 0.0.0.0
network 172.16.0.193 0.0.0.0
network 172.16.6.4 0.0.0.0
area 0.0.0.3
network 172.16.3.1 0.0.0.0
R8:
ospf 1 router-id 8.8.8.8
area 0.0.0.3
network 172.16.3.2 0.0.0.0
network 172.16.3.5 0.0.0.0
network 172.16.3.129 0.0.0.0
R9:
ospf 1 router-id 9.9.9.9
area 0.0.0.3
network 172.16.3.6 0.0.0.0
ospf 2 router-id 9.9.9.9
area 0.0.0.4
network 172.16.4.1 0.0.0.0
network 172.16.4.65 0.0.0.0
R10:
area 0.0.0.4
network 172.16.4.2 0.0.0.0
network 172.16.4.129 0.0.0.0
R11:
ospf 1 router-id 11.11.11.11
area 0.0.0.2
network 172.16.2.2 0.0.0.0
network 172.16.2.5 0.0.0.0
network 172.16.2.129 0.0.0.0
R12:
ospf 1 router-id 12.12.12.12
area 0.0.0.2
network 172.16.2.6 0.0.0.0
rip 1
version 2
network 172.16.0.0
4、建立隧道,
R3作为中心站点
interface Tunnel0/0/0
ip address 172.16.6.1 255.255.255.0
tunnel-protocol gre p2mp //封装隧道协议
source 34.0.0.1 //封装原工网IP地址
ospf network-type broadcast //修改接口网络类型
nhrp network-id 100 //总部创建组
nhrp entry multicast dynamic //开启伪广播
R5分支站点
interface Tunnel0/0/0
ip address 172.16.6.2 255.255.255.0
tunnel-protocol gre p2mp //封装隧道协议
source Serial4/0/0 //封装原隧道公网IP地址(不固定)
ospf network-type broadcast //修改接口网络类型
ospf dr-priority 0 //让分支放弃参选DR与BDR
nhrp network-id 100 //分部需要加入总部创建的组中
nhrp entry 172.16.6.1 34.0.0.1 register //分支站点需要向中心站点注册信息
R6分支站点
interface Tunnel0/0/0
ip address 172.16.6.3 255.255.255.0
tunnel-protocol gre p2mp //封装隧道协议
source Serial4/0/0 //封装原隧道公网IP地址(不固定)
ospf network-type broadcast //修改接口网络类型
ospf dr-priority 0 //让分支放弃参选DR与BDR
nhrp network-id 100 //分部需要加入总部创建的组中
nhrp entry 172.16.6.1 34.0.0.1 register //分支站点需要向中心站点注册信息
R7分支站点
interface Tunnel0/0/0
ip address 172.16.6.4 255.255.255.0
tunnel-protocol gre p2mp //封装隧道协议
source GigabitEthernet0/0/0 //封装原隧道公网IP地址(不固定)
ospf network-type broadcast //修改接口网络类型
ospf dr-priority 0 //让分支放弃参选DR与BDR
nhrp network-id 100 //分部需要加入总部创建的组中
nhrp entry 172.16.6.1 34.0.0.1 register //分支站点需要向中心站点注册信息
OSPF下搭建MGRE环境的问题
- 因为MGRE环境下的接口类型为默认p2p只能进行1对1建邻,所以更改接口网络类型为以太网broadcast
- 虽然接口类型改为了MA网络的,但工作方式还是会以P2P网络搭建,所以汇总成总部预分支DR与BDR选举混乱,故要更改分支,让分支放弃参选DR与BDR
5、路由引入(重发布)
将外部路由引入
R9:
r9ospf 1
r9-ospf-1import-route ospf 2
r9-ospf-1q
r9ospf 2
r9-ospf-2import-route ospf 1
R12:
r12ospf 1
r12-ospf-1import-route rip
目前为止整张实验拓扑因该达到全网通
测试:在R1上pingR10

在R1上pingRIP网段

6、减少LSA的更新量
1)减少骨干区域LSA条目:链路聚合、手工汇总、空接口(防止路由黑洞造成环路)
2)减少非骨干区域LSA条目:特殊区域、完全末梢区域和完全非完全末梢区域(stub和nssa)
域内路由汇总:手工汇总、空接口
R3:
r3ospf 1
r3-ospf-1area 1
r3-ospf-1-area-0.0.0.1abr-summary 172.16.1.0 255.255.255.0
r3ip route-static 172.16.1.0 24 NULL 0 //空接口
R6:
r6ospf 1
r6-ospf-1area 2
r6-ospf-1-area-0.0.0.2 abr-summary 172.16.2.0 255.255.255.0
r6ip route-static 172.16.2.0 24 NULL 0 //空接口
R7:
r7ospf 1
r7-ospf-1ar 3
r7-ospf-1-area-0.0.0.3abr-summary 172.16.3.0 255.255.255.0
r7ip route-static 172.16.3.0 24 NULL 0 //空接口
域外路由汇总:手工汇总、空接口
R9:
r9ospf 1
r9-ospf-1asbr-summary 172.16.4.0 255.255.255.0
r9ip route-static 172.16.4.0 24 NULL 0 //空接口
R12:
r12ospf 1
r12-ospf-1asbr-summary 172.16.5.0 255.255.255.0
r12ip route-static 172.16.5.0 24 NULL 0 //空接口
特殊区域:
area 1可设置成完全末梢区域
R1:
r1ospf 1
r1-ospf-1area 1
r1-ospf-1-area-0.0.0.1stub no-summary
R2:
r2ospf 1
r2-ospf-1area 1
r2-ospf-1-area-0.0.0.1stub no-summary
R3
r3ospf 1
r3-ospf-1area 1
r3-ospf-1-area-0.0.0.1stub no-summary
area 2可设置成完全非完全末梢区域(完全NSSA)
R6:
r6ospf 1
r6-ospf-1area 2
r6-ospf-1-area-0.0.0.2nssa no-summary
R11:
r11ospf 1
r11-ospf-1area 2
r11-ospf-1-area-0.0.0.2nssa no-summary
R12:
r12ospf 1
r12-ospf-1area 2
r12-ospf-1-area-0.0.0.2nssa no-summary
area 3可设置成完全非完全末梢区域(完全NSSA)
R7:
r7ospf 1
r7-ospf-1area 3
r7-ospf-1-area-0.0.0.3nssa no-summary
R8:
r8ospf 1
r8-ospf-1area 3
r8-ospf-1-area-0.0.0.3nssa no-summary
R9:
r9ospf 1
r9-ospf-1area 3
r9-ospf-1-area-0.0.0.3nssa no-summary
r9ospf 2
r9-ospf-2default-route-advertise //向域外路由下发缺省
此时让我们看看LSA是否被优化
优化前路由信息及LSDB表

优化后路由信息及LSDB表

可以明显的观察到路由条目的减少
7、加快收敛,修改ospf的hello时间
R1:
r1interface g0/0/0
r1-GigabitEthernet0/0/0ospf timer hello 5
R2:
r2interface g0/0/0
r2-GigabitEthernet0/0/0ospf timer hello 5
R3:
r3interface g0/0/0
r3-GigabitEthernet0/0/0ospf timer hello 5
R6:
r6interface g0/0/0
r6-GigabitEthernet0/0/0ospf timer hello 5
R11:
r11interface g0/0/0
r11-GigabitEthernet0/0/0ospf timer hello 5
r11interface g0/0/1
r11-GigabitEthernet0/0/1ospf timer hello 5
R12:
r12interface g0/0/0
r12-GigabitEthernet0/0/0ospf timer hello 5
R7:
r7interface g0/0/1
r7-GigabitEthernet0/0/1ospf timer hello 5
R8:
r8interface g0/0/0
r8-GigabitEthernet0/0/0ospf timer hello 5
r8interface g0/0/1
r8-GigabitEthernet0/0/1ospf timer hello 5
R9:
r9interface g0/0/0
r9-GigabitEthernet0/0/0ospf timer hello 5
r9interface g0/01
r9-GigabitEthernet0/0/1ospf timer hello 5
R10:
r10interface g0/0/0
r10-GigabitEthernet0/0/0ospf timer hello 5
8、保障更新安全,做区域间认证
9、所有设备均可访问R4的环回;使用NAT技术
R3:
r3acl 2000
r3-acl-basic-2000rule permit source 172.16.1.0 0.0.0.255
r3interface Serial 4/0/0
r3-Serial4/0/0nat outbound 2000
R5:
r5acl 2000
r5-acl-basic-2000rule permit source 172.16.0.0 0.0.0.255
r5interface Serial 4/0/1
r5-Serial4/0/0nat outbound 2000
R6:
r6acl 2000
r6acl-basic-2000rule permit source 172.16.20 0.0.0.255
[r6interface Serial 4/0/0
r6Serial4/0/0nat outbound 2000
R7
[r7acl 2000
r7acl-basic-2000rule permit source 172.16.1.0 0.0.0.255
[r7interface g 0/0/0
r7 GigabitEthernet0/0/0nat outbound 2000
9、最后我们测试一下全网效果

