y23335793 发表于 2019-1-28 07:46:45

OSPF(Open Shortest Path First)开放式最短路径优先协议05

  OSPF选路:
http://blog.运维网.com/attachment/201110/092032181.jpg
  O路由优于OIA:
  在R1和R3上同时宣告一条相同路由,R1进area 1 R3进area0,这样,R4会收到两条路由,一条是R1发送的O,一条是R2发送的OIA。
  R4会选择O路由,将1过来的路由AD变大,O路由还是优于OIA
  R4路由表:
  44.0.0.0/32 is subnetted, 1 subnets
  O       44.44.44.44 via 14.0.0.1, 00:00:01, FastEthernet2/0
  加大R1过来的AD:
  44.0.0.0/32 is subnetted, 1 subnets
  O       44.44.44.44 via 14.0.0.1, 00:00:04, FastEthernet2/0
  加大Metric:
  R4:ip ospf cost 6000
  R4路由表:
  44.0.0.0/32 is subnetted, 1 subnets
  O       44.44.44.44 via 14.0.0.1, 00:03:31, FastEthernet2/0
  干掉R1上的44.44.44.44路由,再看
  44.0.0.0/32 is subnetted, 1 subnets
  O IA    44.44.44.44 via 24.0.0.2, 00:00:14, FastEthernet2/1
  结论1:O路由由于O IA,与AD,Metirc无关。
  O路由由于OE1 OE2:
  R1上通告进AREA 1一个环回口 地址为3.3.3.3
  R4上看:
  3.0.0.0/32 is subnetted, 1 subnets
  O       3.3.3.3 via 14.0.0.1, 00:01:26, FastEthernet2/0
  distance和metric都更改过了,还是O路由
  R3上更改外部路由类型试下:
  redistribute static metric-type 1 subnets
  R4上看:
  3.0.0.0/32 is subnetted, 1 subnets
  O       3.3.3.3 via 14.0.0.1, 00:00:09, FastEthernet2/0
  关闭R1上的环回口:
  33.0.0.0/32 is subnetted, 1 subnets
  O E1    33.33.33.33 via 24.0.0.2, 00:00:00, FastEthernet2/1
  3.0.0.0/32 is subnetted, 1 subnets
  O E1    3.3.3.3 via 24.0.0.2, 00:00:00, FastEthernet2/1
  结论2:O路由优于O E1,O E2
  在R1上起一环回口,宣告进area 2,在R4上看O IA和 O E1的区别:
  R4路由表:
  33.0.0.0/32 is subnetted, 1 subnets
  O E1    33.33.33.33 via 24.0.0.2, 00:03:46, FastEthernet2/1
  3.0.0.0/32 is subnetted, 1 subnets
  O IA    3.3.3.3 via 24.0.0.2, 00:00:06, FastEthernet2/1
  在R2上改大Metric:
  3.0.0.0/32 is subnetted, 1 subnets
  O IA    3.3.3.3 via 24.0.0.2, 00:00:00, FastEthernet2/1
  改大AD:
  33.0.0.0/32 is subnetted, 1 subnets
  O E1    33.33.33.33 via 24.0.0.2, 00:00:13, FastEthernet2/1
  3.0.0.0/32 is subnetted, 1 subnets
  O IA    3.3.3.3 via 24.0.0.2, 00:00:13, FastEthernet2/1
  R3上变换外部类型以后,同样情况:
  Down掉R1上环回口:
  33.0.0.0/32 is subnetted, 1 subnets
  O E2    33.33.33.33 via 24.0.0.2, 00:00:01, FastEthernet2/1
  3.0.0.0/32 is subnetted, 1 subnets
  O E2    3.3.3.3 via 24.0.0.2, 00:00:01, FastEthernet2/1
  结论3:O IA路由优于 O E1,O E2。
  将R1的外部路由更改为R3一模一样的IP地址。将R3上的外部路由类型改为O E1
  这样R1重分布进OSPF的是type2 R3重分布进OSPF的是type1
  看下R4路由表:
  33.0.0.0/32 is subnetted, 1 subnets
  O E1    33.33.33.33 via 24.0.0.2, 00:00:16, FastEthernet2/1
  3.0.0.0/32 is subnetted, 1 subnets
  O E1    3.3.3.3 via 24.0.0.2, 00:00:16, FastEthernet2/1
  200.0.0.0/32 is subnetted, 1 subnets
  排除了Metric的因素。
  更改distance,后依然没有效果
  distance 10 1.1.1.1 0.0.0.0
  干掉R3上的重分布。
  R4上看路由表:
  33.0.0.0/32 is subnetted, 1 subnets
  O E2    33.33.33.33 via 14.0.0.1, 00:00:12, FastEthernet2/0
  3.0.0.0/32 is subnetted, 1 subnets
  O E2    3.3.3.3 via 14.0.0.1, 00:00:12, FastEthernet2/0
  结论4:E1优于E2
  在R3上更改外部路由类型为E2,再看:
  R4:
  33.0.0.0/32 is subnetted, 1 subnets
  O E2    33.33.33.33 via 14.0.0.1, 00:00:05, FastEthernet2/0
  3.0.0.0/32 is subnetted, 1 subnets
  O E2    3.3.3.3 via 14.0.0.1, 00:00:05, FastEthernet2/0
  200.0.0.0/32 is subnetted, 1 subnets
  选择了R1的外部路由,更改R3重分布时的seed metric :
  33.0.0.0/32 is subnetted, 1 subnets
  O E2    33.33.33.33 via 24.0.0.2, 00:00:02, FastEthernet2/1
  3.0.0.0/32 is subnetted, 1 subnets
  O E2    3.3.3.3 via 24.0.0.2, 00:00:02, FastEthernet2/1
  改小R1过来的AD
  没有影响,
  更改R1上重分布的COST=10 R1,R3一致,路由还是会从R3走,更改下R1的接口COST
  R4连接R1:
  ip ospfcost=100
  看下R4路由表
  33.0.0.0/32 is subnetted, 1 subnets
  O E2    33.33.33.33 via 24.0.0.2, 00:00:04, FastEthernet2/1
  3.0.0.0/32 is subnetted, 1 subnets
  O E2    3.3.3.3 via 24.0.0.2, 00:00:04, FastEthernet2/1
  为什么会有这种情况
  R4#show ip route 3.3.3.3
  Routing entry for 3.3.3.3/32
  Known via "ospf 1", distance 110, metric 10, type extern 2, forward metric 2
  Last update from 24.0.0.2 on FastEthernet2/1, 00:02:03 ago
  Routing Descriptor Blocks:
  * 24.0.0.2, from 3.3.3.3, 00:02:03 ago, via FastEthernet2/1
  Route metric is 10, traffic share count is 1
  R4#show ip route 3.3.3.3
  Routing entry for 3.3.3.3/32
  Known via "ospf 1", distance 90, metric 10, type extern 2, forward metric 100
  Last update from 14.0.0.1 on FastEthernet2/0, 00:00:11 ago
  Routing Descriptor Blocks:
  * 14.0.0.1, from 1.1.1.1, 00:00:11 ago, via FastEthernet2/0
  Route metric is 10, traffic share count is 1
  收到多条E2路由的时候,先看 metric 再看 forward metric。
  在R1上看,在R2,R3上做外部路由的重分布,将area 1 设置为 stub区域。
  N1 N2的关系和E1,E2一样。
  E2,N2的关系,同样,先看种子 metric 再看forward metric




页: [1]
查看完整版本: OSPF(Open Shortest Path First)开放式最短路径优先协议05