Binary math

While discussing the structure of an IPv4 address, I mentioned that a bit can have a value of 0 or a value of 1. This sums up binary in a simplified nutshell. Using only the numbers 0 and 1, we can make any number we like, and in this section, I'm going to show you how to do this. But first, let me show how I learned decimal at school (back in the 1970s) and then we can apply these principles to binary.

Where binary can only use the numbers 0 and 1, decimal uses the numbers 0-9 to make up any value. When I was at school, my teacher drew a chart on the blackboard that looked a little like this:

Thousands Hundreds Tens Ones

If she wanted to show the number 1, she would write the following:

Thousands Hundreds

Get Networking Fundamentals now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.