目录
答案:精确宣告和范围宣告的区别
network :命令用来指定运行OSPF协议的接口,用“network + IP + 反掩码”来确定运行OSPF接口范围。
192.168.1.1 0.0.0.0 是精确宣告,只将192.168.1.1这一个接口启用OSPF(只通告你路由器上的这个ip地址的路由)。
192.168.1.1 0.0.0.255 范围宣告,会把192.168.1.0这个24位网段里的所有接口都启用OSPF(这个范围所有地址都通告出去)。
2、实验举例说明:

如设备上有3个接口:接口IP 及掩码 如下
[Huawei]dis ip int br
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 192.168.1.2/30 up up
GigabitEthernet0/0/1 192.168.1.6/30 up up
LoopBack0 192.168.1.100/32 up up(s)
NULL0 unassigned up up(s)
当OSPF使用 0.0.0.255宣告时:把属于192.168.1.0/24段内接口均启用OSPF协议
//OSPF配置如下
ospf 1 router-id 2.2.2.2
area 0.0.0.0
network 192.168.1.0 0.0.0.255
#
//查看启用了OSPF的接口
[Huawei]dis ospf interface
OSPF Process 1 with Router ID 2.2.2.2
Interfaces
Area: 0.0.0.0 (MPLS TE not enabled)
IP Address Type State Cost Pri DR BDR
192.168.1.2 Broadcast BDR 1 1 192.168.1.1 192.168.1.2
192.168.1.6 Broadcast DR 1 1 192.168.1.6 0.0.0.0
192.168.1.100 P2P P-2-P 0 1 0.0.0.0 0.0.0.0
[Huawei]
当OSPF使用 0.0.0.0宣告时:只把192.168.1.2的接口均启用OSPF协议
//OSPF精确宣告配置
ospf 1 router-id 2.2.2.2
area 0.0.0.0
network 192.168.1.2 0.0.0.0
#
//查看启用了OSPF的接口
[Huawei]dis ospf int
OSPF Process 1 with Router ID 2.2.2.2
Interfaces
Area: 0.0.0.0 (MPLS TE not enabled)
IP Address Type State Cost Pri DR BDR
192.168.1.2 Broadcast BDR 1 1 192.168.1.1 192.168.1.2
[Huawei]

本文通过实验举例详细阐述了OSPF协议中精确宣告与范围宣告的区别。精确宣告如192.168.1.20.0.0.0,仅启用指定接口的OSPF,而范围宣告如192.168.1.00.0.0.255会启用整个网段的接口。实验显示,范围宣告会将192.168.1.0/24网段内的所有接口加入OSPF,而精确宣告则只针对单个接口192.168.1.2。
2453

被折叠的 条评论
为什么被折叠?



