OSPF 在不同接口网络类型(集线器和辐条与全网状)下的综合实验
1、拓扑信息
2、需求分析
3、IP规划
4、配置
5、测试
1、拓扑信息
2、需求分析
- R6为ISP只能配置IP地址,R1-R5的环回为私有网段
- R1/4/5为全连的MGRE结构
- R1/2/3为星型的拓扑结构,R1为中心站点
- 所有私有网段可以互相通讯,私有网段使用OSPF协议完成
3、IP规划
主要按路由名称命名网段,方便记忆
公网网段:
16.1.1.0/24 R1-R6
16.1.2.0/24 R1-R6
26.1.1.0/24 R2-R6
36.1.1.0/24 R3-R6
46.1.1.0/24 R4-R6
56.1.1.0/24 R5-R6
私网网段:
192.168.1.0/24 R1环回(因为要构建两个MGRE环境)
192.168.1.0/25 R1环回(全连接)
192.168.1.128/25 R1环回(中心站点)
192.168.2.0/24 R2环回
192.168.3.0/24 R3环回
192.168.4.0/24 R4环回
192.168.5.0/24 R5环回
隧道网段:
10.1.1.0/24 全连接
10.1.2.0/24 中心站点
4、配置
配置IP与环回
R1配置
<Huawei>SYS
[Huawei]SYS r1
[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]ip add 16.1.1.1 24[r1-GigabitEthernet0/0/0]int g0/0/1
[r1-GigabitEthernet0/0/1]ip add 16.1.2.1 24
[r1-GigabitEthernet0/0/1]int l 0
[r1-LoopBack0]ip add 192.168.1.1 25[r1-LoopBack0]int l 1
[r1-LoopBack1]ip add 192.168.1.129 25
R2配置
<Huawei>sys
[Huawei]sys r2[r2]int g0/0/0
[r2-GigabitEthernet0/0/0]ip add 26.1.1.2 24[r2-GigabitEthernet0/0/0]int l 0
[r2-LoopBack0]ip add 192.168.2.1 24
R3配置
<Huawei>sys
[Huawei]sys r3[r3]int g0/0/0
[r3-GigabitEthernet0/0/0]ip add 36.1.1.3 24[r3-GigabitEthernet0/0/0]int l 0
[r3-LoopBack0]ip add 192.168.3.1 24
R4配置
<Huawei>sys
[Huawei]sys r4[r4]int g0/0/0
[r4-GigabitEthernet0/0/0]ip add 46.1.1.4 24[r4-GigabitEthernet0/0/0]int l 0
[r4-LoopBack0]ip add 192.168.4.1 24
R5配置
<Huawei>sys
[Huawei]sys r5[r5]int g0/0/0
[r5-GigabitEthernet0/0/0]ip add 56.1.1.5 24
[r5-GigabitEthernet0/0/0]int l 0
[r5-LoopBack0]ip add 192.168.5.1 24
R6配置
<Huawei>sys
[Huawei]sys r6[r6]int g0/0/0
[r6-GigabitEthernet0/0/0]ip add 16.1.1.6 24[r6-GigabitEthernet0/0/0]int g0/0/1
[r6-GigabitEthernet0/0/1]ip add 16.1.2.6 24
[r6-GigabitEthernet0/0/1]int g0/0/2
[r6-GigabitEthernet0/0/2]ip add 56.1.1.6 24
[r6-GigabitEthernet0/0/2]int g2/0/0
[r6-GigabitEthernet2/0/0]ip add 26.1.1.6 24
[r6-GigabitEthernet2/0/0]int g3/0/0
[r6-GigabitEthernet3/0/0]ip add 36.1.1.6 24[r6-GigabitEthernet3/0/0]int g4/0/0
[r6-GigabitEthernet4/0/0]ip add 46.1.1.6 24
配置缺省指向R6,实现公网互通
R1配置(注意)
有两条链路,需等价路由,所以写两条缺省
[r1]ip route-static 0.0.0.0 0 16.1.1.6
[r1]ip route-static 0.0.0.0 0 16.1.2.6
R2配置
[r2]ip route-static 0.0.0.0 0 26.1.1.6
R3配置
[r3]ip route-static 0.0.0.0 0 36.1.1.6
R4配置
[r4]ip route-static 0.0.0.0 0 46.1.1.6
R5配置
[r5]ip route-static 0.0.0.0 0 56.1.1.6
测试互通
R1/2/3为星型的拓扑结构,R1为中心站点
R1配置
[r1]int t0/0/0
[r1-Tunnel0/0/0]ip add 10.1.2.1 24
[r1-Tunnel0/0/0]tunnel-protocol gre p2mp
[r1-Tunnel0/0/0]source 16.1.1.1开启伪广播
[r1-Tunnel0/0/0]nhrp entry multicast dynamic
将网络类型改为broadcast
[r1-Tunnel0/0/0]ospf network-type broadcast
R2配置
[r2]int t0/0/0
[r2-Tunnel0/0/0]ip add 10.1.2.2 24
[r2-Tunnel0/0/0]tunnel-protocol gre p2mp
[r2-Tunnel0/0/0]source GigabitEthernet 0/0/0
[r2-Tunnel0/0/0]nhrp entry 10.1.2.1 16.1.1.1 register因为要将DR的位置放在中心节点,所以放弃选举
[r2-Tunnel0/0/0]ospf dr-priority 0
将网络类型改为broadcast
[r2-Tunnel0/0/0]ospf network-type broadcast
R3配置
[r3]int t0/0/0
[r3-Tunnel0/0/0]ip add 10.1.2.3 24
[r3-Tunnel0/0/0]tunnel-protocol gre p2mp
[r3-Tunnel0/0/0]source GigabitEthernet 0/0/0
[r3-Tunnel0/0/0]nhrp entry 10.1.2.1 16.1.1.1 register
放弃选举
[r3-Tunnel0/0/0]ospf dr-priority 0将网络类型改为broadcast
[r3-Tunnel0/0/0]ospf network-type broadcast
测试互通
R1/4/5为全连的MGRE结构
full-mesh架构三者都是中心也是分支,都要互相注册
构建静态隧道,永远存在,没有动态的老化时间
R1配置
[r1]int t0/0/1
[r1-Tunnel0/0/1]shutdown (不关闭会导致注册配置无法生效,无法互相注册)[r1-Tunnel0/0/1]ip add 10.1.1.1 24
[r1-Tunnel0/0/1]tunnel-protocol gre p2mp
[r1-Tunnel0/0/1]source GigabitEthernet 0/0/1因为是中心也是分支
[r1-Tunnel0/0/1]nhrp entry 10.1.1.4 46.1.1.4 register
[r1-Tunnel0/0/1]nhrp entry 10.1.1.5 56.1.1.5 register[r1-Tunnel0/0/1]undo shutdown
将网络类型改为broadcast
[r1-Tunnel0/0/1]ospf network-type broadcast
R4配置
[r4]int t0/0/0
[r4-Tunnel0/0/0]shutdown
[r4-Tunnel0/0/0]ip add 10.1.1.4 24
[r4-Tunnel0/0/0]tunnel-protocol gre p2mp
[r4-Tunnel0/0/0]source GigabitEthernet 0/0/0互相注册
[r4-Tunnel0/0/0]nhrp entry 10.1.1.1 16.1.2.1 register
[r4-Tunnel0/0/0]nhrp entry 10.1.1.5 56.1.1.5 register[r4-Tunnel0/0/0]undo shutdown
将网络类型改为broadcast
[r4-Tunnel0/0/0]ospf network-type broadcast
R5配置
[r5]int t0/0/0
[r5-Tunnel0/0/0]shutdown
[r5-Tunnel0/0/0]ip add 10.1.1.5 24
[r5-Tunnel0/0/0]tunnel-protocol gre p2mp
[r5-Tunnel0/0/0]source GigabitEthernet 0/0/0互相注册
[r5-Tunnel0/0/0]nhrp entry 10.1.1.1 16.1.2.1 register
[r5-Tunnel0/0/0]nhrp entry 10.1.1.4 46.1.1.4 register[r5-Tunnel0/0/0]undo shutdown
将网络类型改为broadcast
[r5-Tunnel0/0/0]ospf network-type broadcast
开启OSPF
R1配置(注意两个隧道地址和环回网段)
[r1]ospf 1 router-id 1.1.1.1
[r1-ospf-1]area 0
[r1-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255 (进行了汇总)
[r1-ospf-1-area-0.0.0.0]network 10.1.0.0 0.0.255.255 (进行了汇总)
R2配置
[r2]ospf 1 router-id 2.2.2.2
[r2-ospf-1]area 0
[r2-ospf-1-area-0.0.0.0]network 192.168.2.1 0.0.0.0
[r2-ospf-1-area-0.0.0.0]network 10.1.2.2 0.0.0.0
R3配置
[r3]ospf 1 router-id 3.3.3.3
[r3-ospf-1]area 0
[r3-ospf-1-area-0.0.0.0]network 192.168.3.1 0.0.0.0
[r3-ospf-1-area-0.0.0.0]network 10.1.2.3 0.0.0.0
R4配置
[r4]ospf 1 router-id 4.4.4.4
[r4-ospf-1]area 0
[r4-ospf-1-area-0.0.0.0]network 192.168.4.1 0.0.0.0
[r4-ospf-1-area-0.0.0.0]network 10.1.1.4 0.0.0.0
R5配置
[r5]ospf 1 router-id 5.5.5.5
[r5-ospf-1]area 0
[r5-ospf-1-area-0.0.0.0]network 192.168.5.1 0.0.0.0
[r5-ospf-1-area-0.0.0.0]network 10.1.1.5 0.0.0.0
5、测试
下一篇: 气泡排序与选择排序的区别