Community discussions

MikroTik App
 
pwuk
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 51
Joined: Wed Aug 01, 2012 8:51 pm

iBGP and eBGP

Tue Jan 08, 2019 7:16 pm

I have a network setup that looks like this

https://tinyurl.com/ydx8e6db
Image

With Orange being OSPF, and Blue being eBGP.

BGP has a cost of 20, and OSPF 110

I can use a variety of BGP tricks to force traffic from R11 to prefer going via R1 or R2 (local pref, med, ASpath prepend, etc)

The link between R1 and R11 is 1G, the link from R2 to R11 is 100M, so I'd prefer to use the R1 link normally, which means I don't want R2 to advertise a route unless R1 isn't connected - indeed R2 should use OSPF to route via R1.

The problem I get is that both R1 and R2 will route directly to AS65011, and both advertise the route into OSPF.

Is this what is supposed to happen, or is it because I'm not running iBGP between the two border gateways (R1 and R2)?

One option i think would be to change the cost of the BGP on R2 to be higher than OSPF, meaning that if R1 is advertising into OSPF, R2 will see this, and route via OSPF rather than direct.

That doesn't feel right though, feels like a hack. Is there a proper way I'm supposed to do it?

Thanks
 
User avatar
Murmaider
Member Candidate
Member Candidate
Posts: 126
Joined: Fri Oct 30, 2015 10:10 am

Re: iBGP and eBGP

Mon Jan 14, 2019 8:16 am

I'm no expert, however:

Could you not setup an IBGP sessions between R1 and R2 and set force-self on R1 when advertising BGP to R2.
Create a filter on R2 to set the prefixes received from R1 to R2 to have a local pref of 500
On R11 prepend the routes advertised to R2

if you dealing with a larger ip range on R11 (greater than a /24, for example a /22) - you could also look at advertising the /22 to R2 and then the /23 or /24 to R1.
This will help force traffic via R1.
 
TheCiscoGuy
Frequent Visitor
Frequent Visitor
Posts: 51
Joined: Fri Jun 22, 2018 8:32 am

Re: iBGP and eBGP

Mon Jan 14, 2019 9:47 am

Firstly, lets define terms, there is distance and cost. The distance is a priority value of sorts associated with the protocol, the cost is a value associated with path selection within the protocol. You are 2/3s correct with respect to the values:
1. iBGP = 200
2. eBGP = 20
3. OSPF = 110

These values are only taken into consideration when making a best path selection so long as more than 1 protocol has received the same prefix and length.

Another thing to note, how does your OSPF process learn the prefixes advertised from AS 65011? If the answer is redistribution of BGP into OSPF then you need to ensure you are redistributing with external type1, and the BGP MED attribute should be used as that will be the external cost of the prefixes being redistributed (or you can set the argument bgp-metric on the redistribution directly, but it gives less control)

Remember lower cost wins, so setting the MED on the link between R2 and R11 would be preferred to a high value, I believe 20 is default, but don't quote me, please look it up to verify.

Just a helpful warning/reminder, if you are doing OSPF/BGP bidirectional redistribution on your eBGP speakers, ensure that you are marking the routes and dropping accordingly to ensure you do not create routing loops.

EDIT:
Sorry forgot to note, to use MED you must set the bgp-metric=auto to use the MED value. It does (confirmed) set to 20 by default. So make sure you flip the bgp-metric on the redistribute-bgp command within /routing ospf
 
pwuk
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 51
Joined: Wed Aug 01, 2012 8:51 pm

Re: iBGP and eBGP

Tue Jan 29, 2019 9:07 pm

Thanks for this,

> Another thing to note, how does your OSPF process learn the prefixes advertised from AS 65011? If the answer is redistribution of BGP into OSPF then you need to ensure you are redistributing with external type1,


your post was really helpful in working out what's going on. I believe the network was setup by people who didn't really get BGP. We've got BGP routes copying into OSPF, and then those copying back into BGP, and the BGP links in a given AS aren't linked together, and occasional route filters to try to reduce routing loops.

Sat down with a college and I think we have a way forward (which is basically don't copy any external routes from OSPF into BGP and set up ibgp, which seems to have been confused in the history of this network with a generic "igp" -- there was a view that "we don't need ibgp because we run ospf")

Who is online

Users browsing this forum: No registered users and 13 guests