# What’s a few million hosts between friends?

By on 21 Jan 2015

Category: Tech matters

Tags: ,

Geoff and I were musing about how to average two prefix lengths in a ‘what’s the average announcement’ question. If you take the simple view, it’s the simple average. If we consider a /8 and a /24, the average is a /16. Is that really what we meant? Consider the number of hosts:

• a /8 is 2^24 which is 16,777,216 host addresses
• a /24 is 2^8 which is 255 addresses
• a /16 (the simple average of the prefix announcement size) is 65,536 hosts.

Hmmmm, that doesn’t look right. Let’s try again. Take the simple average of the number of hosts announced:

• (16,777,216 plus 255) divided by 2 is 8,388,736
• 2^23 is 8,388,608 which is very close to that number. So (32-23) == 9 equates to a /9 of addresses.

So, in this model, the ‘average’ number of hosts between a /8 and a /24 is actually.. a /9 (or thereabouts). That’s quite a difference between a /16 and a /9.

Simple..? What’s 8 million 300 thousand hosts between friends? Let’s not quibble!

If you re-define the question to be the average announcement length, then you can, (for the real numbers, given there are over 500,000 announcements in the current BGP view) make a reasonable statement of the average announcement length. But, its worth keeping in mind the number of host address instances announced is strongly affected by prefix length, and the weight of host counts behind the small number of very large prefixes, being announced by big ISPs may be having an effect you don’t consider, when you look at the simple average of prefix length. So, perhaps its worth having the distinction in mind. Byron put it like this:

“how many addresses are announced, on average” vs “what prefix length is announced, on average”

So, let’s apply this to the current BGP4 view of the default free zone.

Using the simple average prefix length, the average prefix announced is a /22.4 -basically, a /22 or a /23. That represents the huge number of more-specific announcements being made. But that only covers somewhere between 512 and 1024 host instances.

If you take the hostcount which lies behind each BGP announcement, the average host count is actually closer to 8192 hosts: 7,381 to be more exact, which is between a /19 and a /20. The actual representation of the prefix is tricky given its usually stated as an integer power of two, but if we calculate the floating point accurate value of 32-log(base2, 7381) we get 19.15, so a /19 is actually quite reasonable as the implied value of the average prefix length which represents the amount of end users covered by a prefix, on average.

It may not look like much, but a  /19 is a lot more addresses than a /22 when it comes to how many customers can lie behind that announcement!