Internal BGP (Border Gateway Protocol) explained

Hi Badal,

We don’t save anything by implementing iBGP but it’s necessary.

AS2 is a transit AS so all routers within the AS should know how to reach any destination. When R3 receives an IP packet, it has to know if it should forward the packet to R2 or R4. If this is an ISP where we use IP routing then we’ll need to implement iBGP to fill its routing table.

Rene

In your example…. In Autonomous System 2… lets say R3 was an (OSPF) Autonomous System border router to other networks behind it… theres EIGRP, OSPF, and RIP etc etc networks that are all redistributed into R3… and lets just say iBGP is configured on R3 as well…. How do those redistributed networks exit out the network to AS1 or AS2? Do those redistributed networks need to be learned by iBGP in order for them to leave the network – through iBGP – to eBGP? If I have 50 prefixes redistributed into R3 from other IGP networks…. How does iBGP learn of those prefixes? Does iBGP even have to learn of those networks in order to exit the AS2?

In order for BGP to advertise a new route (meaning not a route that was already in BGP already), two things must be true:

  1. The route must exist in the routing table of the BGP router that will be doing the advertising
  2. BGP must be told which routes to advertise

If R3 is learning about routes from an IGP (say, OSPF), you first make sure that the routes you want to advertise are, in fact, in R3’s routing table. This isn’t necessarily true just because R3 is learning OSPF routes from somewhere else.

Next, you must tell the BGP process to advertise those routes. This can be done one of two ways:

  1. Using a manual “network” statement within the BGP process. This statement must match exactly what is in the routing table (as far as prefix length). So, for example, if you had 10.1.0.0/24 and 10.1.1.0/24 in the routing table, you would NOT be allowed to say “network 10.1.0.0/23” instead you would have to input each one. This can get tedious with a large amount of routes, so many people choose to use redistribution (#2 below)
  2. Redistribute routes into BGP from another IGP (like OSPF). With Redistribution you have all kinds of options for Route-maps, filters, and setting community options.

Once R3 puts the desired routes into the BGP process, R2 and R4 will learn them via iBGP, and then advertise them to R1 and R5 via external BGP.

1 Like

Could you recommend some network lessons that hit upon your option 2 - Redistribute routes into BGP from another IGP (like OSPF). With Redistribution you have all kinds of options for Route-maps, filters, and setting community options

For this paper in college I am writing… I have a small RIP network…connected to a small OSPF network…which in turn is connected to a small EIGRP network (4 routers…. Which are also running iBGP) which is the gateway out to 2 ISP (BGP). Ive got the whole redistribution down between the internal networks. My RIP is redist into OSPF which in turn is redist into EIGRP. I’m just having a hard time grasping the configuration of turning those internal networks that are redistributed into EIGRP…turning them into BGP so they can exit the network.
You said:

  1. The route must exist in the routing table of the BGP router that will be doing the advertising
  2. BGP must be told which routes to advertise
    If R3 is learning about routes from an IGP (say, OSPF), you first make sure that the routes you want to advertise are, in fact, in R3’s routing table. This isn’t necessarily true just because R3 is learning OSPF routes from somewhere else.
    So…if all the internal networks are redistributed into EIGRP (where R3 sits)… then those routes would be in R3 routing table right?
    Next, you must tell the BGP process to advertise those routes……option 2 - 2) Redistribute routes into BGP from another IGP (like OSPF). With Redistribution you have all kinds of options for Route-maps, filters, and setting community options
    So…a Route-Map command would take all my internal routes in R3 routing table and redistribute them into iBGP so they can exit out to eBGP?

Hi Rene,

Maybe this is a weird question :slight_smile:

How R5 learnt about the route advertised by R1 AS 1 (1.1.1.0) ?
I mean I don t understand why R5 has in its routing table this route.
it seems it got from R1-R2-R4-R5 path but then the to reply to ping from 1.1.0 it takes another path via R3 (R5-R4-R3) ?
Then R3 does not know about 1.1.1.0.
Could you please explain it ?

Hi Jason,

In order for BGP to advertise something it has to be in the routing table of the router. You can’t advertise what you don’t have. It doesn’t matter if these networks are directly connected or learned through another routing protocol like OSPF. If you see the route in the routing table, then it can be advertised.

There’s two ways how you can advertise something in BGP.

Option 1:

Use the network command:

R1(config)#router bgp 1
R1(config-router)#network 1.1.1.0 mask 255.255.255.0

If you want to advertise something that is not in the routing table then you can use a static route to the null0 interface:

R1(config)#ip route 10.0.0.0 255.0.0.0 null 0

R1(config)#router bgp 1
R1(config-router)#network 10.0.0.0 mask 255.0.0.0

Option 2:

Use the redistribute command, it’s best to combine it with a route-map to define what routes should be redistributed:

R1(config)#ip access-list standard OSPF_ROUTES   
R1(config-std-nacl)#permit 172.16.0.0 0.0.255.255

R1(config)#route-map OSPF_TO_BGP permit 10
R1(config-route-map)#match ip address OSPF_ROUTES

R1(config)#router bgp 1
R1(config-router)#redistribute ospf 1 route-map OSPF_TO_BGP

Rene

1 Like

Hi Jose,

The route is advertised like this:

R1 > R2 > R4 > R5. We are running EBGP between R1-R2, IBGP between R2-R4 and EBGP between R4-R5.

The actual traffic will go from R1 > R2 > R3 > R4 > R5. Since R3 doesn’t run BGP, we get packet drops.

Rene

1 Like

Hi Rene,

It really helped , your way of explaining was very neat and crystal clear . Thanks a ton

Purna

Hi Rene,

After I added “network 192.168.45.0” on R5 try to advertise it into AS2 and AS1, R4 it shows RIB-failure, it doesn’t appear to have same result as you did. Kindly advise.

R4#sh ip bgp
BGP table version is 9, local router ID is 192.168.34.4
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*>i1.1.1.0/24       2.2.2.2                  0    100      0 1 i
r> 192.168.45.0     192.168.45.5             0             0 3 i

Hi Elbert,

Is 192.168.45.0 already in your routing table? Perhaps it was learned by another routing protocol or inserted with a static route?

Rene

Hi Rene,

Yes, 192.168.45.0 is directly connected in R4 routing table, no other routing protocol, is that the reason it caused error when R5 advertised this route?

Elbert

Hi Elbert,

That’s right. Your router learns this prefix from its neighbor but it already has a route in its routing table (because it’s directly connected). That’s why it can’t install it in the routing table.

RIB-failure means that the prefix couldn’t be installed in the routing table.

Hope this helps.

Rene

1 Like

Do we need OSPF to advertise the Loopback interfaces even if we have a full meshed iBGP connection between all 3 routers within the AS 2 ?
I do believe it is a yes.

Hi Vikas,

Normally we use an IGP (like OSPF) to advertise the loopback interfaces. We can then establish IBGP between the loopback interfaces.

Without an IGP, the routers have no idea how to reach each others loopbacks.

Rene

1 Like

Hi Rene,
But will I still require OSPF in case i advertise the loopback interfaces into BGP using the network command ?

Hi Vikas,

Yes you do…it’s a chicken and egg problem.

You want to establish iBGP between the loopback interfaces of two routers, but these routers have no idea how to reach each others loopback.

That’s why we use OSPF to advertise the loopback interfaces. The routers will learn each others addresses and can then establish iBGP.

Rene

1 Like

19 posts were merged into an existing topic: Internal BGP (Border Gateway Protocol) explained

This is definitely one of the finest lessons you have taught !

Hi Rene

Rather than adverting the network 192.168.45.0 in R5, if we set gateway of last resort on R1. This should solve the problem of R1 being not sure how to reply to the ping from R5. I also see that R1 is a stub network so setting a default route should give us an easy forward to all packets out of R1

Please let me know if this is something we can do on production networks rather advertising all this prefixes. Is there something that we need to redistribute this default route into BGP?

Thanks
Palani