Networking Refresher: IP, CIDR, Subnetting

Revise the fundamental networking concepts like IP, CIDR, and subnetting.

Building resilient and secure infrastructures and workflows requires a fundamental understanding of networking. In the context of the cloud, we don’t have to manage our own physical hardware, but the task of configuring the virtual resources to meet our requirements and operate effectively lies with us.

Keeping this in perspective, let's familiarize ourselves with the basics of the Internet Protocol used by AWS services to communicate with each other.

Internet Protocol

Internet Protocol outlines the set of rules for addressing and routing data on the internet. It enables communication between two host machines over a network. Every host machine or device on the internet is assigned a unique identifier, namely an IP address. The Internet Protocol delivers the packets over the network using these unique identifiers. Once delivered, the transport layer protocols take over further processing the packets and handing them over to the respective applications.

The Internet Protocol addresses come in two flavors:

IPv4

Internet Protocol version 4, or IPv4, is a 32-bit addressing scheme where each IP address is denoted by four octets separated by dots, for example: 10.0.0.0. Each octet in the IP address represents 8 bits, which means that the value can range from 0 to 255. Similarly, since IPv4 supports 32 bits, we can have 2322^{32}or approximately 4 billion uniquely identifiable IP addresses, which in our day and age are insufficient.

IPv6

To deal with the limited number of addresses in IPv4, Internet Protocol version 6 or IPv6 supports 128-bit addresses, which are represented by a hexadecimal notation. Each IPv6 address has eight 16-bit sections, separated by a colon, for example: d14c:1368:3e4a:0c9f:fcf5:460c:e7dd:3205. With 128 bits, we can uniquely identify 21282^{128}devices, which is 2962 ^ {96}times more than IPv4.

IPv6 comes with other protocol enhancements, such as better security and privacy, but for the sake of simplicity, we have only covered the address space enhancement.

IPv4 is still the most commonly adopted version, so we will focus on IPv4 addressing for the rest of the lesson.

Classful IPv4 addressing

The IPv4 addresses can be divided into two parts:

  • Network: The network address corresponds to the number of bits used to uniquely identify a network.

  • Host: The host address represents the unique identifier of a device/host on that network.

In the traditional context, the IP addresses were divided into smaller groups/classes via classful addressing. Each class uses different bits to represent the network and host addresses. The three primary classes available for general use are A, B, and C:

  • Class A: This class uses the first octet (8 bits) as the network address and the remaining octets for host addresses. The first bit from the network address is always 0 so we can’t use it. Therefore, the remaining 7 bits make 27=1282 ^ 7 = 128networks. The 24 bits from the host part make 224=167772162 ^ {24} = 16777216 hosts in each network. For example, let’s consider 20.0.0.1 address where 20 represents the network address, and the 0.0.1 is the host address.

  • Class B: This class uses the first two octets (16 bits) for the network and the remaining octets for host addresses. In Class B, the first bits from the network bits are always 10, which makes the network space of214=163842^{14} = 16384addresses. There are216=655362^{16} = 65536hosts in each network. For example, let’s consider 131.17.0.3, where 131.17 represents the network address, and the 0.3 is the host address.

  • Class C: This class uses the first three octets (24 bits) for the network and the last octet for host addresses. The first three network bits are fixed to 110 and the remaining 21 bits make221=20971522^{21} = 2097152networks in this class with 28=2562 ^ {8} = 256 hosts in each network. For example, let’s consider 200.168.1.19, where 200.168.1 represents the network address, and the 19 is the host address.

Note: The first and the last address in each class are reserved as host identifier/address and broadcast address, respectively and can not be used.

The classes can be summarized in the table below:

Get hands-on with 1400+ tech skills courses.