Community discussions

Topic Author
Posts: 26
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

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?

User avatar
Member Candidate
Member Candidate
Posts: 113
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.
Posts: 38
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.

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
I got 0x63 problems but hex ain't one

Who is online

Users browsing this forum: No registered users and 7 guests