Routing
Routing

Configuring multiple prepend AS path for BGP

12.11.16   |  
‎12-11-2016 07:40 AM

I have multiple AS path to prepend depending on the IP address matched in my prefix list.

The idea is to match incoming IP addresses against my prefix list and prepend the AS number accordingly. I have done a quick search online for BGP prepend samples but i am not certain how it should be when there is multiple values involved. 

 

Please advise if i am on the right track.

This is what I have as of now.

 

prefix-list normal-as-path {
100.66.11.220/32;
100.66.11.221/32;
111.102.0.22/32;
111.101.145.220/32;
100.66.11.92/28;
}
prefix-list long-as-path {
200.12.111.123/28;
}

 

term prependterm1 {
from {
prefix-list long-as-path;
}
then {
as-path-prepend "65 65 65";
accept;
}
}
term prependterm2 {
from {
prefix-list normal-as-path;
}
then accept;
}

 

group prependpolicy {
type external;
import prependpolicy;
}

3 REPLIES
Routing

Re: Configuring multiple prepend AS path for BGP

12.11.16   |  
‎12-11-2016 10:54 AM

I assume the two terms you list are part of the prependpolicy applied to the group prependpolicy.

 

When you have multiple terms they are applied in order to the routes on a first match basis.  And the default policy is to simply accept a route.  

 

So in your policy there is no possible overlap and order does not matter.  Since you have no final reject term all other routes are also accepted so if you do want ot limit the peer to only the prefix lists you need to add the final reject term.

Steve Puluka BSEET
Juniper Ambassador
Senior IP Engineer - DQE Communications Pittsburgh, PA (Metro Ethernet & ISP)
JNCIA-Junos JNCIS-SEC JNCIP-SEC JNCSP-SEC
JNCIS-FWV
JNCDA JNCDS-DC JNCDS-SEC
JNCIS-SP
ACE PanOS 6 ACE PanOS 7
http://puluka.com/home
Routing

Re: Configuring multiple prepend AS path for BGP

12.11.16   |  
‎12-11-2016 04:14 PM

Hey thanks for getting back to me.

 

I am not certain if i can have 2 different prepend function in a single policy function. Am pretty new to L3 routing for Junos. 

Noted for the default behaviour. I will add a deny statement at the end. 

 

Cheers mate. 

Highlighted
Routing

Re: Configuring multiple prepend AS path for BGP

12.12.16   |  
‎12-12-2016 02:52 AM

Yes, you can have two different prepend operations in the same policy.  Naturally the terms would need to be written such that hitting they affect different prefixes.

 

A common use case for this would be having multiple prepend communities.  When the downstream peer adds the desired community then the requested number of AS prepend occur when passing the prefix upstream.  So the client can choose how many prepends occur.

Steve Puluka BSEET
Juniper Ambassador
Senior IP Engineer - DQE Communications Pittsburgh, PA (Metro Ethernet & ISP)
JNCIA-Junos JNCIS-SEC JNCIP-SEC JNCSP-SEC
JNCIS-FWV
JNCDA JNCDS-DC JNCDS-SEC
JNCIS-SP
ACE PanOS 6 ACE PanOS 7
http://puluka.com/home