redistribute connected 不带 subnet 参数的话,只会重分布主类网段

拓扑

实验02 - Redistribution Into OSPF - 图1

步骤

E2 vs E2:比较OSPF内部的forward metric

  • 查看R1的路由,去往10.24.1.0 只有1条路径,并没有做ECMP

实验02 - Redistribution Into OSPF - 图2

  • show ip ospf database external,可以看到R1分别有收到来自R2 和 R4 的对10.24.1.0 的宣告

实验02 - Redistribution Into OSPF - 图3

  • 在R1上来查看路由条目的明细,可以看到走R2 的 forward metric 为1

实验02 - Redistribution Into OSPF - 图4

  • 我们现在来把R1 G0/0 的cost 修改为100,可以看到R1 去往 10.24.1.0 的路径发生了变化,改走R3,同时因为经历2跳,metric 变为2

实验02 - Redistribution Into OSPF - 图5

  • 如果再把R3 的G0/1 cost 也改为100,可以看到路由又变回R2,forward metric 是100
    • 注意 forward metric 和 route metric 的区别

实验02 - Redistribution Into OSPF - 图6

E1 vs E2:E1 更优

  • 保留上面实验的现场,R1去到10.12.1.0 是走R2.我们来调整R4:redistribute connected metric-type 1。此时可以看到R1到 10.12.1.0 的路径变为走R3,类型变为E1,metric 为121 = 20 + 100 + 1

实验02 - Redistribution Into OSPF - 图7

E1 vs E1:单纯地比较metric

  • 我们再来把R2 的metric-type 也调整为 E1

实验02 - Redistribution Into OSPF - 图8

  • 回到R1 查看路由,到10.12.1.0 的路径重新变回R2,因为R2拥有更短的路径(更低的Metric)

实验02 - Redistribution Into OSPF - 图9