目录

答案:精确宣告和范围宣告的区别

实验举例说明:


 答案:精确宣告和范围宣告的区别

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]

Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐