cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
737
Views
1
Helpful
7
Replies

OSPF inject default route of route not in the table

Sam-CCNP
Level 1
Level 1

Hi,

I am doing a lab and was wondering if there is a way of injecting a default route into OSPF if a route doesn't exist in the routing tables. I know this can be done using object tracking but I wanted to try it with route maps, however, it does not appear to be working. My config is as follows:

ip route 0.0.0.0 0.0.0.0 Null0
!
!
ip access-list standard R1-LO3
permit 3.0.0.0 0.255.255.255
!
!
route-map R2-DEFAULT-ROUTE deny 10
match ip address R1-LO3
!
route-map R2-DEFAULT-ROUTE permit 20
!
!
router ospf 1
default-information originate route-map R2-DEFAULT-ROUTE

Any help will be appreciated.

Sam

7 Replies 7

marce1000
VIP
VIP

 

 - Could you try this configuration instead :

ip route 0.0.0.0 0.0.0.0 Null0
!
ip access-list standard R1-LO3
permit 3.0.0.0 0.255.255.255
!
route-map R2-DEFAULT-ROUTE deny 10
!
route-map R2-DEFAULT-ROUTE permit 20
!
router ospf 1
default-information originate route-map R2-DEFAULT-ROUTE

 M.



-- Each morning when I wake up and look into the mirror I always say ' Why am I so brilliant ? '
    When the mirror will then always repond to me with ' The only thing that exceeds your brilliance is your beauty! '

Hello
One way you can do is use the "always" keyword, most applicable when you have a stub network downstrean and the only way external is via the rtr you are advertsing the default from.

router ospf 1

default-information originate route always


Please rate and mark as an accepted solution if you have found any of the information provided useful.
This then could assist others on these forums to find a valuable answer and broadens the community’s global network.

Kind Regards
Paul

If the router is abr or internal then you can use keyword always 

If it asbr you need defualt route in RIB before ospf can advertise it

Now route-map with default originate I think it use to set tag (set metric and type can direct config no need route-map for set it)

AND

AND 

For case 1 using always you can use route map to conditional advertise defualt if OTHER prefix appeat in RIB'

So your lab

Remove defualt route to null0

Add new any static route 

Add always to defualt command 

Make route-map checking  the static route of it appear in rib or not

https://community.cisco.com/t5/networking-knowledge-base/conditional-default-route-advertisement-in-ospf/ta-p/3145600

If you use route-map to track  with default information it useless no meaning and the router ignore it

https://learningnetwork.cisco.com/s/question/0D53i00000Kt0uyCAB/how-does-the-ospf-defaultinformation-originate-with-tracking-work

Giuseppe Larosa
Hall of Fame
Hall of Fame

Hello @Sam-CCNP ,

the use of a route-map in default-originate is to check some conditions that should be met to inject the default route in OSPF domain.

Your route-map logic contains a deny statement as first block that is matched if a route in 3.0.0.0/8 is present in the routing table. As a result of this no default route is injected in the routing table.

If you shut down the loopback with that IP address and no other route matches the first route-map block the second route-map block/clause with permit action is used and the default route is generated.

Try to test shutting down that loopback and see what happens.

Hope to help

Giuseppe

 

Hi Giuseppe,

Thank you for responding, I did indeed shut the Loopback 3 R1 down, however, the default route is still not advertised - which is why it doesn't seem to work:

! R2's routing table:
R2#sh ip route 3.0.0.0 255.0.0.0
% Network not in table

! No type-5 default route is being advertised

R2#sh ip ospf database external

OSPF Router with ID (23.1.1.2) (Process ID 1)
R2#

! Also confirmed on R3, which is R2's OSPF neighbor:

R3#sh ip route

Gateway of last resort is not set

23.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 23.1.1.0/24 is directly connected, GigabitEthernet0/2
L 23.1.1.3/32 is directly connected, GigabitEthernet0/2

So, to test the opposite - i.e. the default route is only injected if 3.0.0.0 is present - I changed route-map R2-DEFAULT-ROUTE deny 10 to route-map R2-DEFAULT-ROUTE permit 10

And it worked. The default route was only injected into the OSPF area when the 3.0.0.0/8 was present in the routing tables.

It seems to me that checking for missing routes using route-maps and access-lists as a condition for advertising a default route doesn't work. I know there are other ways to achieve this, but I wanted to try this way.

Hello @Sam-CCNP ,

to be honest I had always used a positive logic with permit statements in route-maps used with default-originate I see when moving to a positive logic it works as expected

>> The default route was only injected into the OSPF area when the 3.0.0.0/8 was present in the routing tables.

Thanks for your feedback

Best Regards

Giuseppe

 

Gopinath_Pigili
Spotlight
Spotlight

Hello Sam-CCNP,

can you try with prefix-list...instead of ACL...might helpful....?

ip route 0.0.0.0 0.0.0.0 Null0
!
!
ip prefix-list list-1 permit 3.0.0.0/8
!
!
route-map R2-DEFAULT-ROUTE deny 10
match ip address prefix-list list-1
!
route-map R2-DEFAULT-ROUTE permit 20
!
!
router ospf 1
default-information originate route-map R2-DEFAULT-ROUTE

check...will it make any difference...

Best regards
******* If This Helps, Please Rate *******

 

Review Cisco Networking for a $25 gift card