← All lessons
IP addressing and subnetting · Lesson 1 of 7

IPv4 addresses

An IPv4 address is 32 bits. Long rows of bits are hard to read, so they're written as four bytes in ordinary numbers with dots between: dotted decimal. Each of the four parts is called an octet (eight bits), so each is a number from 0 to 255.

192.168.1.10 is really 11000000.10101000.00000001.00001010. Subnetting is all about where the bits are, so it's worth being quick at turning an octet into binary. The place values in an octet are 128, 64, 32, 16, 8, 4, 2 and 1.

print(format(192, "08b"), format(168, "08b"))
Prints
11000000 10101000

A few octet values come up over and over, because they're a run of 1s followed by 0s: 128 (10000000), 192 (11000000), 224, 240, 248, 252, 254 and 255 (11111111). Learn those and most subnet masks read themselves.

32 bits gives 2³² addresses, about 4.3 billion. That sounded like plenty in 1981, but there are now far more devices than that, which is why private addresses, NAT and IPv6 exist. They're all later in this course.

Practice

Write the octet 255 in binary.

More info