== mellowd.dev ==
Darren's random posts

Understanding the BGP prefix count

Recently ZDNet linked to @bgp4_table to show the current state of the internet routing table. I saw a few comments here and there showing others not showing the same amount of routes, so I thought I’d explain a bit here.

@bgp4_table and @bgp6_table tweet what my own two BGP daemons see. These daemons currently peer with 6 different peers, most of those peers with multiple sessions. When first starting the project I purposely looked for geographic diversity in my peers to get a good overall feel of whats out there.

Each of these peers send me different counts. Sometime I even get different counts when peering with the same peer in different locations. It really depends on which each peer sees, and what they do and do not send me.

Looking at each of my BGP sessions on one of my daemons you can see the wildy different counts from each:

$ birdc 'show protocols all' | grep Routes: | awk {'print $2'}

One of my peers is only sending just over 650k routes, almost 100k less then the rest.

Why such a large difference? It really depends on policy. Sometimes in a region, certain companies will advertise more specific /24s to their local exchange. Direct peers on the exchange will get those, but may be asked not to leak them out the region where the ISP may instead advertise a single /22 to the rest of the world. With my diversity here, I’m able to get more specifics that others may not see.

Even with all the prefixes I have, there are loads I don’t get from any of my peers. Any of these peers could be receiving prefixes from neighbours with NO-EXPORT set. I’ll not see those unless those communities have been overwritten.

It’s also important to remember most edge BGP speakers have far more prefixes on them that just the current BGP table. Those routes are connected to other routes in that AS and so they’ll have all the internal IGP routes plus a load of unexported internal BGP routes. This number can easily hit many tens of thousands in bigger companies, even hitting 100k+.

Ultimately what you see and I see is not exactly the same. Even my own two daemons don’t agree all the time.

The number that gets tweeted daily is the amount of unique prefixes that I see at the time. At time of writing:

$ birdc 'show route count'
7344489 of 7344489 routes for 771925 networks

7.3 million prefixes in total from all my peers, with 771,925 being unique forwarding entries.

Of course let’s not forget IPv6. While a much smaller number still, that table is growing more rapidly when looking as a percentage.

$ birdc6 'show route count'
516186 of 516186 routes for 68183 networks

Each peers count sent to me


Looking like the peer sending me 100K less IPv4 prefixes is also sending me over 13k fewer IPv6 prefixes.