zoukankan      html  css  js  c++  java
  • 动态路由协议 双点双向重分布 次优选路的解决办法

    一.问题分析
    对于动态路由协议(本实验以rip和ospf为例),再进行双点双向重分布时,可能存在问题:次优路径

    产生原因:把AD值高的路由协议(rip)重分布到AD值低的路由协议(ospf)

     

    实验部署:R1、R2、R3运行rip协议,R2、R3、R4运行ospf协议,区域为area 0

    然后在R2和R3分别将rip重分布进ospf 1和ospf 1重分布进rip

    分析:R2可以通过两种方式学习到R1的回环接口1.1.1.1/32的路由,

    第一种方式是R1通过rip将路由条目从s0/0发给R2的s0/0

    第二种方式是R1通过rip将路由条目从s0/1发给R3,然后在R3将rip重分布进ospf,再将ospf的路由信息发送给R4.最后R4转发给R2的s0/1

    比较这两个路由信息,R2从s0/0学习到的rip路由信息AD为120,从s0/1学习到的ospf路由信息AD为110,所以会优先选择AD较小的路由条目即选择第二条路由,然而这条路径并不是最好的路径。

    查看R2的路由表便可看到问题所在

    R2#show ip route

         34.0.0.0/24 is subnetted, 1 subnets
    O       34.1.1.0 [110/128] via 24.1.1.4, 00:05:13, Serial0/1
         1.0.0.0/32 is subnetted, 1 subnets
    O E2    1.1.1.1 [110/20] via 24.1.1.4, 00:05:13, Serial0/1
         2.0.0.0/32 is subnetted, 1 subnets
    C       2.2.2.2 is directly connected, Loopback0
         3.0.0.0/32 is subnetted, 1 subnets
    O       3.3.3.3 [110/129] via 24.1.1.4, 00:05:13, Serial0/1
         4.0.0.0/32 is subnetted, 1 subnets
    O       4.4.4.4 [110/65] via 24.1.1.4, 00:05:13, Serial0/1
         24.0.0.0/24 is subnetted, 1 subnets
    C       24.1.1.0 is directly connected, Serial0/1
         12.0.0.0/24 is subnetted, 1 subnets
    C       12.1.1.0 is directly connected, Serial0/0
         13.0.0.0/24 is subnetted, 1 subnets
    O E2    13.1.1.0 [110/20] via 24.1.1.4, 00:05:16, Serial0/1

    二.解决方法
     

    方法一、修改重分发的路由(R2、R3)的管理距离 (此方法不太好)

    R2(config)#router ospf 1                 //修改R2的管理距离

    R2(config-router)#distance 121

    R3(config)#router ospf 1                 //修改R3的管理距离

    R3(config-router)#distance 121

    将此协议的路由的AD改为121,对本协议所有路由都有效,改动范围太大,通常不建议这样做)

    查看R2(或R3)的路由表可见现在路径是最优的,但是其他ospf路有条目的管理距离都被改为121,可见此方法不太好

    R2#show ip route

         34.0.0.0/24 is subnetted, 1 subnets
    O       34.1.1.0 [121/128] via 24.1.1.4, 00:00:03, Serial0/1
         1.0.0.0/32 is subnetted, 1 subnets
    R       1.1.1.1 [120/1] via 12.1.1.1, 00:00:03, Serial0/0
         2.0.0.0/32 is subnetted, 1 subnets
    C       2.2.2.2 is directly connected, Loopback0
         3.0.0.0/32 is subnetted, 1 subnets
    O       3.3.3.3 [121/129] via 24.1.1.4, 00:00:03, Serial0/1
         4.0.0.0/32 is subnetted, 1 subnets
    O       4.4.4.4 [121/65] via 24.1.1.4, 00:00:03, Serial0/1
         24.0.0.0/24 is subnetted, 1 subnets
    C       24.1.1.0 is directly connected, Serial0/1
         12.0.0.0/24 is subnetted, 1 subnets
    C       12.1.1.0 is directly connected, Serial0/0
         13.0.0.0/24 is subnetted, 1 subnets
    R       13.1.1.0 [120/1] via 12.1.1.1, 00:00:05, Serial0/0

    方法二、只修改指定ADV router的路由的管理距离(必须路由的ADV router正确,通过show ip os da查看)(此方法较好)

    进入R2的ospf进程1,只将路由器3.3.3.3通告的OSPF路由AD改为121

    R2(config)#router ospf 1               

    R2(config-router)#distance 121 3.3.3.3 0.0.0.0  

    进入R3的ospf进程1,只将路由器2.2.2.2通告的OSPF路由AD改为121

    R3(config)#router ospf 1               

    R3(config-router)#distance 121 2.2.2.2 0.0.0.0

    注释:0.0.0.0是反掩码,用来对前面的2.2.2.2和3.3.3.3精确匹配

    查看R2的路由条目

    R2#show ip route

         34.0.0.0/24 is subnetted, 1 subnets
    O       34.1.1.0 [110/128] via 24.1.1.4, 00:04:03, Serial0/1
         1.0.0.0/32 is subnetted, 1 subnets
    R       1.1.1.1 [120/1] via 12.1.1.1, 00:00:23, Serial0/0
         2.0.0.0/32 is subnetted, 1 subnets
    C       2.2.2.2 is directly connected, Loopback0
         3.0.0.0/32 is subnetted, 1 subnets
    O       3.3.3.3 [121/129] via 24.1.1.4, 00:04:03, Serial0/1
         4.0.0.0/32 is subnetted, 1 subnets
    O       4.4.4.4 [110/65] via 24.1.1.4, 00:04:03, Serial0/1
         24.0.0.0/24 is subnetted, 1 subnets
    C       24.1.1.0 is directly connected, Serial0/1
         12.0.0.0/24 is subnetted, 1 subnets
    C       12.1.1.0 is directly connected, Serial0/0
         13.0.0.0/24 is subnetted, 1 subnets
    R       13.1.1.0 [120/1] via 12.1.1.1, 00:00:27, Serial0/0

    说明:虽然路径是最优的,不过 O       3.3.3.3 [121/129] via 24.1.1.4, 00:04:03, Serial0/1 这条路由条目的AD不需要修改才对,所以此方法不是最好的方法

    方法三、精准抓取需要修改AD的路由条目对它进行修改(最好的方法)

    R2(config)#access-list 1 permit 1.1.1.1 0.0.0.0
    R2(config)#access-list 1 permit 13.1.1.0 0.0.0.255
    R2(config)#router ospf 1
    R2(config-router)#distance 121 3.3.3.3 0.0.0.0 1

    (只针对3.3.3.3通告的1.1.1.0和13.1.1.0路由将AD改为121,对3.3.3.3通告的其它路由AD不变)

    R3(config)#access-list 1 permit 1.1.1.1 0.0.0.0
    R3(config)#access-list 1 permit 12.1.1.0 0.0.0.255
    R3(config)#router ospf 1
    R3(config-router)#distance 121 2.2.2.2 0.0.0.0 1

    (只针对2.2.2.2通告的1.1.1.0和12.1.1.0路由将AD改为121,对2.2.2.2通告的其它路由AD不变)

    查看R2的路由条目可见其他ospf路由条目的AD并未改变,是最好的方法
    R2#show ip route

         34.0.0.0/24 is subnetted, 1 subnets
    O       34.1.1.0 [110/128] via 24.1.1.4, 00:03:21, Serial0/1
         1.0.0.0/32 is subnetted, 1 subnets
    R       1.1.1.1 [120/1] via 12.1.1.1, 00:00:06, Serial0/0
         2.0.0.0/32 is subnetted, 1 subnets
    C       2.2.2.2 is directly connected, Loopback0
         3.0.0.0/32 is subnetted, 1 subnets
    O       3.3.3.3 [110/129] via 24.1.1.4, 00:03:21, Serial0/1
         4.0.0.0/32 is subnetted, 1 subnets
    O       4.4.4.4 [110/65] via 24.1.1.4, 00:03:21, Serial0/1
         24.0.0.0/24 is subnetted, 1 subnets
    C       24.1.1.0 is directly connected, Serial0/1
         12.0.0.0/24 is subnetted, 1 subnets
    C       12.1.1.0 is directly connected, Serial0/0
         13.0.0.0/24 is subnetted, 1 subnets
    R       13.1.1.0 [120/1] via 12.1.1.1, 00:00:08, Serial0/0

    方法四、还可以通过为OSPF设置外部路由的管理距离来解决,

    只要将外部路由的管理距离增大到超过重分布进来的协议的AD就可以了

    R2(config)#router ospf 1

    R2(config-router)#distance ospf external 121 inter-area 110 intra-area 110

    R3(config)#router ospf 1

    R3(config-router)#distance ospf external 121 inter-area 110 intra-area 110

    此方法将rip重分发为ospf的路由(external )的管理距离修改为121,

    域间路由(external )和域内路由(intra-area)管理距离仍为110
    ---------------------
    作者:Mr_Bei
    来源:CSDN
    原文:https://blog.csdn.net/mr_bei/article/details/83687742
    版权声明:本文为博主原创文章,转载请附上博文链接!

  • 相关阅读:
    VS 2008潜在强大的功能:提取EXE文件中的ICO等资源
    园友们注意:淘宝网上QQ会员 4钻 3元 等都为骗子行为
    Comet Async Process Request Handler
    WCF(Sender) to MSMQ to WCF(Receiver)
    ASP.NET Web Form GridView DetailsView Query Edit
    WCF NetTcp AsyncQueue Service
    Xml CDATA 序列化
    Sync Invoke Remoting Async Invoke
    .Net 4.0 Remoting ConcurrentQueue
    Socket Async Receive Data to LinkedList Buffer (telnet proxy server)
  • 原文地址:https://www.cnblogs.com/xiaomai-rhce/p/10606300.html
Copyright © 2011-2022 走看看