OSPF的网络类型

1.3配置OSPF的网络类型

1.3.1实验3:配置P2P网络类型

  1. 实验需求
  1. 实现单区域OSPF的配置
  2. 实现通过display命令查看OSPF的网络类型
  1. 实验拓扑

实验拓扑如图1-11所示

图1-11 配置P2P网络类型

  1. 实验步骤
  1. 步骤1:1 配置IP地址

路由器R12 的配置

<Huawei>system-view

Enter system view, return user view with Ctrl+Z.

Huaweiundo info-center enable

Huaweisysname R1

R1interface s0/0/0

R1-Serial0/0/0ip address 12.1.1.1 24

R1-Serial0/0/0quit

R1interface LoopBack 0

R1-LoopBack0ip address 1.1.1.1 32

R1-LoopBack0quit

路由器R23 的配置

<Huawei>system-view

Enter system view, return user view with Ctrl+Z.

Huaweiundo info-center enable

Huaweisysname R2

R2interface s0/0/1

R2-Serial0/0/1ip address 12.1.1.2 24

R2-Serial0/0/1quit

R2interface LoopBack 0

R2-LoopBack0ip address 2.2.2.2 32

R2-LoopBack0quit

  1. 步骤2:4 运行OSPF

路由器R1的配置

R1ospf router-id 1.1.1.1

R1-ospf-1area 0

R1-ospf-1-area-0.0.0.0network 12.1.1.0 0.0.0.255

R1-ospf-1-area-0.0.0.0network 1.1.1.1 0.0.0.0

R1-ospf-1-area-0.0.0.0quit

路由器R2的配置

R2ospf router-id 2.2.2.2

R2-ospf-1area 0

R2-ospf-1-area-0.0.0.0network 12.1.1.0 0.0.0.255

R2-ospf-1-area-0.0.0.0network 2.2.2.2 0.0.0.0

R2-ospf-1-area-0.0.0.0quit

  1. 实验调试
  1. R1上查看S0/0/0的二层封装

R1display interface s0/0/0 //查看接口s0/0/0信息

Serial0/0/0 current state : UP

Line protocol current state : UP

Last line protocol up time : 2022-04-28 17:13:04 UTC-08:00

Description:

Route Port,The Maximum Transmit Unit is 1500, Hold timer is 10(sec)

Internet Address is 12.1.1.1/24

Link layer protocol is PPP //二层封装为PPP

LCP opened, IPCP opened

Last physical up time : 2022-04-28 17:08:25 UTC-08:00

Last physical down time : 2022-04-28 17:08:22 UTC-08:00

Current system time: 2022-04-28 17:19:13-08:00Interface is V35

Last 300 seconds input rate 7 bytes/sec, 0 packets/sec

Last 300 seconds output rate 9 bytes/sec, 0 packets/sec

Input: 3742 bytes, 169 Packets

Ouput: 4310 bytes, 177 Packets

Input bandwidth utilization : 0.08%

Output bandwidth utilization : 0.11%

  1. 在R1上查看OSPF的网络类型

R1display ospf interface s0/0/0

OSPF Process 1 with Router ID 1.1.1.1

Interfaces

Interface: 12.1.1.1 (Serial0/0/0) --> 12.1.1.2

Cost: 1562 State: P-2-P Type: P2P MTU: 1500

Timers: Hello 10 , Dead 40 , Poll 120 , Retransmit 5 , Transmit Delay 1

通过本实验可以看到,如果链路层封装的PPP,那么OSPF的网络类型为P2P。

1.3.2实验4:配置broadcast网络类型

  1. 实验需求

  2. 控制OSPF DR的选举

  3. 实现通过display命令查看OSPF的网络类型

  4. 实验拓扑

配置broadcast网络类型如图1-12所示。

图1-12 配置broadcast网络类

  1. 实验步骤

  2. 配置IP地址

R1配置

<Huawei>system-view

Enter system view, return user view with Ctrl+Z.

Huaweiundo info-center enable

Huaweisysname R1

R1interface g0/0/0

R1-GigabitEthernet0/0/0ip address 10.1.1.1 24

R1-GigabitEthernet0/0/0quit

R1interface LoopBack 0

R1-LoopBack0ip address 1.1.1.1 32

R1-LoopBack0quit

R2配置

<Huawei>system-view

Enter system view, return user view with Ctrl+Z.

Huaweiundo info-center enable

Huaweisysname R2

R2interface g0/0/0

R2-GigabitEthernet0/0/0ip address 10.1.1.2 24

R2-GigabitEthernet0/0/0quit

R2interface LoopBack 0

R2-LoopBack0ip address 2.2.2.2 32

R2-LoopBack0quit

R3配置

<Huawei>system-view

Huaweiundo info-center enable

Huaweisysname R3

R3interface g0/0/0

R3-GigabitEthernet0/0/0ip address 10.1.1.3 24

R3-GigabitEthernet0/0/0quit

R3interface LoopBack 0

R3-LoopBack0ip address 3.3.3.3 32

R3-LoopBack0quit

R4配置

<Huawei>system-view

Enter system view, return user view with Ctrl+Z.

Huaweiundo info-center enable

Huaweisysname R4

R4interface g0/0/0

R4-GigabitEthernet0/0/0ip address 10.1.1.4 24

R4-GigabitEthernet0/0/0quit

R4interface LoopBack 0

R4-LoopBack0ip address 4.4.4.4 32

R4-LoopBack0quit

  1. 运行OSPF

R1的配置

R1ospf router-id 1.1.1.1

R1-ospf-1area 0

R1-ospf-1-area-0.0.0.0network 10.1.1.0 0.0.0.255

R1-ospf-1-area-0.0.0.0network 1.1.1.1 0.0.0.0

R1-ospf-1-area-0.0.0.0quit

R2的配置

R2ospf router-id 2.2.2.2

R2-ospf-1area 0

R2-ospf-1-area-0.0.0.0network 10.1.1.0 0.0.0.255

R2-ospf-1-area-0.0.0.0network 2.2.2.2 0.0.0.0

R2-ospf-1-area-0.0.0.0quit

R3的配置

R3ospf router-id 3.3.3.3

R3-ospf-1area 0

R3-ospf-1-area-0.0.0.0network 10.1.1.0 0.0.0.255

R3-ospf-1-area-0.0.0.0network 3.3.3.3 0.0.0.0

R3-ospf-1-area-0.0.0.0quit

R4的配置

R4ospf router-id 4.4.4.4

R4-ospf-1area 0

R4-ospf-1-area-0.0.0.0network 10.1.1.0 0.0.0.255

R4-ospf-1-area-0.0.0.0network 4.4.4.4 0.0.0.0

R4-ospf-1-area-0.0.0.0quit

4.实验调试

  1. 在R1上查看g0/0/0的二层封装

<R1>display interface g0/0/0

GigabitEthernet0/0/0 current state : UP

Line protocol current state : UP

Last line protocol up time : 2022-04-28 17:42:07 UTC-08:00

Description:

Route Port,The Maximum Transmit Unit is 1500

Internet Address is 10.1.1.1/24

IP SendingFrames' Format is PKTFMT_ETHNT_2 , Hardware address is 5489-98ab-3a55

Last physical up time : 2022-04-28 17:41:34 UTC-08:00

Last physical down time : 2022-04-28 17:41:23 UTC-08:00

Current system time: 2022-04-28 18:06:52-08:00

Hardware address is 5489-98ab-3a55

Last 300 seconds input rate 82 bytes/sec, 0 packets/sec

Last 300 seconds output rate 9 bytes/sec, 0 packets/sec

Input: 106447 bytes, 962 packets

Output: 13822 bytes, 154 packets

Input:

Unicast: 14 packets, Multicast: 943 packets

Broadcast: 5 packets

Output:

Unicast: 17 packets, Multicast: 137 packets

Broadcast: 0 packets

Input bandwidth utilization : 0%

Output bandwidth utilization : 0%

通过以上输出可以看到二层封装的为PKTFMT_ETHNT_2

  1. 在R1上查看OSPF的网络类型

<R1>display ospf interface g0/0/0

OSPF Process 1 with Router ID 1.1.1.1

Interfaces

Interface: 10.1.1.1 (GigabitEthernet0/0/0)

Cost: 1 State: DR Type: Broadcast MTU: 1500

Priority: 1

Designated Router: 10.1.1.1

Backup Designated Router: 10.1.1.2

Timers: Hello 10 , Dead 40 , Poll 120 , Retransmit 5 , Transmit Delay 1

通过以上输出可以看到二层封装为PKTFMT_ETHNT_2,那么OSPF的网络类型为broadcast。

【思考】10.1.1.1成为了DR,10.1.1.2成为了BDR。为什么?怎么操作才能让10.1.1.4成为DR,10.1.1.3成为BDR。

方法1:所有设备重启OSPF进程reset ospf 1 process

方法2:把R1和R2的接口的优先级设置为05

1.3.3实验5:配置NBMA和P2MP网络类型

  1. 实验需求

  2. 控制OSPF DR的选举

  3. 修改OSPF的网络类型

  4. 实验拓扑

配置NBMA和P2MP网络类型实验拓扑如图1-13所示。

图1-13 配置NBMA和P2MP网络类型

  1. 实验步骤

  2. 帧中继的配置如图1-14和图1-15所示

6

图1-14 帧中继的配置一

图1-15 帧中继的配置二

注意:帧中继的配置要在拓扑搭建前就要配置好,设备启动后不用做任何配置

  1. 配置IP地址

R1的配置

<Huawei>system-view

Huaweiundo info-center enable

Huaweisysname R1

R1interface s0/0/0

R1-Serial0/0/0link-protocol fr //二层的封装协议为FR

Warning: The encapsulation protocol of the link will be changed.

Continue? Y/N:y //选择Y

R1-Serial0/0/0fr map ip 10.1.1.2 102 broadcast //去10.1.1.2打上102的标记然后广播

R1-Serial0/0/0fr map ip 10.1.1.3 103 broadcast //去10.1.1.3打上102的标记然后广播

R1-Serial0/0/0ip address 10.1.1.1 24 //配置接口IP地址

R1-Serial0/0/0quit

R1interface LoopBack 0

R1-LoopBack0ip address 1.1.1.1 24

R1-LoopBack0quit

R2的配置

<Huawei>system-view

Huaweiundo info-center enable

Info: Information center is disabled.

Huaweisysname R2

R2interface s0/0/0

R2-Serial0/0/0link-protocol fr

Warning: The encapsulation protocol of the link will be changed.

Continue? Y/N:y

R2-Serial0/0/0fr map ip 10.1.1.1 201 broadcast

R2-Serial0/0/0ip address 10.1.1.2 24

R2-Serial0/0/0quit

R2interface LoopBack 0

R2-LoopBack0ip address 2.2.2.2 24

R2-LoopBack0quit

R3的配置

<Huawei>system-view

Huaweiundo info-center enable

Huaweisysname R3

R3interface s0/0/0

R3-Serial0/0/0link-protocol fr

Warning: The encapsulation protocol of the link will be changed.

Continue? Y/N:y

R3-Serial0/0/0fr map ip 10.1.1.1 301 broadcast

R3-Serial0/0/0ip address 10.1.1.3 24

R3-Serial0/0/0quit

R3interface LoopBack 0

R3-LoopBack0ip address 3.3.3.3 24

R3-LoopBack0quit

  1. 运行OSPF

R1的配置

R1ospf router-id 1.1.1.1

R1-ospf-1area 0

R1-ospf-1-area-0.0.0.0network 10.1.1.0 0.0.0.255

R1-ospf-1-area-0.0.0.0network 1.1.1.0 0.0.0.255

R1-ospf-1-area-0.0.0.0quit

R2的配置

R2ospf router-id 2.2.2.2

R2-ospf-1area 0

R2-ospf-1-area-0.0.0.0network 10.1.1.0 0.0.0.255

R2-ospf-1-area-0.0.0.0network 2.2.2.0 0.0.0.255

R2-ospf-1-area-0.0.0.0quit

R3的配置

R3ospf router-id 3.3.3.3

R3-ospf-1area 0

R3-ospf-1-area-0.0.0.0network 10.1.1.0 0.0.0.255

R3-ospf-1-area-0.0.0.0network 3.3.3.0 0.0.0.255

R3-ospf-1-area-0.0.0.0quit

  1. 实验调试

  2. 在R1上查看OSPF的邻接关系

R1display ospf peer brief

OSPF Process 1 with Router ID 1.1.1.1

Peer Statistic Information


Area Id Interface Neighbor id State


通过以上输出,可以看到OSPF没有任何邻接关系。

  1. 查看R1的OSPF的接口状态

R1display ospf interface s0/0/0

OSPF Process 1 with Router ID 1.1.1.1

Interfaces

Interface: 10.1.1.1 (Serial0/0/0)

Cost: 1562 State: DR Type: NBMA MTU: 1500

Priority: 1

Designated Router: 10.1.1.1

Backup Designated Router: 0.0.0.0

Timers: Hello 30 , Dead 120 , Poll 120 , Retransmit 5 , Transmit Delay 1

通过以上输出可以看到OSPF的网络类型为NBMA

【技术要点】

二层封装的为帧中继,在这样的网络上面运行 OSPF协议,默认的网络类型为NBMA,所以在帧中继的网络环境中布置OSPF要注意:

  • NB代表不支持广播,OSPF的Hello包默认使用组播发送,但是NBMA不支持广播和组播,所以要单播建立邻居
  • MA代表多路由访问,会选择DR和BDR,我们要让中心站点R1成为DR,没有必要选择BDR,因为中心站点出了问题,分支站点间也不能通信了
  1. 配置单播建立邻居

R1的配置

R1ospf

R1-ospf-1peer 10.1.1.2 //和10.1.1.2单播邻居

R1-ospf-1peer 10.1.1.3 //和10.1.1.3单播邻居

R2的配置

R2ospf

R2-ospf-1peer 10.1.1.1 //和10.1.1.1单播邻居

R2-ospf-1quit

R3的配置

R3ospf

R3-ospf-1peer 10.1.1.1 //和10.1.1.1单播邻居

R3-ospf-1quit

  1. 配置R1为DR,不选择BDR

R2的配置

R2interface s0/0/0

R2-Serial0/0/0ospf dr-priority 0 //优先级设置为0

R2-Serial0/0/0quit

R3的配置

R3interface s0/0/0

R3-Serial0/0/0ospf dr-priority 0 //优先级设置为0

R3-Serial0/0/0quit

  1. 在R1上查看OSPF的邻接关系

R1display ospf peer brief

OSPF Process 1 with Router ID 1.1.1.1

Peer Statistic Information


Area Id Interface Neighbor id State

0.0.0.0 Serial0/0/0 2.2.2.2 Full

0.0.0.0 Serial0/0/0 3.3.3.3 Full


通过以上输出可以看到R1与R2、R1与R3的邻居关系为full

  1. 删除(3)和(4)的配置

R1的配置

R1ospf

R1-ospf-1undo peer 10.1.1.2

R1-ospf-1undo peer 10.1.1.3

R1-ospf-1quit

R2的配置

R2ospf

R2-ospf-1undo peer 10.1.1.1

R2-ospf-1quit

R3的配置

R3ospf

R3-ospf-1undo peer 10.1.1.1

R3-ospf-1quit

查看OSPF的邻居关系

R1display ospf peer brief

OSPF Process 1 with Router ID 1.1.1.1

Peer Statistic Information


Area Id Interface Neighbor id State


通过以上输出,可以看到OSPF的邻居关系为无

  1. 把网络类型改成P2MP

R1的配置

R1interface s0/0/0

R1-Serial0/0/0ospf network-type p2mp //设置OSPF的网络类型为P2MP

R1-Serial0/0/0quit

R2的配置

R2interface s0/0/0

R2-Serial0/0/0ospf network-type p2mp //设置OSPF的网络类型为P2MP

R2-Serial0/0/0quit

R3的配置

R3interface s0/0/0

R3-Serial0/0/0ospf network-type p2mp //设置OSPF的网络类型为P2MP

R3-Serial0/0/0quit

  1. 查看OSPF的邻居状态

R1display ospf peer brief

OSPF Process 1 with Router ID 1.1.1.1

Peer Statistic Information


Area Id Interface Neighbor id State

0.0.0.0 Serial0/0/0 2.2.2.2 Full

0.0.0.0 Serial0/0/0 3.3.3.3 Full


通过以上输出可以看到,OSPF的邻接关系为full

【技术要点】

没有一种链路层协议会被缺省的认为是Point-to-Multipoint类型。点到多点必须是由其他的网络类型强制更改的。常用做法是将非全连通的NBMA改为点到多点的网络。

在该类型的网络中:

  • 以组播形式(224.0.0.5)发送Hello报文。
  • 以单播形式发送其他协议报文(DD报文、LSR报文、LSU报文、LSAck报文)。


有任何技术问题可以加下方的V

相关推荐
hhhjhl6 小时前
Protobuf.js 跨端三方库仓颉适配全流程
javascript·网络·udp
ITxiaobing20237 小时前
中国公司海外广告投放的 IP 地址库选型:从“查归属”到“验真实”的工程视角
网络·网络协议·tcp/ip
KKKlucifer8 小时前
运营商非结构化文档安全管控体系建设实践
大数据·网络·安全
网络小江9 小时前
组网第35课:静态路由——下一跳、出接口、默认路由、浮动静态与黑洞路由
服务器·网络·默认路由·黑洞路由·浮动静态路由
acrel710 小时前
医院用电隐患治理与节能降耗及智慧能源平台应用
网络·数据库
Escalating_xu11 小时前
【Linux 网络编程】应用层协议 HTTP(下):Header、连接管理与 C++ HTTP 服务器
linux·服务器·网络
明天也要努力学习12 小时前
TCP 协议的相关特性
网络·网络协议·tcp/ip
qq_4017004113 小时前
100 个 IoT 小项目,给 ESP32 入门补上实操
前端·网络·stm32
2401_8734794013 小时前
源IP告警太多用什么工具分层?ASN与风险评分操作指南
网络·网络协议·tcp/ip