1.实验要求:
2.实施——拓扑搭建
3.配置:我把在此实验中要配置的命令用红色标记出来了,方便大家观看,不然看所有配置确实很多
[R1]dis curr
[V200R003C00]
#
sysname R1
#
wlan ac-global carrier id other ac id 0
#
set cpu-usage threshold 80 restore 75
#
interface GigabitEthernet0/0/0
ip address 16.1.1.1 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 61.1.1.1 255.255.255.0
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack0
ip address 1.1.1.1 255.255.255.0
#
interface Tunnel0/0/0
ip address 10.1.1.1 255.255.255.0
tunnel-protocol gre p2mp
source 16.1.1.1
ospf network-type broadcast
nhrp entry multicast dynamic
nhrp network-id 100
nhrp entry 10.1.1.2 46.1.1.1 register
nhrp entry 10.1.1.3 56.1.1.1 register
#
interface Tunnel0/0/1
ip address 10.1.2.1 255.255.255.0
tunnel-protocol gre p2mp
source 61.1.1.1
ospf network-type broadcast
nhrp entry multicast dynamic
nhrp network-id 101
#
ospf 1 router-id 1.1.1.1
bandwidth-reference 1000
area 0.0.0.0
network 1.1.1.1 0.0.0.0
network 10.1.1.0 0.0.0.255
network 10.1.2.0 0.0.0.255
#
ip route-static 0.0.0.0 0.0.0.0 16.1.1.2
ip route-static 0.0.0.0 0.0.0.0 61.1.1.2
#
wlan ac
#
return
[R4]dis curr
[V200R003C00]
#
sysname R4
#
wlan ac-global carrier id other ac id 0
#
set cpu-usage threshold 80 restore 75
#
interface GigabitEthernet0/0/0
ip address 46.1.1.1 255.255.255.0
#
interface GigabitEthernet0/0/1
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack0
ip address 4.4.4.4 255.255.255.0
#
interface Tunnel0/0/0
ip address 10.1.1.2 255.255.255.0
tunnel-protocol gre p2mp
source 46.1.1.1
ospf network-type broadcast
nhrp entry multicast dynamic
nhrp network-id 100
nhrp entry 10.1.1.1 16.1.1.1 register
nhrp entry 10.1.1.3 56.1.1.1 register
#
ospf 1 router-id 4.4.4.4
bandwidth-reference 1000
area 0.0.0.0
network 4.4.4.4 0.0.0.0
network 10.1.1.0 0.0.0.255
#
ip route-static 0.0.0.0 0.0.0.0 46.1.1.2
#
wlan ac
#
return
[R5]dis curr
[V200R003C00]
#
sysname R5
#
wlan ac-global carrier id other ac id 0
#
set cpu-usage threshold 80 restore 75
#
interface GigabitEthernet0/0/0
ip address 56.1.1.1 255.255.255.0
#
interface GigabitEthernet0/0/1
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack0
ip address 5.5.5.5 255.255.255.0
#
interface Tunnel0/0/0
ip address 10.1.1.3 255.255.255.0
tunnel-protocol gre p2mp
source 56.1.1.1
ospf network-type broadcast
nhrp entry multicast dynamic
nhrp network-id 100
nhrp entry 10.1.1.1 16.1.1.1 register
nhrp entry 10.1.1.2 46.1.1.1 register
#
ospf 1 router-id 5.5.5.5
bandwidth-reference 1000
area 0.0.0.0
network 5.5.5.5 0.0.0.0
network 10.1.1.0 0.0.0.255
#
ip route-static 0.0.0.0 0.0.0.0 56.1.1.2
#
wlan ac
#
return
[R2]dis curr
[V200R003C00]
#
sysname R2
#
wlan ac-global carrier id other ac id 0
#
set cpu-usage threshold 80 restore 75
#
interface GigabitEthernet0/0/0
ip address 26.1.1.1 255.255.255.0
#
interface GigabitEthernet0/0/1
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack0
ip address 2.2.2.2 255.255.255.0
#
interface Tunnel0/0/0
ip address 10.1.2.2 255.255.255.0
tunnel-protocol gre p2mp
source GigabitEthernet0/0/0
ospf network-type broadcast
ospf dr-priority 0
nhrp network-id 101
nhrp entry 10.1.2.1 61.1.1.1 register
#
ospf 1 router-id 2.2.2.2
bandwidth-reference 1000
area 0.0.0.0
network 2.2.2.2 0.0.0.0
network 10.1.2.0 0.0.0.255
#
ip route-static 0.0.0.0 0.0.0.0 26.1.1.2
#
wlan ac
#
return
[R3]dis curr
[V200R003C00]
#
sysname R3
#
wlan ac-global carrier id other ac id 0
#
set cpu-usage threshold 80 restore 75
#
interface GigabitEthernet0/0/0
ip address 36.1.1.1 255.255.255.0
#
interface GigabitEthernet0/0/1
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack0
ip address 3.3.3.3 255.255.255.0
#
interface Tunnel0/0/0
ip address 10.1.2.3 255.255.255.0
tunnel-protocol gre p2mp
source GigabitEthernet0/0/0
ospf network-type broadcast
ospf dr-priority 0
nhrp network-id 101
nhrp entry 10.1.2.1 61.1.1.1 register
#
ospf 1 router-id 3.3.3.3
bandwidth-reference 1000
area 0.0.0.0
network 3.3.3.3 0.0.0.0
network 10.1.2.0 0.0.0.255
#
ip route-static 0.0.0.0 0.0.0.0 36.1.1.2
#
wlan ac
#
return
[R6]dis curr
[V200R003C00]
#
sysname R6
#
wlan ac-global carrier id other ac id 0
#
set cpu-usage threshold 80 restore 75
#
interface GigabitEthernet0/0/0
ip address 16.1.1.2 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 46.1.1.2 255.255.255.0
#
interface GigabitEthernet0/0/2
ip address 56.1.1.2 255.255.255.0
#
interface GigabitEthernet2/0/0
ip address 61.1.1.2 255.255.255.0
#
interface GigabitEthernet3/0/0
ip address 26.1.1.2 255.255.255.0
#
interface GigabitEthernet4/0/0
ip address 36.1.1.2 255.255.255.0
#
interface NULL0
#
interface LoopBack0
ip address 6.6.6.6 255.255.255.0
#
wlan ac
#
return
4.检查R1——R5邻居表
5.检查路由表
6.测试
由上图可知:已实现所有私有网段互通
7.扩展知识:ospf的工作过程
OSPF:开放式最短路径优先协议
无类别链路状态路由协议,属于IGP(内部网关路由协议)
更新方式:组播更新224.0.0.5、6 触发更新,30min一次周期更新
更新量大:为了在中大型网络中使用,必须进行结构化的部署;--区域划分、地址规划
- OSPF的数据包: 跨层封装在3层报头 协议号89
Hello 周期收发 用于邻居、邻接关系的发现、建立、周期保活
DBD 数据库描述表
LSR 链路状态请求
LSU 链路状态更新 -- 携带各种具体的LSA信息
LSack 链路状态确认
LSA—链路状态通告—具体的每条拓扑或路由信息
- OSPF的状态机
Down 一旦收到对端的hello包进入下一个状态;
Init 初始化 一旦接收到的hello包中存在本地的RID,进入下一个状态
2way 双向通讯 邻居关系建立的标志
条件:点到点直接进入下一状态 MA网络进行40sDR/BDR选举,非DR/BDR间不能进入下一状态
Exstart 预启动 使用不携带数据库目标的DBD包进行主从关系选举,RID数值大为主,优
先进入下一个状态
Exchange 准交换 使用携带信息的DBD进行数据库目录共享;
Loading 加载 查看完对端的DBD后,基于本地未知的LSA信息,使用LSR查询,对端
使用LSU应答,本地使用LSack确认;来获取所有未知的LSA信息;
FULL转发 邻接关系建立的标志
- OSPF的工作过程
启动配置完成后,运行ospf协议的路由器,将组播收发hello包;若hello包中存在本地的RID,视为对端已经认识本地,故标志邻居关系建立;生成邻居表;
之后条件的匹配,匹配失败将停留于邻居关系,仅hello周期保活即可;
匹配成功者,将建立邻接(毗邻)关系;首先使用不携带数据库目录的DBD进行主从关系选举;之后主优先与从进行DBD目录交换;交换后再使用LSR/LSU/LSack来获取未知的LSA信息;直到邻接间数据库完全一致;生成LSDB表;-链路状态数据库(该网络所有LSA的集合)
当数据库的同步完成后;本地将所有的LSA进行组合;生成有向图à最短路径树à将最佳路径加载到本地的路由表中;网络收敛完成,hello包周期保活;之后每30min邻接关系间周期比对下一数据库目录;(查漏补缺)
网络结构突变:
- 新增网段 – 直连新增网段的ospf设备,使用LSU告知本地所有邻接,对端需确认
- 断开网段 -直连断开网段的ospf设备,使用LSU告知本地所有邻接,对端需确认
- 无法沟通 ---dead time到时时,断开邻居关系,删除从该邻接学习到信息;
默认hello 包的hello time 为10s或30s dead time 为hello time的4倍
邻居间hello包中必须完全一致的参数; hello 和dead time;区域ID;认证字段;
末梢区域标记;在华为设备的体系中,邻居间接口所配置ip地址子网掩码必须完全一致;