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地址

路由器R1[2] 的配置

<Huawei>system-view

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

[Huawei]undo info-center enable

[Huawei]sysname R1

[R1]interface s0/0/0

[R1-Serial0/0/0]ip address 12.1.1.1 24

[R1-Serial0/0/0]quit

[R1]interface LoopBack 0

[R1-LoopBack0]ip address 1.1.1.1 32

[R1-LoopBack0]quit

路由器R2[3] 的配置

<Huawei>system-view

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

[Huawei]undo info-center enable

[Huawei]sysname R2

[R2]interface s0/0/1

[R2-Serial0/0/1]ip address 12.1.1.2 24

[R2-Serial0/0/1]quit

[R2]interface LoopBack 0

[R2-LoopBack0]ip address 2.2.2.2 32

[R2-LoopBack0]quit

  1. 步骤2:[4] 运行OSPF

路由器R1的配置

[R1]ospf router-id 1.1.1.1

[R1-ospf-1]area 0

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

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

[R1-ospf-1-area-0.0.0.0]quit

路由器R2的配置

[R2]ospf router-id 2.2.2.2

[R2-ospf-1]area 0

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

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

[R2-ospf-1-area-0.0.0.0]quit

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

[R1]display 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的网络类型

[R1]display 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.

[Huawei]undo info-center enable

[Huawei]sysname R1

[R1]interface g0/0/0

[R1-GigabitEthernet0/0/0]ip address 10.1.1.1 24

[R1-GigabitEthernet0/0/0]quit

[R1]interface LoopBack 0

[R1-LoopBack0]ip address 1.1.1.1 32

[R1-LoopBack0]quit

R2配置

<Huawei>system-view

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

[Huawei]undo info-center enable

[Huawei]sysname R2

[R2]interface g0/0/0

[R2-GigabitEthernet0/0/0]ip address 10.1.1.2 24

[R2-GigabitEthernet0/0/0]quit

[R2]interface LoopBack 0

[R2-LoopBack0]ip address 2.2.2.2 32

[R2-LoopBack0]quit

R3配置

<Huawei>system-view

[Huawei]undo info-center enable

[Huawei]sysname R3

[R3]interface g0/0/0

[R3-GigabitEthernet0/0/0]ip address 10.1.1.3 24

[R3-GigabitEthernet0/0/0]quit

[R3]interface LoopBack 0

[R3-LoopBack0]ip address 3.3.3.3 32

[R3-LoopBack0]quit

R4配置

<Huawei>system-view

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

[Huawei]undo info-center enable

[Huawei]sysname R4

[R4]interface g0/0/0

[R4-GigabitEthernet0/0/0]ip address 10.1.1.4 24

[R4-GigabitEthernet0/0/0]quit

[R4]interface LoopBack 0

[R4-LoopBack0]ip address 4.4.4.4 32

[R4-LoopBack0]quit

  1. 运行OSPF

R1的配置

[R1]ospf router-id 1.1.1.1

[R1-ospf-1]area 0

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

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

[R1-ospf-1-area-0.0.0.0]quit

R2的配置

[R2]ospf router-id 2.2.2.2

[R2-ospf-1]area 0

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

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

[R2-ospf-1-area-0.0.0.0]quit

R3的配置

[R3]ospf router-id 3.3.3.3

[R3-ospf-1]area 0

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

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

[R3-ospf-1-area-0.0.0.0]quit

R4的配置

[R4]ospf router-id 4.4.4.4

[R4-ospf-1]area 0

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

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

[R4-ospf-1-area-0.0.0.0]quit

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的接口的优先级设置为0[5]

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

[Huawei]undo info-center enable

[Huawei]sysname R1

[R1]interface s0/0/0

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

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

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

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

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

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

[R1-Serial0/0/0]quit

[R1]interface LoopBack 0

[R1-LoopBack0]ip address 1.1.1.1 24

[R1-LoopBack0]quit

R2的配置

<Huawei>system-view

[Huawei]undo info-center enable

Info: Information center is disabled.

[Huawei]sysname R2

[R2]interface s0/0/0

[R2-Serial0/0/0]link-protocol fr

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

Continue? [Y/N]:y

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

[R2-Serial0/0/0]ip address 10.1.1.2 24

[R2-Serial0/0/0]quit

[R2]interface LoopBack 0

[R2-LoopBack0]ip address 2.2.2.2 24

[R2-LoopBack0]quit

R3的配置

<Huawei>system-view

[Huawei]undo info-center enable

[Huawei]sysname R3

[R3]interface s0/0/0

[R3-Serial0/0/0]link-protocol fr

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

Continue? [Y/N]:y

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

[R3-Serial0/0/0]ip address 10.1.1.3 24

[R3-Serial0/0/0]quit

[R3]interface LoopBack 0

[R3-LoopBack0]ip address 3.3.3.3 24

[R3-LoopBack0]quit

  1. 运行OSPF

R1的配置

[R1]ospf router-id 1.1.1.1

[R1-ospf-1]area 0

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

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

[R1-ospf-1-area-0.0.0.0]quit

R2的配置

[R2]ospf router-id 2.2.2.2

[R2-ospf-1]area 0

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

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

[R2-ospf-1-area-0.0.0.0]quit

R3的配置

[R3]ospf router-id 3.3.3.3

[R3-ospf-1]area 0

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

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

[R3-ospf-1-area-0.0.0.0]quit

  1. 实验调试

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

[R1]display 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的接口状态

[R1]display 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的配置

[R1]ospf

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

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

R2的配置

[R2]ospf

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

[R2-ospf-1]quit

R3的配置

[R3]ospf

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

[R3-ospf-1]quit

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

R2的配置

[R2]interface s0/0/0

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

[R2-Serial0/0/0]quit

R3的配置

[R3]interface s0/0/0

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

[R3-Serial0/0/0]quit

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

[R1]display 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的配置

[R1]ospf

[R1-ospf-1]undo peer 10.1.1.2

[R1-ospf-1]undo peer 10.1.1.3

[R1-ospf-1]quit

R2的配置

[R2]ospf

[R2-ospf-1]undo peer 10.1.1.1

[R2-ospf-1]quit

R3的配置

[R3]ospf

[R3-ospf-1]undo peer 10.1.1.1

[R3-ospf-1]quit

查看OSPF的邻居关系

[R1]display 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的配置

[R1]interface s0/0/0

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

[R1-Serial0/0/0]quit

R2的配置

[R2]interface s0/0/0

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

[R2-Serial0/0/0]quit

R3的配置

[R3]interface s0/0/0

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

[R3-Serial0/0/0]quit

  1. 查看OSPF的邻居状态

[R1]display 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

相关推荐
速盾cdn1 小时前
速盾:如何判断高防服务器的防御是否真实?
网络·安全
ZachOn1y2 小时前
计算机网络:计算机网络体系结构 —— 专用术语总结
网络·tcp/ip·计算机网络·考研必备
笑非不退2 小时前
网络安全 网络安全的主要领域 安全威胁 防护技术 安全策略 未来趋势
网络
一尘之中2 小时前
网 络 安 全
网络·人工智能·学习·安全
车载诊断技术4 小时前
什么是汽车中的SDK?
网络·架构·汽车·soa·电子电器架构
一颗星星辰4 小时前
Python | 第九章 | 排序和查找
服务器·网络·python
ZachOn1y4 小时前
计算机网络:计算机网络概述:网络、互联网与因特网的区别
网络·计算机网络·知识点汇总·考研必备
GOTXX5 小时前
应用层协议HTTP
linux·网络·网络协议·计算机网络·http·fiddler
小堃学编程12 小时前
计算机网络(十) —— IP协议详解,理解运营商和全球网络
网络·tcp/ip·计算机网络
IPFoxy66615 小时前
探索路由器静态IP的获取方式
网络·智能路由器