注:本文为 “OSPF 路由” 相关文章合辑。
配置 OSPF 引入缺省路由
Long_UP 于 2020-08-22 09:34:05 发布
问题:
从路由器上注入一条默认 0/0 路由到 OSPF 中去,只允许用 OSPF 自身的机制,禁止使用静态 0/0 再分发的方法。
解决:
OSPF 不能通过 import-route
命令从其它协议引入缺省路由,如果想把缺省路由引入到 OSPF 路由区域,必须要使用下面命令配置 OSPF 引入缺省路由。
<H3C> system-view
// 进入系统视图
[H3C] ospf
// 进入 OSPF 视图
[H3C-ospf-1] default-route-advertise always
// 缺省情况下,不引入缺省路由
OSPF 路由引入以及缺省路由
许多 123 于 2017-01-16 17:22:44 发布
default-route-advertise
: 当外部路由存在缺省路由时,即引入并在 OSPF 区域内泛洪;
default-route-advertise always:无论是否存在缺省路由,都会生成一条外部路由在 OSPF 区域内泛洪,此种方法为引入缺省路由。
import route
是 ospf 里面引入其他协议的路由(如 static,bgp,rip),不能引入外部的缺省路由。
R2、R3、R4 使用 OSPF 协议,配置如下:
R1
\#
interface Ethernet0/0/0
description to-R2
ip address 10.10.1.1 255.255.255.252
\#
interface LoopBack0
ip address 1.1.1.1 255.255.255.255
\#
ip route-static 0.0.0.0 0.0.0.0 10.10.1.2
\#
R2
\#
interface Ethernet0/0/0
description to-R1
ip address 10.10.1.2 255.255.255.252
\#
interface Ethernet0/0/1
description to-R3
ip address 10.10.2.1 255.255.255.252
ospf authentication-mode md5 1 cipher CM) gG6|w^8pe}@HMNPn@t>a#
ospf network-type p2p
\#
interface LoopBack0
ip address 2.2.2.2 255.255.255.255
ospf enable 1 area 0.0.0.0
\#
ospf 1 router-id 2.2.2.2
import-route static
area 0.0.0.0
network 10.10.1.0 0.0.0.255
network 10.10.2.0 0.0.0.255
\#
ip route-static 1.1.1.1 255.255.255.255 10.10.1.1
\#
R3
\#
interface Ethernet0/0/0
description to-R2
ip address 10.10.2.2 255.255.255.252
ospf authentication-mode md5 1 cipher mokG=CKHnX+/Y@:Y>Lw (Q~##
ospf network-type p2p
\#
interface Ethernet0/0/1
description to-R4
ip address 10.10.3.1 255.255.255.252
\#
interface LoopBack0
ip address 3.3.3.3 255.255.255.255
ospf enable 2 area 0.0.0.0
\#
ospf 2 router-id 3.3.3.3
area 0.0.0.0
network 10.10.2.0 0.0.0.3
network 10.10.3.0 0.0.0.3
\#
R4