OSPF EIGRP COST

发布时间:2012-01-16 11:10:34

ospf
R1#show int s0/0
Serial0/0 is up, line protocol is up
  Hardware is M4T
  Internet address is 10.1.1.1/24
  MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec,
     reliability 255/255, txload 1/255, rxload 1/255
     ......

ospfcost计算公式 Metric=100000000/(带宽*1000)
计算实例:Metric=100000000/(1544*1000)=64 (串口)

eigrp
Metric = [K1 * bandwidth + ((K2 * bandwidth) / (256 – load)) + K3 * delay]*[K5 / (reliability + K4)]
default K values K1 = 1, K2 = 0, K3 = 1, K4 = 0, K5 = 0
When k4 and k5 are 0, the  [K5 / (reliability + K4)] portion of the equation is n0t factored in to the metric. Therefore, with the default constant values, the metric equation is as follows:
              Metric=Bandwidth + Delay
Bandwidth = 256 X 10000000/bandwidth in kbps
Delay = 256 X delay/10   (delay的单位为us[微秒])
Metric的结果由以下几部分相加后乘以256
1.107次方/该路由所经(发送数据的)接口中带宽值最小的那个值
2.该路由所经(发送数据的)接口所有的时延相加后除以10
Metric=(1+2)*256
可以在接口模式下手动指定delaydelay 2000 (将延迟指定为20000微秒)
可以在接口模式下手动指定bandwidthbandwidth 10000 (将延迟指定为10000kbit,也就是10M)

ms(毫秒)μs(微秒)ns(纳秒),其中:1s=1000ms1ms=1000μs1μs=1000ns
其中μs和延迟的关系才是10倍的关系.
所以Delay=2ms=2000us 2000us/10=200
http://edwinzw.blog.sohu.com/
http://edwinzw.blog.sohu.com/65967241.html

计算实例:
R1#show int fa0/1
FastEthernet0/1 is up, line protocol is up 
  Internet address is 10.1.1.1/24
  MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec
-----------------------------------------------
R2#show int e1/0
Ethernet1/0 is up, line protocol is up 
  Internet address is 10.1.1.2/24
  MTU 1500 bytes, BW 10000 Kbit, DLY 1000 usec
R2#show int e1/1
Ethernet1/1 is up, line protocol is up 
  Internet address is 10.1.2.1/24
  MTU 1500 bytes, BW 10000 Kbit, DLY 1000 usec
-----------------------------------------------
R3#show int e1/0
Ethernet1/0 is up, line protocol is up 
  Internet address is 10.1.2.2/24
  MTU 1500 bytes, BW 1000(这里手动改过) Kbit, DLY 1000 usec
R3#show int e1/1
Ethernet1/1 is up, line protocol is up 
  Internet address is 10.1.3.1/24
  MTU 1500 bytes, BW 10000 Kbit, DLY 1000 usec
-----------------------------------------------
R4#show int fa0/0
FastEthernet0/0 is up, line protocol is up
  Hardware is AmdFE, address is c803.0a7c.0000 (bia c803.0a7c.0000)
  Internet address is 10.1.3.2/24
  MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec
-----------------------------------------------

R1#show ip route
     10.0.0.0/24 is subnetted, 3 subnets
D       10.1.3.0 [90/309760] via 10.1.1.2, 00:12:48, FastEthernet0/1
D       10.1.2.0 [90/284160] via 10.1.1.2, 00:43:09, FastEthernet0/1
C       10.1.1.0 is directly connected, FastEthernet0/1
284160=((10000000/10000|最低BW|)+(100|fa0/1的时延|+1000|R2 E1/1的时延|)/10)*256
      =(1000+1100/10)*256
309760=((10000000/10000|最低BW|)+(100|fa0/1的时延|+1000|R2 E1/1的时延|+1000|R3 E1/1的时延|/10))*256=(1000+2100/10)*256

R2#show ip route
     10.0.0.0/24 is subnetted, 3 subnets
D       10.1.3.0 [90/307200] via 10.1.2.2, 00:42:38, Ethernet1/1
C       10.1.2.0 is directly connected, Ethernet1/1
C       10.1.1.0 is directly connected, Ethernet1/0
307200=(1000+2000/10)*256

R3#show ip route
     10.0.0.0/24 is subnetted, 3 subnets
C       10.1.3.0 is directly connected, Ethernet1/1
C       10.1.2.0 is directly connected, Ethernet1/0
D       10.1.1.0 [90/2611200] via 10.1.2.1, 01:49:25, Ethernet1/0
2611200=((10000000/1000|手动改的那个最低BW|)+(1000|e1/0的时延|+1000|R2 E1/0的时延|/10))*256=(10000+2000/10)*256

R4#show ip route
     10.0.0.0/24 is subnetted, 3 subnets
C       10.1.3.0 is directly connected, FastEthernet0/0
D       10.1.2.0 [90/2588160] via 10.1.3.1, 00:47:53, FastEthernet0/0
D       10.1.1.0 [90/2613760] via 10.1.3.1, 00:47:53, FastEthernet0/0
2588160==((10000000/1000|手动改的那个最低BW|)+(100|fa0/0的时延|+1000|R3 e1/0的时延|/10))*256=(10000+1100/10)*256
2613760=((10000000/1000|手动改的那个最低BW|)+(100|fa0/0的时延|+1000|R3 e1/0的时延|+1000|R2 E1/0的时延|/10))*256=(10000+2100/10)*256

注:igrp的算法和eigrp类似,只是不用乘以256
以上为个人理解,有错误的地方还请告知!

OSPF EIGRP COST

相关推荐