[Math] Exponentiation and binary logarithm for network administrators

Well-known Google free DNS IPv4 address:

% whois

NetRange: -

How many hosts in this network?


>>> 2**(32-9)

Majority of networks has the prefix x.y.z.t/24

>>> 2**(32-24)

Yes, 256 hosts in the network. 'Class C network' in IPv4 lingo.

And otherwise. A network with 512 hosts.

>>> import math
>>> 32-math.log(512, 2)

So it will have a prefix x.y.z.t/23

(the post first published at 20220721.)

List of my other blog posts.

Subscribe to my news feed

Yes, I know about these lousy Disqus ads. Please use adblocker. I would consider to subscribe to 'pro' version of Disqus if the signal/noise ratio in comments would be good enough.