OSPF度量值Cost

OSPF度量值Cost

概述

  1. 每个运行OSPF的接口上,都维护这一个接口Cost

计算方式

  1. Cost=10^8/BW(bps) = 100Mbps/BW = 接口带宽参考值/接口带宽

计算过程

  1. 到一个目标网络的度量值 =

    • 从源目标所有出站接口的Cost累加(数据方向)
    • 从源到本路由器途径所有入站接口的Cost值累加(路由方向)
  2. 图示

    alt OSPF-Cost计算过程

实验

实验概述

  1. 在R1路由器上添加一个回环口,并将Cost修改为10,看R1、R2路由器上OSPF-Cost的值为多少

实验过程

  1. R1配置

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    <R1>
    <R1>sys
    Enter system view, return user view with Ctrl+Z.
    [R1]int lo 1
    [R1-LoopBack1]ospf cos
    [R1-LoopBack1]ospf cost 10
    [R1-LoopBack1]dis ospf int lo 1

    OSPF Process 1 with Router ID 1.1.1.1
    Interfaces


    Interface: 1.1.1.1 (LoopBack1)
    Cost: 10 State: P-2-P Type: P2P MTU: 1500
    Timers: Hello 10 , Dead 40 , Poll 120 , Retransmit 5 , Transmit Delay 1
  1. R2的结果

    alt OSPF-Cost-R2

案例

计算Cost值

  1. 题目

    alt OSPF-Cost-题目

  2. 计算结果

    • 192.168.100.0/24到B的Cost值为1+64=65
    • 192.168.100.0/24到C的Cost值为1+64=65和1+64+64=129,如果根据Cost选路,就会选择Cost为65的路径
吴超 wechat
subscribe to my blog by scanning my public wechat account