关于import-route static 和default-route-advertise区别知识总结

一、相关解释

import-route static  命令不能引入外部路由的默认路由,OSPF通过路由表更新学习到外部路由的默认路由,

如果外部路由的默认路由需要在OSPF普通区域中发布,需要执行default-route-advertise 命令。

在正常情况下,构建OSPF协议运行体系,在外围网络设备中,对外部路由的注入OSPF,有两种独立的方法:

静态路由的引入用 import-route static,而默认路由用 default-route-advertise 引入,执行的位置都是在OSPF里。

    这里需要注意的是,当外网特别不稳定时,防止OSPF反复计算,可设置 default-route-advertise always,其实就是管您外网状况如何,我当您正常并一直运行。

        ***  别纠结,他这样做应该是研发人员碰到的不得已的问题,只能区别对待这两种情况,相对于对静态路由,为默认路由 0.0.0.0  0.0.0.0单独设计了一条命令,有点奢侈。:)

      在网上收集到网友这样的解释,我认为是说的通的:协议设计上的规定,用来防范意外环路的。防止引入静态路由时注入默认路由,产生环路

二、相关验证

1.ENSP模型

2.基本配置

工作站IP地址配置,路由器接口配置,交换机vlan配置,vlan的虚接口IP地址配置

R1配置

#
interface GigabitEthernet0/0/0
ip address 192.168.20.254 255.255.255.0
#
interface GigabitEthernet2/0/0
ip address 192.168.19.1 255.255.255.0

R9配置

#
interface GigabitEthernet0/0/0
ip address 192.168.19.9 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 192.168.95.9 255.255.255.0

ip route-static 0.0.0.0 0.0.0.0 192.168.19.1  //末端路由器的默认路由配置

交换机配置

vlan batch 10 95

#
interface Vlanif10
ip address 192.168.50.254 255.255.255.0
#
interface Vlanif95
ip address 192.168.95.10 255.255.255.0

3.OSPF配置

R1配置

#
ospf 1 router-id 20.1.1.0
area 0.0.0.20
network 192.168.12.0 0.0.0.255
network 192.168.13.0 0.0.0.255
network 192.168.19.0 0.0.0.255
network 192.168.20.0 0.0.0.255

R9配置

#
ospf 1 router-id 20.1.9.0
default-route-advertise   //这一条命令就是针对R9的默认路由的,将默认路由注入OSPF,并通过LSA报文传给其他相关方
area 0.0.0.20
network 192.168.19.0 0.0.0.255
network 192.168.95.0 0.0.0.255

交换配置

#
ospf 1 router-id 20.1.10.0
area 0.0.0.20
network 192.168.95.0 0.0.0.255
network 192.168.50.0 0.0.0.255

4.连通测试

[R9]dis ospf lsdb

OSPF Process 1 with Router ID 20.1.9.0
Link State Database

Area: 0.0.0.20
Type LinkState ID AdvRouter Age Len Sequence Metric
Router 20.1.9.0 20.1.9.0 1103 48 8000000D 1
Router 20.1.10.0 20.1.10.0 1060 48 80000005 1
Router 20.1.1.0 20.1.1.0 659 72 8000000E 1
Network 192.168.95.9 20.1.9.0 1103 32 80000002 0
Network 192.168.19.1 20.1.1.0 659 32 80000003 0

AS External Database

Type LinkState ID AdvRouter Age Len Sequence Metric
External 0.0.0.0 20.1.9.0 1438 36 80000001 1
External 192.168.40.0 30.3.70.0 1541 36 80000002 1

[SW1]dis ospf lsdb

OSPF Process 1 with Router ID 20.1.10.0
Link State Database

Area: 0.0.0.20
Type LinkState ID AdvRouter Age Len Sequence Metric
Router 20.1.9.0 20.1.9.0 1273 48 8000000D 1
Router 20.1.10.0 20.1.10.0 1227 48 80000005 1
Router 20.1.1.0 20.1.1.0 829 72 8000000E 1
Network 192.168.95.9 20.1.9.0 1273 32 80000002 0
Network 192.168.19.1 20.1.1.0 829 32 80000003 0

AS External Database
Type LinkState ID AdvRouter Age Len Sequence Metric
External 0.0.0.0 20.1.9.0 1607 36 80000001 1   //通过协议,其它设备已经学到的。
External 192.168.40.0 30.3.70.0 1710 36 80000002 1

PC>ipconfig

Link local IPv6 address...........: fe80::5689:98ff:fefe:445a
IPv6 address......................: :: / 128
IPv6 gateway......................: ::
IPv4 address......................: 192.168.20.1
Subnet mask.......................: 255.255.255.0
Gateway...........................: 192.168.20.254
Physical address..................: 54-89-98-FE-44-5A
DNS server........................:

PC>ping 192.168.50.1  //连通测试正常

Ping 192.168.50.1: 32 data bytes, Press Ctrl_C to break
Request timeout!
From 192.168.50.1: bytes=32 seq=2 ttl=125 time=63 ms
From 192.168.50.1: bytes=32 seq=3 ttl=125 time=31 ms
From 192.168.50.1: bytes=32 seq=4 ttl=125 time=62 ms
From 192.168.50.1: bytes=32 seq=5 ttl=125 time=47 ms

--- 192.168.50.1 ping statistics ---
5 packet(s) transmitted
4 packet(s) received
20.00% packet loss
round-trip min/avg/max = 0/50/63 ms

关于import-route static 和default-route-advertise区别知识总结的更多相关文章

  1. 002 static and default route

    r2(config)#ip route 192.168.1.0 255.255.255.0 192.168.2.1 r1(config)#ip route 192.168.3.0 255.255.25 ...

  2. Default route and zero route

    A default route of a computer that is participating in computer networking is the packet forwarding ...

  3. FreeBSD Set a Default Route / Gateway

    Task: View / Display FreeBSD Routing Table Use netstat command with -r option:$ netstat -r$ netstat ...

  4. Part 28 AngularJS default route

    At the moment the problem is that, if you try to navigate to a route that is not configured, you wil ...

  5. 路由传值及获取参数,路由跳转,路由检测,this.$route.query和this.$route.params接收参数,HttpGet请求拼接url参数

    配置动态路由参数id: routes: [ // 动态路径参数 以冒号开头 { path: '/user/:id', component: User } ] html路由跳转: <router- ...

  6. Difference Between static and default methods in interface

    I was learning through interfaces when I noticed that you can now define static and default methods ...

  7. ES6:export default 和 export 区别

    export default 和 export 区别: 1.export与export default均可用于导出常量.函数.文件.模块等 2.你可以在其它文件或模块中通过import+(常量 | 函 ...

  8. Java中static final 与 final 的区别(转载)

    转自:http://advance0683.iteye.com/blog/1107732 Java中static final 与 final 的区别: 例子: Java代码 import java.u ...

  9. import,reload,__import__在python中的区别

    import,reload,__import__在python中的区别 http://blog.csdn.net/five3/article/details/7762870 import作用:导入/引 ...

  10. PHP中new static()与new self()的区别异同分析

    本文实例讲述了PHP中new static()与new self()的区别异同,相信对于大家学习PHP程序设计能够带来一定的帮助. 问题的起因是本地搭建一个站.发现用PHP 5.2 搭建不起来,站PH ...

随机推荐

  1. 免杀之:Mimikatz 免杀过杀软,思路学习

    免杀之:Mimikatz 免杀过杀软 目录 免杀之:Mimikatz 免杀过杀软 1 环境准备 2 处理过程 2.1 生成原始的Mimikatz程序 2.2 定位到代码或字符串上特征绕过 2.3 定位 ...

  2. C#泛型接口请求封装类

    using HttpUtil; using Newtonsoft.Json; using System; using System.Collections.Generic; using System. ...

  3. vs修改默认端口

    1.右键项目属性进去修改 2.,用txt打开sln解决方案,框框中的就是你当前的端口号

  4. element-ui/lib/style.css in ./src/main.js 解决方案

    在node_modules 中    找到element-ui/lib路径 创建style.css文件   就好了

  5. PostgreSQL数据库切割和组合字段函数

    Postgresql里面内置了很多的实用函数,下面介绍下组合和切割函数一.组合函数1.concata.语法介绍 concat(str "any" [, str "any& ...

  6. LeetCode-798 得分最高的最小论调 及差分和前缀和的学习

    来源:力扣(LeetCode)链接:https://leetcode-cn.com/problems/smallest-rotation-with-highest-score 题目描述 给你一个数组  ...

  7. redis 集群配置(从0到1)

    1.关闭配置文件 appendonly yes改为no 2.到redis目录下拷贝redis.conf文件 cp ./redis.conf ./7001/ cp ./redis.conf ./7002 ...

  8. USACO2023Feb游记

    由于学校要求,过来打 USACO. 由于上次已经打到白金了,所以继续. 然后还是 AK 了. 感觉题意很迷惑,所以都翻译一下. Hungry Cow Bessie 很饿,每天晚饭如果有干草就会吃 \( ...

  9. python发送钉钉消息通用脚本

    1.使用shell生成需要发送的内容. 2.调用该脚本发送文本内容python3,其中的文件 /wj/sbjk,需要改成直接需要发送的文件. [root@manager dingding]# more ...

  10. P1046 [NOIP2005 普及组] 陶陶摘苹果

    题目描述 陶陶家的院子里有一棵苹果树,每到秋天树上就会结出 10 个苹果.苹果成熟的时候,陶陶就会跑去摘苹果.陶陶有个 30厘米高的板凳,当她不能直接用手摘到苹果的时候,就会踩到板凳上再试试. 现在已 ...