Internet Protocol

Recall that the Internet Layer is used when we want to allow devices to connect to each other across networks. The Internet Protocol (IP) is the workhorse of TCP/IP in allowing this to happen.

To build an IP address, we take four octets and concatenate them to form a 32-bit integer. For each of the four octets, a number between 1 and 255 is chosen. These values are called octets because 2^8 = 256. An example of an IP address is 192.168.127.16.

Since each octet is independent of the others, this addressing scheme can allow us to create 2^8^4, or 2^32 addresses, which is just shy of 4.3 billion possible values!

At this point, you may be thinking: "Wait a moment, 4.3 billion is a lot of addresses, but there are way more than 4.3 billion devices on the planet. There aren't enough addresses for everyone!"

There are a few ways by which IPv4 solves this problem. One of them is called Network Address Translation, or NAT, and we'll learn more about that later. Another way of solving the problem is by the use of something called a subnet mask. A subnet mask uses the same numerical format as an IP address, so it can get a little bit confusing. Like IP addresses, they are also built by concatenating four octets. Unlike IP addresses, they usually start with the value "255" (for example, 255.255.255.0, or 255.255.0.0).

Each network is assigned a subnet mask, which helps define what IP addresses are allowed to exist within that same network.

In order to refer to subnets more concisely, we can use something called Classless Inter-Domain Routing (CIDR) notation. For example, the CIDR notation for a network with a 255.255.255.0 subnet mask is "/24", because there are 24 one-bits in the mask. Likewise, 255.255.0.0 subnet masks belong to "/16" networks, and 255.0.0.0 subnet masks belong to "/8" networks.


Relevant Note(s): Network Protocols