Community discussions

MikroTik App
just joined
Topic Author
Posts: 4
Joined: Tue Jan 18, 2022 9:57 am

BGP Prepend Load Balance

Thu May 12, 2022 1:57 pm

Real IP addresses removed.
viewtopic.php?p=773760&hilit=bgp+load+b ... rs#p773760 did not help since Mikrotik does not use two default routes.
viewtopic.php?p=503195&hilit=bgp+load+b ... rs#p503195 did not help since Mikrotik does not use two default routes.
viewtopic.php?p=614446&hilit=bgp+load+b ... rs#p614446 din not help.
viewtopic.php?p=852467&hilit=bgp+load+b ... rs#p852467 did not help.

Attached Network Diagrams:

Current Problem BGP Load Balance.png

Wanted Solution BGP Load Balance.png

I have two edge routers each with a BGP session to a different upstream provider, see diagram 1.

Upstream1 sends to my IPE1.
I gave the route a local pref of 110.

IPE1 advertises the following to Upstream1: Prepend 2 Prepend 2

Upstream2 sends to my IPE2.
I gave the route a local pref of 100.

IPE2 advertises the following to Upstream2: Prepend 2

Upstream1 is used for all outgoing traffick. (Higher Local Pref)
Upstream1 is used for incoming traffic for
Upstream2 is used for incoming traffic for and

I am seeing two problems with incoming taffic for and
1) Traffic for and is coming in via upstream1/IPE1 and upstream2/IPE2 instead of upstream2/IPE2 only.
2) The bulk (say 80%) of the incoming traffic for and comes in via upstream1/IPE1. Traffic is doing exactly what I want it to do, it uses upstream1/IPE1 for both outbound and inbound; and does not touch upstream2/IPE2 at all.

I am aware that since upstream1 is the default route for outgoing traffic, the "reply" traffic for and, might return via upstream1.

1) Any ideas why the inbound traffic for and comes in via both upstreams?
2) Does the reply traffic ignore the prepend and come back via the same interface/path it left out of?

NB!! Externally originated/initiated traffic destined to and correctly comes in via upstream2/IPE2.
Looking glasses and traceoutes show the correct information.
You do not have the required permissions to view the files attached to this post.
Frequent Visitor
Frequent Visitor
Posts: 76
Joined: Sun Sep 05, 2010 3:09 am

Re: BGP Prepend Load Balance

Fri May 13, 2022 11:18 pm

Not sure if this answers your questions but I have two BGP feeds that I manually load balance using BGP advertisements (for incoming traffic) and routing filter Local Pref for outgoing traffic. I do not use prepending at all. I have had this in place for years with no issues.

I have a /20 IP block so I advertise my whole IP block (/20) out both upstreams and then my lower half (/21) out Upstream 1 and upper half (/21) out Upstream 2. In your example I would do the following.

For Upstream1 advertise the following.

For Upstream2 advertise the following

As routing uses the more specific route by default incoming traffic for 10.10.2.x and 10.10.3.x would come in Upstream 2. Should upstream 2 fail then that traffic will instead come in via Upstream 1 because of the broader route you have in place that covers the 10.10.2.x and 10.10.3.x subnets.

The reverse would also work should Upstream 1 fail as traffic for 10.10.1.x would move to Upstream 2 due to the /22 that covers this subnet being advertised out upstream 2
User avatar
Posts: 1681
Joined: Fri Aug 10, 2012 6:46 am

Re: BGP Prepend Load Balance

Fri May 13, 2022 11:50 pm

Many ASNs will ignore prepends in the DFZ these days because they set a default localpref or modify the localpref based on the peer the routes were learned on.This is likely why your prepending solution isn't working as expected.

Either advertise more specific routes as someone mentioned or use traffic engineering BGP communities if your upstream peer supports them.
just joined
Topic Author
Posts: 4
Joined: Tue Jan 18, 2022 9:57 am

Re: BGP Prepend Load Balance

Wed May 18, 2022 1:49 pm

Input much appreciated, thanks.
I'll try the solutions out to see which one works best.

Who is online

Users browsing this forum: No registered users and 0 guests