分类:
2011-11-20 18:50:22
原文地址:对华为设备ospf cost计算的一点探讨 作者:xuxic
在学习华为bandwidth conference 命令的使用过程中,发现实际的cost好像并不是按照理论的计算方法得到的。我当时是在三层交换机(S3328,100M接口)上进行试验确认的,得到如下的结果:
设置bandwidth-reference 10000 得到cost=10,如果按照产品文档上开销 = 参考值(M)/带宽来计算计算应该是100才对。感觉是按1000M接口来计算的。
dis ip routing
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 12 Routes : 13
Destination/Mask Proto Pre Cost Flags NextHop Interface
1.1.1.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
2.2.2.2/32 OSPF 10 10 D 172.16.11.2 Vlanif3000
3.3.3.3/32 OSPF 10 11 D 172.16.11.2 Vlanif3000
OSPF 10 11 D 172.16.11.13 Vlanif4000
4.4.4.4/32 OSPF 10 10 D 172.16.11.13 Vlanif4000
后来我在SRG2206的路由器(端口匹配100M/Full)上进行测试,发现实际的cost值和按照公式算出来的一样,如下:
[TEST-SRG2200-ospf-100]bandwidth-reference 10000
09:31:292011/08/11
Info: OSPF 100 Reference bandwidth is changed
Please ensure reference bandwidth is consistent across all routers.
[TEST-SRG2200-ospf-100]dis ip routing
09:31:452011/08/11
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 5 Routes : 5
Destination/Mask ProtoPreCost Flags NextHop Interface
1.1.1.1/32OSPF 10 100 D172.16.11.9 GigabitEthernet0/0/1
===========================================================
[TEST-SRG2200-ospf-100]bandwidth-reference 1000
09:32:492011/08/11
Info: OSPF 100 Reference bandwidth is changed
Please ensure reference bandwidth is consistent across all routers.
[TEST-SRG2200-ospf-100]dis ip routing
09:32:532011/08/11
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 5 Routes : 5
Destination/Mask ProtoPreCost Flags NextHop Interface
1.1.1.1/32OSPF 10 10 D172.16.11.9 GigabitEthernet0/0/1
两者之间的不同就是交换机的端口为vlanif虚拟接口,而路由器上为物理接口。在实际的物理接口上是按照公式来计算,而在vlanif端口就不一样了,可能的原因是:既然100M接口和1000M接口都可以划到vlan中,那以什么来衡量vlanif的端口带宽呢,那就以交换机的最大端口带宽为准。