目标
掌握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

OSPF路由汇总和默认路由设置的更多相关文章

  1. Network基础(五):配置静态路由、配置浮动路由、配置多路由的静态路由、配置默认路由

    一.配置静态路由 目标: 配置路由接口IP地址并通过静态路由的配置实现全网的互通. 方案: 按如下网络拓扑配置接口IP地址并通过静态路由的配置实现全网的互通如下图所示: 步骤: 步骤一:配置静态路由 ...

  2. OSPF路由汇总

    转载自红茶三杯博客:http://blog.sina.com.cn/s/blog_5ec353710102vtfy.html 1. 关于路由汇总 路由汇总,又被称为路由聚合(Route Aggrega ...

  3. EIGRP默认路由分发的四种方法

    方式一:重发布静态 R2(config)#ip route 0.0.0.0 0.0.0.0 s1/1 R2(config)#router eig 10 R2(config-router)#redist ...

  4. centos7网口添加IP,修改默认路由永久地址生效

    1永久增加ip地址和路由 网卡永久添加ip地址 注释:ens192为管理地址网卡,请根据实际情况进行修改,网关以192.168.160.1为例 复制一份网卡配置文件命名为ifcfg-ens192:1 ...

  5. HCNP Routing&Switching之OSPF LSA更新规则和路由汇总

    前文我们了解了OSPF外部路由类型以及forwarding address字段的作用,回顾请参考https://www.cnblogs.com/qiuhom-1874/p/15225673.html: ...

  6. 神州数码OSPF路由汇总配置

    实验要求:掌握OSPF路由汇总配置 拓扑如下 R1 enable 进入特权模式 config 进入全局模式 hostname R1 修改名称 interface s0/1 进入端口 ip addres ...

  7. OSPF的特征、术语、包类型、邻居关系的建立、RID的选择、DR和BDR的选举、度量值的计算、默认路由、验证

    链路状态路由协议OSPF的特征.术语.包类型.邻居关系的建立.RID的选择.DR和BDR的选举.度量值的计算.默认路由.验证等. 文章目录 [*1*].链路状态路由协议概述 工作过程 优缺点 [*2* ...

  8. linux设置默认路由细节问题

    在这里,我想给大家讲解下,linux系统默认路由的设置的一些细节问题.这样在设置多块网卡的时候如何设置路由可以为初学者少走一些弯路.   默认情况下配置多块网卡,每个网卡都要配置ip,每个ip又是在不 ...

  9. 默认路由、RIPv2、OSPF、EIGRP配置(全网全通)

    1:默认路由 遇到问题:给r2配置向右的单项默认路由,通过PC1去ping主机PC2,一直显示Request timed out, 解决方法:r2配置如下: r2(config)#ip route 0 ...

随机推荐

  1. 从Project 2007导出WBS图表到Visio 2007

    微软官网讲:在 Microsoft Office Project 2007 中,Visio WBS 图表向导已被可视报表代替.您可以使用 Microsoft Office Visio Professi ...

  2. CustomProgressBar

    https://github.com/eltld/CustomProgressBar-master

  3. 【JavaScript】JavaScript Promise 探微

    http://www.html-js.com/article/Promise-translation-JavaScript-Promise-devil-details 原文链接:JavaScript ...

  4. linux学习资料

    鸟哥的Linux私房菜 基础学习篇(第三版)    http://book.51cto.com/art/201007/211888.htm 鸟哥的Linux私房菜——服务器架设篇    http:// ...

  5. debian7 编译qtopia错误解决案例

    问题: kernel/qjpegio.cpp:60:21: error: jpeglib.h: No such file or directory 解决 sudo apt-get install li ...

  6. Java再学习——停止一个正在运行的线程

    关于这个问题,先了解一下Thread类方法中被废弃的那些方法.suspend(), resume(),stop()/stop(Throwable obj),destroy() 首先,stop(Thro ...

  7. c++ 设计模式4 (Strategy)

    3.2 Strategy (策略模式) 动机:在软件构建过程中,某些对象使用的算法可能多种多样,经常改变,如果将这些算法都编码到对象中,将会使对象变得异常复杂,而且有时候支持不使用或不常使用的算法也是 ...

  8. tachyon with spark

    spark1.2.0  tachyon0.5.0 jdk1.7 scala2.10.4 1.装好spark.tachyon.jdk.scala 2.修改spark-env.sh添加Tachyon客户端 ...

  9. C#面向对象(二)之抽象类实现多态

    一.什么叫做多态? 统一操作作用于不同类的实例,不同类将进行不同的解释,最后产生不同的执行结果. 简单来说就是统一指令,对于不同的个体会产生不同的行为. 二.如何通过抽象方法实现多态? 1.创建一个基 ...

  10. Blocks 推出矩阵公式。矩阵快速密

    Blocks 设涂到第I块时,颜色A,B都为偶数的数量为ai,一奇一偶的数量为bi,都为奇数为ci,  那么涂到第i+1快时有 a[i+1]=2*a[i]+b[i]+0*c[i]; b[i+1]=2* ...