Networking Concepts
In this tutorial, we are going to explore the fundamental networking concepts like IP, CIDR, and subnetting. Networking refers to the practice of connecting devices to enable communication and data exchange. It plays a crucial role in IT, providing the backbone for internet and organizational infrastructures.
Building resilient and secure infrastructures and workloads 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
The Internet Protocol (IP) is a set of rules that govern how data is sent and received over a network. It is a foundational protocol of the Internet and facilitates communication between devices by assigning unique identifiers, called IP addresses, to each device on a network.
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
- IPv6
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: 192.168.0.1
. 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 2^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, each separated by a colon, for example: 2001:0db8:85a3::8a2e:0370:7334
. With 128 bits, we can uniquely identify 2^128 devices, which is 2^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.
Key Features of Internet Protocol
- Addressing
- Each device on a network is assigned a unique IP address.
- Example:
192.168.1.1
(IPv4) or2001:0db8:85a3:0000:0000:8a2e:0370:7334
(IPv6).
- Packet Switching
- Data is broken into smaller units called packets.
- Each packet is transmitted independently and can take different paths to the destination.
- Routing
- Determines the best path for data packets to travel from source to destination.
- Routers use IP addresses to forward packets through networks.
- Stateless Protocol
- IP does not retain information about previous packets. Each packet is treated independently.
- Best Effort Delivery
- IP provides no guarantees of delivery, order, or error correction. These responsibilities fall to higher-level protocols (e.g., TCP).
Classful IPv4 addressing
Classful IPv4 addressing is an early method of dividing the IPv4 address space into fixed-size categories, or classes, to simplify network organization and allocation. Each class has a specific range of IP addresses and a default subnet mask, determined by the leading bits of the IP address.
Structure of an IPv4 Address
- It is represented in dotted decimal notation, e.g.,
192.168.1.1
. - An IPv4 address is a 32-bit binary number divided into four octets (8 bits each).
Classes of IPv4 Addresses
IPv4 addresses were divided into five classes (A, B, C, D, and E) based on the leading bits.
Class A
- Purpose: Large networks.
- Range:
0.0.0.0
to127.255.255.255
. - Default Subnet Mask:
255.0.0.0
(or/8
in CIDR). - Number of Networks: 128 (2^7) addresses.
- Number of Hosts per Network: ~16.7 million (2^24 – 2 for network and broadcast addresses).
- Leading Bits:
0
.
Class B
- Purpose: Medium-sized networks.
- Range:
128.0.0.0
to191.255.255.255
. - Default Subnet Mask:
255.255.0.0
(or/16
in CIDR). - Number of Networks: 16,384 (2^14) addresses.
- Number of Hosts per Network: ~65,534 (2^16 – 2).
- Leading Bits:
10
.
Class C
- Purpose: Small networks.
- Range:
192.0.0.0
to223.255.255.255
. - Default Subnet Mask:
255.255.255.0
(or/24
in CIDR). - Number of Networks: 2,097,152 (2^21) addresses.
- Number of Hosts per Network: 254 (2^8 – 2).
- Leading Bits:
110
.
Class D
- Purpose: Multicasting (sending data to multiple devices simultaneously).
- Range:
224.0.0.0
to239.255.255.255
. - Default Subnet Mask: Not applicable (not used for standard network addressing).
- Leading Bits:
1110
.
Class E
- Purpose: Reserved for experimental or future use.
- Range:
240.0.0.0
to255.255.255.255
. - Default Subnet Mask: Not applicable.
- Leading Bits:
1111
.
Subnet mask
In classful addressing, each class had a fixed number of network and host bits, which makes it easier to identify the class a particular IP belongs to. For example, the IP 10.0.0.1
belongs to class A, with the first octet representing the network address and the remaining octets representing the host address.
A subnet mask is an alternative binary representation of the network and host portions of the IP address. The network bits are represented by 1
‘s whereas the host bits are presented by 0
‘s. For example, the default subnet mask for IP addresses in class A would have the first 8 bits set to 1
, as the first octet in class A represents the network part, while the remaining bits would be set to 0
signifying the host part: 11111111.00000000.00000000.00000000
. A router in a network topology uses the subnet mask to determine and route the messages to the appropriate network and, subsequently, the appropriate host.
Classless Inter-Domain Routing (CIDR)
Coming back to the discussion around the limitations of classful addressing, Classless Inter-Domain Routing (CIDR) was introduced to bypass those limitations and effectively manage IP allocations. It does so with the help of the Variable Length Subnet Mask (VLSM). Instead of relying on a fixed number of bits for the network, CIDR enables using variable lengths of bits to represent the network. This helps with the underutilization of IP addresses, as mentioned above.
But how does a router, in this case, identify the appropriate network? The answer lies in the CIDR notation, which includes the IP block, followed by a slash and the number of selected network part bits.
Let’s look at a few examples to further cement our understanding:
- InÂ
x.x.x.x/24
,Â/24
 represents the number of network bits, which means the given address block contains 28 or 256256 hosts or IP addresses. - Similarly, inÂ
x.x.x.x/20
,Â/20
 represents the number of network bits, which means the given address block contains 212212 or 40964096 hosts or IP addresses. - In the edge case of
/32
network bits, there would only be 11 host IP address. While/0
represents all the 2^32 IP addresses in IPv4.
This makes the underutilization of IP addresses disappear while also enabling us to combine networks by specifying the number of network bits.
Subnetting
Subnetting enables splitting up large networks’ address spaces into smaller subnetworks, which in turn makes network routing more efficient. With the help of subnetting, messages can be delivered efficiently without having to go through several unnecessary hops/routers in the network.
Why Subnetting?
- Efficient IP Utilization: Prevents wasting IP addresses by allocating only the necessary addresses to each subnet.
- Network Isolation: Segregates traffic to reduce congestion and enhance security.
- Simplified Management: Makes troubleshooting and managing devices easier.
- Improved Performance: Limits the size of broadcast domains, reducing unnecessary traffic.
That’s all about the fundamental networking concepts like IP, CIDR, and subnetting. If you have any queries or feedback, please write us at contact@waytoeasylearn.com. Enjoy learning, Enjoy AWS Tutorials.!!