Routing – OSPF vs BGP Routing Table Size

bgpospfprotocol-theoryrouting

I'm confused about routing table sizes in BGP vs OSPF. My understanding is that in an AS with the routers running OSPF, each router will have the whole picture of the network, and as such will have an entry for each router and the metric for reaching it. If the routers in the AS are running BGP, each router will only be aware of its neighbors; as such, it will have much fewer entries.

Is this assumption correct? If it is, could you provide an example showing how this is so, and why this is always true?

Best Answer

Don't confuse the routing protocol tables with the routing table. Each routing protocol maintains its own set of tables which are not the same thing as the routing table. The routing table will contain the best routes from the routing protocol tables.

BGP and OSPF serve different purposes. OSPF will always be within a single AS. BGP is primarily to route between ASes (eBGP). BGP can be used within an AS (iBGP), but there are some limitations and rules for iBGP. For instance, iBGP peers cannot advertise routes learned from another iBGP peer, so iBGP must maintain a full mesh or use some sort of mitigation (route reflectors or confederations).

OSPF maintains a complete picture of the entire OSPF area in which it resides, and only that area, not necessarily an entire AS which may consist of multiple areas.

BGP will have entries for each neighbor, and the prefixes which each neighbor advertises to it, along with BGP attributes, which can take up considerable space.