cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
938
Views
20
Helpful
2
Replies

Route-map could not match default route by tag

Dan22
Level 1
Level 1

Hello,

May I ask a question regarding default route redistribution from BGP to OSPF?

Below is the topology. R1(AS 10000) and R2(AS 10001) run eBGP. R1 advertised default route to R2.

R2 and R3 run OSPF. 

Image 8.png

On R2, the default route is as following.

Router(config-router)#do sh ip route 0.0.0.0
Routing entry for 0.0.0.0/0, supernet
Known via "bgp 10001", distance 20, metric 0, candidate default path
Tag 10000, type external
Last update from 192.168.0.1 00:02:03 ago
Routing Descriptor Blocks:
* 192.168.0.1, from 192.168.0.1, 00:02:03 ago
Route metric is 0, traffic share count is 1
AS Hops 1
Route tag 10000
MPLS label: none

 

I have a route-map configured in R2 to match the default route. If default route advertised from BGP is matched, R2 will add default route in OSPF.

 

I found it did not work if only tag was used in route-map. BGP default route could not be matched with below.

    route-map DEF permit 10
    match tag 10000

Working one needs to add prefix like below.

    ip prefix-list PRE_DEF seq 5 permit 0.0.0.0/0
    !
    route-map DEF permit 10
    match ip address prefix-list PRE_DEF
    match tag 10000

 

My question is why the default could not be match only with tag.

 

The full configuration of R1-3 is as following.

#R1
interface Loopback0
ip address 10.0.0.1 255.255.255.255

interface Ethernet0/0
ip address 192.168.0.1 255.255.255.0

router bgp 10000
bgp router-id 10.0.0.1
bgp log-neighbor-changes
network 0.0.0.0
neighbor 192.168.0.2 remote-as 10001

ip route 0.0.0.0 0.0.0.0 Null0


#R2
interface Loopback0
ip address 10.0.0.2 255.255.255.255
!
interface Ethernet0/0
ip address 192.168.0.2 255.255.255.0
!
interface Ethernet0/1
ip address 192.168.23.1 255.255.255.0
ip ospf 1 area 0

router ospf 1
default-information originate route-map DEF
!
router bgp 10001
bgp router-id 10.0.0.2
bgp log-neighbor-changes
neighbor 192.168.0.1 remote-as 10000
!
!
ip prefix-list PRE_DEF seq 5 permit 0.0.0.0/0
!
route-map DEF permit 10
match ip address prefix-list PRE_DEF
match tag 10000

#R3
interface Ethernet0/0
ip address 192.168.23.2 255.255.255.0
ip ospf 1 area 0

router ospf 1

 

Thanks a lot.

Dan

 

1 Accepted Solution

Accepted Solutions

Giuseppe Larosa
Hall of Fame
Hall of Fame

Hello Dan,

matching BGP learned prefixes on route tags is not supported in route-maps used for redistribution of BGP into IGP.

So my guess is that adding the match address prefix allows the router to have a valid match even if your route-map is not used for redstribution but just to check the existance of a default route in the IP routing table.

In a case like yours I have match ip next-hop <ACL-number> to check the BGP next-hop of the route.

Where the ACL simply match the IP address of eBGP next-hop.

This worked fine. In my case I had a need to create a default route in OSPF with a different seed metric depending on what eBGP peer was providing the eBGP default route and I solved in this way.

 

Hope to help

Giuseppe

 

View solution in original post

2 Replies 2

Giuseppe Larosa
Hall of Fame
Hall of Fame

Hello Dan,

matching BGP learned prefixes on route tags is not supported in route-maps used for redistribution of BGP into IGP.

So my guess is that adding the match address prefix allows the router to have a valid match even if your route-map is not used for redstribution but just to check the existance of a default route in the IP routing table.

In a case like yours I have match ip next-hop <ACL-number> to check the BGP next-hop of the route.

Where the ACL simply match the IP address of eBGP next-hop.

This worked fine. In my case I had a need to create a default route in OSPF with a different seed metric depending on what eBGP peer was providing the eBGP default route and I solved in this way.

 

Hope to help

Giuseppe

 

Hello Giuseppe,

Thanks for your comment.

I tried to modify this case.

This time I added a static default on R2.

#R2:

ip route 0.0.0.0 0.0.0.0 Null0

 

So the static route is loaded in the routing table. No tag is attached.

#R2:

Router(config)#do sh ip route 0.0.0.0
Routing entry for 0.0.0.0/0, supernet
Known via "static", distance 1, metric 0 (connected), candidate default path
Routing Descriptor Blocks:
* directly connected, via Null0
Route metric is 0, traffic share count is 1

 

Then the default route is not added in OSPF.

R3:

Router#sh ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
a - application route
+ - replicated route, % - next hop override

Gateway of last resort is not set

192.168.23.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.23.0/24 is directly connected, Ethernet0/0
L 192.168.23.2/32 is directly connected, Ethernet0/0

 

So it looks like matching BGP learned prefixes only on route tags is not supported in route-maps used for redistribution of BGP into IGP. But it could be used together with prefix.

 

Is it a design behavior of Cisco router?

 

BR,
Dan

 

 

Review Cisco Networking for a $25 gift card