华为 路由策略

来源:互联网 发布:怎样关闭淘宝网店 编辑:程序博客网 时间:2024/06/18 09:44




1、建立完成后各路由无法互访
   ①R1静态路由,再指一条0.0.0.0到R2
   [R1]ip route-static 0.0.0.0 0 12.1.1.2
   注:ping 3.3.3.3                  //无法ping通
       ping -a 1.1.1.1 3.3.3.3     //才能pinp通
       ping -i LoopBack 0 3.3.3.3  //或-i 带接口
   ②R2将直连和rip路由引入ospf中
   [R2-ospf-1]import-route static cost 25               //为了更直观给引入的静态路由加上cost值
   [R2-ospf-1]import-route direct type 1 cost 10    //引入直连,类型为1,并加上cost值(默认类型2,不叠加cost值)
     现在R1可以直接ping通R3了
   这样把rip的直连路由也做进来了,需做策略去除rip的直连路由



路由策略 (先删除掉之前引入的直连路由)
   
R2:
   route-policy StoO permit node 10                // StoO为命名;node 10 为节点
    if-match interface GigabitEthernet0/0/0        
    apply cost 15                                         // 修改cost值  
    apply cost-type type-1                         // 类型为1型
    
    在ospf中引入路由策略:
    [R2-ospf-1]import-route direct route-policy StoO   //direct为直连



二:将R3中的rip路由引入到R2中并做策略

      R2中引入的路由条目:
        4.4.4.4/32  RIP     
     172.16.0.0/24  RIP     
     172.16.1.0/25  RIP     
     172.16.2.0/26  RIP     
     172.16.3.0/27  RIP     
     172.16.4.0/28  RIP     
     172.16.5.0/29  RIP     
     172.16.6.0/30  RIP     
     172.16.7.1/32  RIP

  [R2]ip ip-prefix RtoO index 5 permit 172.16.0.0 16 less-equal 29
   //RtoO:命名  ; index 5 条目为5;16:为网络长度;less-equal 29  小于或等于29的掩码长度

  [R2]route-policy RtoO permit node 10    //此RtoO和上面的RtoO为不同的命名,属于不同的策略
      if-match ip-prefix RtoO             //若匹配 ip-prefix RtoO
      apply cost 100                      //执行以下的命令
      apply cost-type type-1   

 [R2-ospf-1]import-route rip route-policy RtoO   //在ospf里面调用策略

     查看:
  [R2-ospf-1]dis ip ip-prefix
   Prefix-list RtoO
   Permitted 6
   Denied 3
        index: 5                permit  172.16.0.0/16           ge  16  le  29


策略没通过的路由执行 其它命令
 [R2-route-policy]
 route-policy RtoO permit node 10
 if-match ip-prefix RtoO
 apply cost 100
 apply cost-type type-1

#
route-policy RtoO permit node 20
 apply cost 333                    //cost值为333
#





0 0
原创粉丝点击