02-06-2017 08:19 AM - edited 03-05-2019 07:59 AM
Hi
can someone please throw some light on AS Prepend in BGP multi homing. I understand its for forcing traffic through Primary ISP but does the Prepend need to happen on ISP side or customer side routers ? will this work for incoming and outgoing traffic ?
Also what are the other ways to implement the same ?
does anyone has sample config for the above ?
Thanks
Solved! Go to Solution.
02-07-2017 04:50 AM
R1
router bgp 100
bgp log-neighbor-changes
neighbor 10.12.0.2 remote-as 200
neighbor 10.12.0.2 route-map LP in
neighbor 10.12.0.2 route-map PREPEND out
neighbor 10.15.0.5 remote-as 100
neighbor 10.15.0.5 next-hop-self
!
!
route-map LP permit 5
match ip address 10
set local-preference 25000
!
route-map PREPEND permit 5
match ip address 10
set as-path prepend 400 400
!
!
access-list 10 permit any
R2
router bgp 200
bgp log-neighbor-changes
neighbor 10.12.0.1 remote-as 100
neighbor 10.24.0.4 remote-as 400
R3
router bgp 300
bgp log-neighbor-changes
neighbor 10.34.0.4 remote-as 400
neighbor 10.35.0.5 remote-as 100
R4
router bgp 400
bgp log-neighbor-changes
network 4.4.4.4 mask 255.255.255.255
neighbor 10.24.0.2 remote-as 200
neighbor 10.34.0.3 remote-as 300
R5
router bgp 100
bgp log-neighbor-changes
neighbor 10.15.0.1 remote-as 100
neighbor 10.15.0.1 next-hop-self
neighbor 10.35.0.3 remote-as 300
neighbor 10.35.0.3 route-map LP in
neighbor 10.35.0.3 route-map PREPEND out
!
!
!
route-map LP permit 5
match ip address 10
set local-preference 5000
!
route-map PREPEND permit 5
match ip address 10
set as-path prepend 400 400 400 400 400
!
!
access-list 10 permit any
02-06-2017 08:40 AM
Hi
You can set up on a route-map the desired as-path prepend string.
Then you can assign the route-map to your bgp neighbor IN or OUT.
if it is IN, you will received the prefixes with the AS-path prepend string that you have configured on your route-map.
If it is OUT, you will advertise the prefixes with the AS Path prepend string configured on your route-map. (This scenario could be ISP to Client)
Please let me create a lab for you.
02-06-2017 08:42 AM
sure thanks so i need to the traffic going in and out through primary and if that fails then through backup.so from sounds of what you say, I can do OUT or ISP can do IN ? is this right?
i will wait for your LAB
02-06-2017 08:48 AM
Thanks
You can set up a short as prepend string for the prefixes coming from primary ISP and configure a large prepend string for prexifes coming from backup ISP.
But give me few minutes to create the lab and share the config with you.
02-06-2017 09:28 AM
Hi
I have created a lab with 4 routers, please the attached image (topology):
So R1 is receiving the prefix 4.4.4.4/32 through the 2 providers but it prefer R2:
Picture 1.
then I have configured R1 to receive the prefixes with different AS prepend strings.
Picture 2. and 2.5
Just for testing purposes Im going to set up the ISP 2 as primary path.
Picture 3. , Picture 3.5 and Picture 3.75
Hope it is useful :-)
02-06-2017 09:43 AM
Thanks for the LAB very helpful :)
just to understand, ISP 2 is primary so have you have prepend 4 times? and prepend 2 times on ISP 1 (backup ISP) ? I gues this is on customer side
Does ISP need to do Pre-Pend also ?
Thanks
02-06-2017 09:49 AM
Hi
R2 is the primary ISP
R3 is the secondary ISP
R1 and R4 are clients
If these prefixes are Internet traffic you have to talk with the provider in order to have a symmetric traffic.
If you are going to connect your BGP router to Internet, it must be configured as no transit to avoid any inconveniences with the CPU utilization otherwise all the Internet traffic could be passing through your Router.
R4#traceroute 1.1.1.1 source 4.4.4.4 numeric
Type escape sequence to abort.
Tracing the route to 1.1.1.1
VRF info: (vrf in name/id, vrf out name/id)
1 10.34.0.3 1 msec 0 msec 1 msec
2 10.13.0.1 1 msec * 3 msec
R4#
Please rate the comment if it was useful :-)
thank you.
02-06-2017 09:54 AM
so this will be my topology
ISP1 (MAIN) ISP2 (Backup)
| |
Customer-R1 -------Customer R2
I would like my Internet routes (100.100.100.0/24) just as an example to be advertised out through ISP1
now what would be my config on R1 and R2 ? (Does only R1 need AS Prepend?) does ISP need any Prepend config also ?
Thanks
02-06-2017 09:56 AM
Client R1 is connected to Client R2 directly?
02-06-2017 10:04 AM
Customer Router 1 connect to a switch but yes both routers will be connected and running HSRP for the inside address whcih will be 100.100.100.1 (HSRP) (Router1 100.100.100.2 and Router 2 100.100.100.3) (for arugment sake)
02-06-2017 10:07 AM
mmm Please correct me if I am understading wrong.
Your routers on your infrastrucuture are R1 and R2.
R1 is your primary router connected to ISP1
R2 is your secondary router connected to ISP2.
is that correct?
If that is the case, you could configure on R1 a local-preference IN greater than the local preference configured on R2 and configure an AS path preprend OUT with short string.
On R2 configure a local-preference IN smaller than the local preference configured on R1 and configure an AS path prepend string OUT greater than R1.
Also assuming you will create an iBGP between R1 and R2
02-06-2017 10:07 AM
Yes topology as you mentioned is correct
so as per you suggestion i dont need ISP to get them to configure any AS prepend for in / out ?
do i need local preference or wont it work just with AS prepend ? any reason for local preference ?
02-06-2017 10:09 AM
Yep, with this idea you will guarantee symmetric traffic and redundancy. Let me modify my lab.
02-06-2017 10:11 AM
Thanks Julio appreciate your help
also if you can post your config as iam trialling out on my home lab and doesnt seem to work? would you be able to post ISP config as well so that i can cross check?
Thanks
02-06-2017 10:18 AM
Sure, I can paste it here and attach the images :-)
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide