Routing – Communication between BGP and OSPF routers

bgpospfrouterrouting

I will start with a scenario. Please excuse me if its a low-level question.
Lets say there are 2 AS, AS 100 and AS 200.
*In AS 100 there are 3 routers R1,R2 and R3 running OSPF and RB1 and RB2 running BGP where RB1 is connected to another BGP router RB3 in AS 200.

*AS 200 has routers R5,R6 and R7 running ospf and RB3 and RB4 running BGP.
RB3 is coonected to RB1 of As 100 and RB4 is connected to some other AS.

1)From my understanding, r1,r2 and r3 know about each and the networks connected. Does r1,r2 and r3 also relays this information to RB1 and RB2?
And similarly, does r5,r6 and r7 relays its links and networks to RB3 and RB4?

Because, suppose, if a host connected to R1 of AS 100 wants to communicate to a host connected to R5 present in AS 200, how does it do?

2)And as far as i know, RB1 and RB2 have an ibgp session and they have identical database. Same goes for RB3 and RB4.

But do the routers r1,r2,r3,r5,r6 and r7 have the same database as RB1,RB2,RB3 and RB4?
If thats not the case, how does a host in AS 100 know it has to send it to which border router(In this case, RB1 or RB2) to reach AS 200.

And one final question, how much does r1,r2 and r3 know? And same goes for RB1 and RB2?

Best Answer

RB1 and RB2 in AS100 do not know about the OSPF routes of R1, R2 and R3, unless RB1 and RB2 are also running OSPF, or one of the other routers is running BGP, and the routers running both protocols redistribute routes between OSPF and BGP. Routers do not share routes unless they run a common routing protocol between them.

OSPF and BGP maintain their own tables. A router will select the best route (or use a tie breaker, like AD, in the case of equal paths) from the various routing protocols it is running to insert into its routing table, but the routing protocols do not share routes.

Unless RB1 learns, in some way, about the OSPF routes of R1, R2, and R3, it will never share those with AS200, and vice versa.

BGP doesn't even advertise routes unless the routes are in the routing table of the BGP router, and the BGP router uses the network statements for the routes, or the routes have been redistributed into BGP. One mistake that people often make is assuming that you can simply add a network statement to advertise a route in a routing protocol, but that is not true. BGP must have the exact route in the routing table, and network statements only tell OSPF which interfaces to include in the routing process.