cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
26317
Views
20
Helpful
3
Comments
ashirkar
Level 7
Level 7

 

Introduction

Cisco device uses “default-information originate” statement to generate a default route in OSPF domain. There are two ways to originate default route by using this command:

1) When you configure “default-information originate”  under OSPF process  without any argument after this statement, OSPF process will  first check,if any default route is already present in routing table. If a default route is already present in routing table via static or any dynamic protocol, OSPF originate default route. If default route does not exist in routing table, OSPF will not originate default route.

2)This behavior can be modified by adding "always" argument to the "default-infomation orginate" statement,which essentially skips the checking for a default route already being installed in the table.

 

This document discuss about conditional route origination in OSPF domain. Conditional default route in OSPF originate by using route-map in default-information command under router OSPF process. The route map configured in the default-information originates command check the existing IP prefixes in the IP routing table.

Configuration steps:

1) prefix-list or access-list: To originate default route only when necessary prefixes are present in routing table.First you need to match these prefixes by configuring prefix-list or access-list.

Example:

Prefix-list configuration:

Router (config)#ip prefix-list Default_route sequence 10 permit 192.168.1.0/24

 

Access-list configuration:

Router(config)#ip access-list standard Default_route

Router(config-std-nacl)# permit 192.168.1.0 0.0.0.255

 

2) Attach prefix-list or access-list in route map:

Example:

Router(config)#route-map Ospf_default permit 10

Router(config-route-map)#match ip address prefix-list Default_route

Router(config-route-map)#exit

 

3) Configure “default-information originate always route-map” statement:

Example:

Router(config)#router ospf 100

Router(config-router)#default-information originate always route-map Ospf_default 

 

Background:

In the below topology R1 is connected to two ISP using serial interface. The router R1 and R2 runs OSPF in Area 0, where R1 is advertising default route to R2 only when both serial links are up. Once both link goes down R1 should withdraw default route from OSPF domain.

 

Topology Diagram:

 

OSPF_CONDITION.jpg

 

 

Configuring R1:

R1(config)#ip prefix-list default_route sequence 10 permit 192.168.1.0/24

R1(config)#ip prefix-list default_route sequence 20 permit 192.168.2.0/24

R1(config)#route-map ospf_default permit 10

R1(config-route-map)#match ip add prefix-list default_route

R1(config-route-map)#exit

R1(config)#router ospf 100

R1(config-router)#default-information originate always route-map ospf_default

R1(config-router)#exit

 

R1 advertise a default route to OSPF domain, as both ISP links are up.

 

Verifying default route on R2

R2#sh ip ospf database | in 0.0.0.0

0.0.0.0         192.168.2.1     371         0x80000001 0x0018CA 100

 

R2#sh ip route ospf

O*E2 0.0.0.0/0 [110/1] via 10.1.1.1, 00:06:22, FastEthernet0/0

 

We need at least one prefix match in list present in R1’s routing table to advertise default route in OSPF domain.

Disabling one link towards ISP1:

R1(config)#int s0/0

R1(config-if)#sh

*Mar  1 00:17:09.971: %LINK-5-CHANGED: Interface Serial0/0, changed state to administratively down

*Mar  1 00:17:10.971: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to down

 

Verification on R2:

R2#sh ip route ospf

O*E2 0.0.0.0/0 [110/1] via 10.1.1.1, 00:10:30, FastEthernet0/0

 

Disabling remaining link towards ISP2:

Verification on R2:

R1(config-if)#int s0/1

R1(config-if)#sh

R1(config-if)#

*Mar  1 00:18:39.131: %SYS-5-CONFIG_I: Configured from console by console

*Mar  1 00:18:39.731: %LINK-5-CHANGED: Interface Serial0/1, changed state to administratively down


Turned on debug in R2 to get closer view of default route deletion

R2#debug ip routing

IP routing debugging is on

*Mar  1 00:19:25.799: RT: del 0.0.0.0 via 10.1.1.1, ospf metric [110/1]

*Mar  1 00:19:25.803: RT: delete network route to 0.0.0.0

*Mar  1 00:19:25.803: RT: NET-RED 0.0.0.0/0

*Mar  1 00:19:25.803: RT: NET-RED 0.0.0.0/0

 

R2#sh ip route ospf

R2#


From the above output it is clear that when the both links connected to ISP goes down, router R1 stop generation of default route to OSPF domain.

Related Information

How to inject a default route into OSPF
How Does OSPF Generate Default Routes?

Verifying default route on R2

Comments

once route-map argument used, having a static route already existing in routing table is no longer required to announce an OSPF default route?

In order to withdraw the default route when the upstream link goes down, is it better to use static default with IP SLA instead of route-map?

marcuslover1
Level 1
Level 1

I am searching this document only for my Routing exam

Thanks Ashish for sharing the same

cparish17
Level 1
Level 1

Not sure how to post a new question.. so I'll try here.

I have a router running ospf and BGP. I'm trying to establish the following behavior regarding the default route:
If we learn default from OSPF neighbor, install in routing table
ELSE
If we learn default from BGP, install into routing table and inject into OSPF.
ELSE
inject default from static into routing table.

I'm using "network 0.0.0.0 backdoor" to prefer the ospf route over bgp.
Static route has AD of 210, so BGP preferred over static.

I'm unable to inject default into the routing table. Using a route-map to try to conditionally inject the route:

router ospf 100
default-information originate metric 3000 route-map ospf_def

route-map ospf_def permit 10
description learning quad0 from VSAT
match source-protocol static
set metric 5000
set tag 1010007
!
route-map ospf_def permit 30
description default route from BGP
match source-protocol bgp 65036
set metric 100
!
route-map ospf_def deny 100
!
Not getting the default route into OSPF.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Review Cisco Networking for a $25 gift card