zoukankan      html  css  js  c++  java
  • OSPF路由汇总和默认路由设置

    目标
    掌握OSPF路由汇总的配置
    掌握OSPF默认路由的配置

    一、——区域间汇总
    配置IP,R2四个环回口
    R1(config)#inter s1/0
    R1(config-if)#ip add 200.1.1.1 255.255.255.0
    R1(config-if)#no shut
    R1(config-if)#inter lo 1
    R1(config-if)#ip add 1.1.1.1 255.255.255.0
    R1(config-if)#ip ospf network point-to-p

    R2(config)#inter s1/0
    R2(config-if)#ip add 200.1.1.2 255.255.255.0
    R2(config-if)#no shut
    R2(config)#inter lo 1
    R2(config-if)#ip add 172.16.0.1 255.255.255.0
    R2(config-if)#inter lo 2
    R2(config-if)#ip add 172.16.1.1 255.255.255.0
    R2(config-if)#inter lo 3
    R2(config-if)#ip add 172.16.2.1 255.255.255.0
    R2(config-if)#inter lo 4
    R2(config-if)#ip add 172.16.3.1 255.255.255.0

    查看下接口信息
    R2#show ip inter brief

    2、启用OSPF路由协议
    R1(config)#router ospf 100
    R1(config-router)#network 200.1.1.0 0.0.0.255 a 0
    R1(config-router)#network 1.1.1.0 0.0.0.255 a 1

    R2(config)#router ospf 100
    R2(config-router)#network 200.1.1.0 0.0.0.255 a 0
    R2(config-router)#network 172.16.0.0 0.0.255.255 a 2(直接宣告在主类网络中)

    查看路由(会收到四条OIA区域间的路由)
    R1#show ip rou

    因为R2路由是一台ABR。所以需要在上面手工汇总
    R2(config)#router ospf 100(进入OSPF进程)
    R2(config-router)#area 2 range 172.16.0.0 255.255.252.0 ?
      advertise      Advertise this range (default)
      cost           User specified metric for this range
      not-advertise  DoNotAdvertise this range
      <cr>
    R2(config-router)#area 2 range 172.16.0.0 255.255.252.0

    查看汇总之后的
    R1#show ip rou

    R1#ping 172.16.1.1
    R1#ping 172.16.2.1
    R1#ping 172.16.3.1

    二、——外部汇总
    查看OSPF的配置
    R2#show run | b r o

    R2(config)#router ospf 100
    R2(config-router)#no area 2 range 172.16.0.0 255.255.252.0
    R2(config-router)#no network 172.16.0.0 0.0.255.255 area 2

    查看路由(已经没有区域间的汇总)
    R1#show ip rou

    R2(config)#router ospf 100
    R2(config-router)#redistribute connected subnets

    查看路由
    R1#show ip rou

    R1#show ip ospf border-routers

    在R2上做一个外部汇总
    R2(config)#router ospf 100
    R2(config-router)#summary-address ?
      A.B.C.D  IP summary address
    R2(config-router)#summary-address 172.16.0.0 255.255.252.0 ?
      not-advertise  Do not advertise when translating OSPF type-7 LSA
      tag            Set tag
      <cr>
    R2(config-router)#summary-address 172.16.0.0 255.255.252.0 tag ?
      <0-4294967295>  32-bit tag value
    R2(config-router)#summary-address 172.16.0.0 255.255.252.0 tag 88

    查看路由
    R1#show ip rou

    R1#show ip ospf database external

    三、——OSPF的默认路由
    关掉手工汇总
    R2(config-router)#no summary-address 172.16.0.0 255.255.252.0

    首先需要宣告一条默认路由
    R2(config-router)#default-information originate
    然后在R1上查看是否存一条默认路由
    R1#show ip rou(但是没有效果)

    查看OSPF的配置
    R2(config-router)#do show run | b r o (可以看到确实已经配置,但是R1为什么学习不到默认路由呢?答:配置上面那条命令的前提是自己有一条默认的路由)

    可以查看是否有
    R2(config-router)#do show ip rou(没有)

    做个实验,指向NULL接口
    R2(config)#ip route 0.0.0.0 0.0.0.0 null 0

    这时候R2已经有了默认路由
    R2#show ip rou

    R1#show ip rou(会出现一条O*E2的默认路由)

    2、删掉默认路由,强制宣告到R1中
    R2(config)#no ip route 0.0.0.0 0.0.0.0 null 0
    R1#show ip rou(已经没有)
    R2(config)#router ospf 100
    R2(config-router)#no default-information originate

    R2(config-router)#default-information originate always

    R1#show ip rou(又会出现宣告的默认路由)

    扩展(可参考PPT最后)
    当有多路由时,手工指定度量值
    ROUTER OSPF 100
    NETWORK 10.1.1.1 0.0.0.0 AREA 0
    default-information originate METRIC 10
    IP ROUTE 0.0.0.0 0.0.0.0 198.1.1.2

    R2
    ROUTER OSPF 100
    NETWORK 10.2.1.1 0.0.0.0 AREA 0
    default-information originate METRIC 100
    IP ROUTE 0.0.0.0 0.0.0.0 198.2.1.2

  • 相关阅读:
    再回首Java第二十五天
    再回首Java第二十四天
    再回首Java第二十三天
    再回首Java第二十二天
    再回首Java第二十一天
    再回首Java第二十天
    jquery 中将日期时间类型转化成想要的格式
    JavaEE体系架构概述、MyBatis总结
    自动轮播
    html基础
  • 原文地址:https://www.cnblogs.com/ywj2013/p/3299322.html
Copyright © 2011-2022 走看看