Unit 2: The Internet · Addressing the Internet

Article

IP addresses

7 min read

To post a letter, you write the address of the house on the envelope. How does a message on the Internet know which device to go to? Every device needs an address too.

What an IP address is

An IP address is a number that identifies a device on a network that uses the Internet protocols. "IP" stands for Internet Protocol, the set of rules for addressing and sending data. When your phone asks for something, the request carries your address, so the answer knows where to go back to.

There are two versions in use today: IPv4 and IPv6.

IPv4: four numbers

An IPv4 address is made of 32 bits. To make it easier to read, we split the 32 bits into four groups of 8 bits, and write each group as a decimal number, with dots between them.

203.0.113.9

Each group of 8 bits can show any value from 0 to 255, so every number in an IPv4 address is between 0 and 255. Here is the same address in bits:

Decimal20301139
8 bits11001011000000000111000100001001

How many values can 8 bits make? Use the widget to find out, then keep adding bits in your head.

Pattern 00000000 is one of 256 different patterns 8 bits can make (28).

Every extra bit doubles the number of values. So 32 bits make 2³² different addresses:

BitsDifferent values
82⁸ = 256
162¹⁶ = 65,536
242²⁴ = 16,777,216
322³² = 4,294,967,296

That is about 4.3 billion IPv4 addresses.

Check your understanding

Which of the following is a valid IPv4 address?

IPv6: much longer

IPv4 was designed when only a small number of computers were connected. Today billions of phones, laptops, TVs, cars and sensors are online, and IPv4 does not have enough addresses to give every one of them its own.

IPv6 was created to fix this. An IPv6 address has 128 bits. It is written as eight groups, separated by colons, and each group uses digits and the letters a to f. This is a short way to write the bits. You do not need to read them for the exam.

2001:0db8:85a3:0000:0000:8a2e:0370:7334

With 128 bits, the number of addresses is 2¹²⁸, which is about 3.4 × 10³⁸. That is a 3 followed by 38 more digits.

IPv4IPv6
Bits32128
Looks likeFour numbers with dotsEight groups with colons
Number of addresses2³², about 4.3 billion2¹²⁸, about 3.4 × 10³⁸

Here is how the two kinds of address are built:

Two ways to write an address

  1. IPv4: 32 bits

    20301139

    four groups of 8 bits, each written as a number from 0 to 255

  2. IPv6: 128 bits

    20010db885a3000000008a2e03707334

    eight groups of 16 bits, written with digits and the letters a to f

IPv6 has 96 more bits than IPv4, and every extra bit doubles the number of addresses.

IPv6 has 96 more bits than IPv4. Each extra bit doubles the count, so it has 2⁹⁶ times as many addresses, and not just four times as many. Today both versions are used at the same time.

Check your understanding

Why was IPv6 created?

Worked example: how many addresses?

A small test network uses addresses that are 10 bits long. How many different addresses can it have?

  1. Each bit has two possible values.
  2. Ten bits give 2 × 2 × 2 × 2 × 2 × 2 × 2 × 2 × 2 × 2 = 2¹⁰.
  3. 2¹⁰ = 1,024 addresses.

Now suppose a network adds one more bit, making addresses 11 bits long. The count doubles, to 2,048.

Common mistakes

  • Thinking 32 is the number of IPv4 addresses. 32 is the number of bits. The number of addresses is 2³².
  • Allowing a number above 255. An address such as 192.0.2.300 cannot be IPv4, because 8 bits can't show 300.
  • Thinking IPv6 only has four times as many addresses. 128 is four times 32, but each bit doubles the count, so IPv6 has far, far more.
  • Thinking IPv6 is a faster Internet. IPv6 is about having enough addresses, not about speed.
  • Thinking an address is a street address. An IP address says which network and device, not exactly where someone is sitting.

On the exam

Expect two ideas: IPv6 was created because IPv4 was running out of addresses, and IPv6 has more addresses because its addresses have more bits. You may also be asked to work out how many values a number of bits can make.

Key words

IP address: a number that identifies a device on the Internet. IPv4: the older version, with 32-bit addresses. IPv6: the newer version, with 128-bit addresses. Internet Protocol (IP): the rules for addressing and sending data on the Internet.

AP® is a trademark registered by the College Board, which is not affiliated with, and does not endorse, this site. All lessons and questions here are written by JrCodex.