IOS to Junos (I2J) Tips
IOS to Junos (I2J) Tips

BGP inject-map exists-map

[ Edited ]
‎04-29-2012 12:29 PM

 

  Hi All.

  This time a nice bgp configuration. Every time you use the bgp aggregate, and suppress the most specific

networks, but for any reason 5 steps away you need to use a more specific subnet for other uses, like filter

other aggregate members and propagate only an aggregate segment.


  This is something like de-aggregate the aggregate.

 

  Im not 100% sure this is the way to configure this in junos, but this works in my tests. I will explain the

cisco configuration, and how i get the same behavior in JunOS, the problems i face and how to fix this.


  First, the minimal IOS configuration. You have to know how the inject map works. Im going to propagate into

BGP new prefixes without using network, redistribute or aggregate commands. But i need a less specific

network to propagate more specific networks (de-aggregate an aggregate). I will not show any filtering

configuration you may apply of course for less specific, there is more examples in other posts.

 

   Topology

 

   AS 65001  / AS 65002 / AS 65003
         R1    ----     R2     ----     R3

 

------------------------------------------------------------------------------------------------------
IOS configurations.
------------------------------------------------------------------------------------------------------


------------------------------------------------------------------------------------------------------
R1 will only have an aggregate. not shown here.
------------------------------------------------------------------------------------------------------


------------------------------------------------------------------------------------------------------
R2 configuration, will inject the more specific prefixes.
------------------------------------------------------------------------------------------------------

!
! Bgp configuration, have to declare what we want to propagate, Inject map, and the conditions that must exist

to do this, Exist map.
!
router bgp 65002
 bgp inject-map Inject exist-map Exist


!
! These are the route-maps. Inject will set or inject a prefix into bgp with those prefix more specific prefix
! , those we want to propagate.
!
route-map Inject permit 10
 set ip address prefix-list Inject
!
! This route map will check the conditions that should happen to inject the more specific prefix.
! The route-source, bgp neighbor from which we learn the aggregated (or not), using prefix Origin.
! The prefix-list, that will match the aggregate or route we want to disaggregate, or propagate more specific

prefix.
!
route-map Exist permit 10
 match ip address prefix-list LessSpecific
 match ip route-source BGP-next-hop

 

ip prefix-list Inject seq 5 permit 10.10.1.0/24
ip prefix-list Inject seq 10 permit 10.10.2.0/24
ip prefix-list Inject seq 15 permit 10.10.3.0/24


ip prefix-list LessSpecific seq 5 permit 10.10.0.0/16

ip prefix-list BGP-next-hop seq 10 permit 1.1.1.1/32


------------------------------------------------------------------------------------------------------
R3 will only receive the new prefixes.
------------------------------------------------------------------------------------------------------

 

 


------------------------------------------------------------------------------------------------------
JunOs configurations.
------------------------------------------------------------------------------------------------------

  I don't find a JunOS equivalent to the inject map, so again policy and other features.

  I did some test with generated routes, but this didn't work because this works like an aggregated.

 So, i work to get some routes i could inject into bgp, under some conditions, but that will be never installed into forwarding table, only into bgp.


------------------------------------------------------------------------------------------------------
R1 will only have an aggregate. not shown here.
------------------------------------------------------------------------------------------------------


------------------------------------------------------------------------------------------------------
R2 configuration, will inject the more specific prefixes.
------------------------------------------------------------------------------------------------------


/* Instead of the prefix list Inject, im going to create some static routes, next hop the bgp next hop,
   resolve keyword if next hop is not directly connected, and the no-install keyword. I don't want these
   be installed in forwarding table.
*/
set routing-options static route 10.10.1.0/24 next-hop 1.1.1.1
set routing-options static route 10.10.1.0/24 no-install
set routing-options static route 10.10.1.0/24 resolve
set routing-options static route 10.10.2.0/24 next-hop 1.1.1.1
set routing-options static route 10.10.2.0/24 no-install
set routing-options static route 10.10.2.0/24 resolve
set routing-options static route 10.10.3.0/24 next-hop 1.1.1.1
set routing-options static route 10.10.3.0/24 no-install
set routing-options static route 10.10.3.0/24 resolve


/* This will be the export policy, that will match the de-aggregated routes. I used several conditions, to be
   sure will not export this unless we learn the aggregated route. This could be more complex, if we want to
   check aggregated is a bgp learned prefix. */
set policy-options policy-statement R3-Inject term MatchAggr from protocol static
set policy-options policy-statement R3-Inject term MatchAggr from route-filter 10.10.1.0/24 exact
set policy-options policy-statement R3-Inject term MatchAggr from route-filter 10.10.2.0/24 exact
set policy-options policy-statement R3-Inject term MatchAggr from route-filter 10.10.3.0/24 exact

/* Here will check we learn the aggregated route. */
set policy-options policy-statement R3-Inject term MatchAggr from condition MatchAggr
set policy-options policy-statement R3-Inject term MatchAggr then accept

 

/* Condition that will match the aggregated. This is likely the ios prefix-list LessSpecific. */
set policy-options condition MatchAggr if-route-exists 10.3.0.0/16
set policy-options condition MatchAggr if-route-exists table inet.0


/* Export more specific prefix to R3. */
set protocols bgp group R3 export R3-Inject

 


------------------------------------------------------------------------------------------------------
R3 will only receive the new prefixes.
------------------------------------------------------------------------------------------------------

 

 

 

------------------------------------------------------------------------------------------------------
Verifications.
------------------------------------------------------------------------------------------------------

 

Will find this in the attached file,

 

IOS

show ip bgp

 

JunOS

show route advertising-protocol bgp x.x.x.x

show route forwarding-table

sho route receive-protocol bgp x.x.x.x

 

 

Br
Alex

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

If you want to say thanks, the word is Kudos!!.

Thx.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

JNCIA-JUNOS, JNCIS-ENT, JNCIS-SP, JNCIP-SP.
CCNA, CCNP, Written CCIE.

Attachments