binary math wallpaper.
TCP-IP

Learn IP Addressing From Scratch

IP Addressing is the cornerstone of your entire IT career. Without it, there would be no communication on your network. It’s strange then that many IT people don’t really understand what is going on behind the scenes.

In order to have a firm grasp of IP addressing you need just learn a few simple topics such as how the addresses are created and put into classes. How you can make blocks of IP address and subnet them. There is much more going on beside this but these core topics will take you a long way.

Below is a lesson from our CompTIA Network+ course. I’ve added the video but also the PPT slides and notes from the CCIE instructor Jay Ocampo. Becuase they are PPT notes, they are intended for the instructor to read out so don’t flow the same way as a usual lesson.

Download the presentation here.

I hope you enjoy it. We have a 101 Labs – IP Subnetting course on this website of course. We also have a Learn how to Subnet course for free online.

This lesson is broadly divided into the below topics:

  • INTRODUCTION
  • PUBLIC VS PRIVATE ADDRESSING
  • SUBNETTING
  • IPV4 ADDRESS CLASSES

Introduction to IPv4 Network Addressing

What is IPv4 Network Addressing? – IPv4 network addressing is a system for identifying and locating devices on a network. It provides each device with a unique address, allowing them to communicate and share information with each other. We started out using host names for network devices many years ago, but of course this method quickly became unusable as the number of devices in use grew.

Function of IPv4 Addressing—The primary function of IPv4 addressing is to enable TCP/IP communication between devices on a network. Think of it as a postal (zip) code system for the Internet. Each device has a specific address (house number plus postal code or zip code), allowing data packets to be routed to the correct destination.

Need for IPv4 Addressing—In a network, each device needs a unique address to differentiate itself from others. This is crucial for efficient and error-free data transmission. Without unique addresses, data packets could be sent to the wrong device or lost along the way. When we used host names for devices, we also used floppy disks to manually copy data from one device and then walk to the other to copy it over.

Examples of IPv4 Addresses – An IPv4 address is represented as four sets of numbers separated by periods, like 192.168.1.1. Each set of numbers ranges from 0 to 255, representing a unique location within the network. These addresses are crucial for routing and identifying devices in the complex world of Internet communication.

Public vs. Private IP Addresses

public vs private IP address
Public IP Addresses

Public IP addresses are assigned to devices that need to communicate directly across the public internet. They are globally unique, ensuring that each device can be reached anywhere online. These addresses are assigned by Internet Service Providers (ISPs) and are typically used for web servers, email servers, and other internet-facing services. Think of a public IP address as the street address of a house, allowing visitors to find it within a city.

Private IP Addresses

Private IP addresses are free to be used by any person or company and are assigned to devices within a local network, such as a home or office network. These addresses are not globally unique or routable on the Internet because the same address can be used many times over. Private IP addresses are typically used for internal devices, such as computers, printers, and other local network devices. Think of private IP addresses as the room numbers within a house, allowing residents to find each other easily.

Security Benefits of Private IP Addresses

Using private IP addresses for internal networks provides security benefits. By hiding internal devices from the public internet, private networks are less susceptible to unauthorized access. Private networks are also more efficient, as they do not require global addressing, which is a more complex and resource-intensive. This separation helps to keep internal networks secure and improve overall network performance.

Automatic Private IP Addressing (APIPA)

APIPA stands for Automatic Private IP Addressing.

Automatic Private IP Addressing (APIPA) was first used by Windows 98. It is a mechanism that enables devices on a network to communicate even when a DHCP server is unavailable. When a device is connected to a network, it typically relies on a DHCP server to assign it a unique IP address. However, when a DHCP server is not functioning or is not present, APIPA steps in to provide basic network connectivity.

APIPA allows devices to self-assign IP addresses from a specific range, ensuring that they can communicate with each other within the local network. This mechanism is crucial for small home networks or when a DHCP server is temporarily down. It prevents devices from being completely isolated and ensures they can continue exchanging data within their local environment.

The address range used for APIPA is 169.254.0.0/16. This range is specifically reserved for devices using APIPA and is not routable on the Internet. APIPA addresses are assigned dynamically and are typically only valid for the duration of the network connection.

RFC1918

RFC 1918 first defined IP addressing so it's worth reading.

RFC 1918 defines specific IP address ranges reserved for private use. This standard is crucial in network management and security. These are the private IP addresses we mentioned earlier.

The primary function of RFC 1918 is to reserve specific IP address ranges for private networks. These ranges are designated explicitly for use within local networks, such as home networks, corporate intranets, or small office environments. Devices within a private network use these addresses for internal communication.

The need for RFC 1918 arises from the limited availability of public IP addresses. The numbering system was first devised when very few devices needed routable IP addresses, but of course, this changed quickly as home computing became affordable. By reserving specific ranges for private networks, RFC 1918 helps avoid IP address conflicts and efficiently utilizes publicly routable addresses. This standard allows organizations to use private IP addresses for internal communications while conserving the pool of public IP addresses for internet-facing services.

RFC 1918 defines three primary private IP address ranges:

  • 10.0.0.0/8
  • 172.16.0.0/12
  • 192.168.0.0/16

These ranges are not routable on the public internet and are specifically designated for private network use. When a device with a private IP address needs to communicate with a device on the public internet, a network address translation (NAT) device typically translates the private IP address to a public IP address. This allows the device to access the internet while maintaining the security and efficiency of private network addressing.

Loopback/localhost

Loopback address is used for testing the TCP stack.

What is it? – The loopback address, commonly called localhost, is a unique IP address used for testing and troubleshooting network applications. It serves as a virtual network interface that allows a device to communicate with itself, bypassing any external connections.

Function – The primary function of the loopback address is to facilitate local testing and troubleshooting of network applications without relying on external network connectivity. This enables developers and network administrators to verify the functionality of network protocols, services, and applications within a controlled environment. You can in effect, ping yourself to test if the TCP/IP stack is working on your computer.

Need – The loopback address is essential for ensuring the proper functioning of a device’s network stack. It provides a mechanism for testing network configuration, software components, and application logic without requiring a physical network connection. This isolation allows for focused testing and debugging, helping to identify and resolve network issues efficiently.

Example: – The loopback address is universally assigned as 127.0.0.1. This address is reserved for local communication and is not routable on the Internet. When a device sends a packet to this address, the packet is immediately looped back to the sending application, effectively simulating a local connection. This allows for self-testing and debugging of network functions.

Subnetting Overview

IP Subnetting summary. learn the address classes and subnets.

Subnetting is a method used in network administration to divide a more extensive network into smaller, more manageable subnetworks. This process is essential for efficiently allocating IP addresses, improving network performance, and enhancing security.

Subnetting involves borrowing bits from the host portion of an IP address and using them to create additional network bits. This allows for creating multiple subnetworks within a single network, enabling better organization, resource management, and security. Each subnetwork has its unique subnet mask, which defines the network and host portions of the addresses within that subnet.

For example, a Class C network with a default subnet mask of 255.255.255.0 can be subnetted into multiple smaller subnetworks using a different subnet mask. This allows for more efficient utilization of IP addresses, as each subnetwork can be assigned a specific range of addresses based on its size and requirements. The more host bits you steal, the fewer hosts you get per subnet, but the more subnets you get.

Variable Length Subnet Mask (VLSM)

vlsm allows you to carve subnets out of a network address.

What is it? – Variable Length Subnet Mask (VLSM) allows for varying subnet mask lengths within a network. This flexibility in network design provides optimized IP address usage and enhances network efficiency. It breaks the fixed subnets allocated for address classes which are /8, /16, and /24 for Class A, B, and C.

Function – VLSM optimizes IP address usage by allowing you to create subnets of different sizes based on the specific needs of different network segments. Instead of using a uniform subnet mask across the entire network, VLSM allows you to tailor the subnet mask length to the number of devices or hosts that need to be connected in each subnet. This results in a more efficient allocation of IP addresses and reduces waste, especially in large and complex networks.

Need – The need for VLSM arises from the desire to create a more flexible and efficient network design. Traditional subnetting methods often involve using a fixed subnet mask across the entire network, which may not be optimal for all segments. VLSM addresses this limitation by allowing network administrators to customize subnet mask lengths for specific subnets, resulting in a more efficient allocation of IP addresses.

Examples: Imagine a network with two segments: a large department with many workstations and a small server room with only a few servers. By using VLSM, you can create a large subnet for the department, accommodating many workstations, and a smaller subnet for the server room, providing enough IP addresses for the servers while conserving addresses for other network segments. This approach ensures that you have sufficient IP addresses for each segment without wasting addresses unnecessarily.

Classless Inter-domain Routing (CIDR)

cidr stands for classless inter domain routing.

What is it? – Classless Inter-domain Routing (CIDR) is a revolutionary addressing scheme that fundamentally changed the way IP addresses are allocated and managed on the internet. It represents a significant advancement over the traditional classful addressing system, providing greater flexibility, efficiency, and scalability.

Function—CIDR’s primary function is to optimize IP address allocation and route aggregation. It enables more efficient utilization of IP address space, reduces the size of routing tables, and simplifies network management. This efficiency is crucial for handling the ever-increasing number of devices and networks connecting to the Internet. Instead of your company advertising 30 different IP addresses it summarizes it into one.

Need – CIDR arose from the need for a more flexible and efficient IP address allocation method. The traditional classful addressing system, which divided IP addresses into distinct classes based on their network portion, became increasingly inefficient as the internet grew. CIDR addressed this by allowing for variable-length subnet masks, enabling a more granular allocation of IP addresses and reducing the number of routing entries needed to manage the internet’s vast network infrastructure.

For example, CIDR notation uses a slash (/) followed by a number to represent the subnet mask. For example, 192.168.1.0/24 indicates a network with a subnet mask of 255.255.255.0. This concise notation clearly represents the network and host portions of an IP address, making it easier for network administrators and routing devices to understand and manage network configurations.

IPv4 Address Classes Overview

IPv4 Address Classes Overview

IPv4 Address Classes are a historical categorization of IP addresses used for allocating IP address space efficiently. While this system is still relevant for understanding network concepts, it has been largely superseded by the more flexible and efficient Classless Inter-domain Routing (CIDR) system. We still need to understand address classes in order to make sense of IPv4, VLSM, CIDR and other addressing systems.

The original IPv4 address classes were designed to simplify network administration and address allocation. Each class represented a specific range of IP addresses with varying network and host portions. This system allowed for the creation of networks of different sizes, from small home networks to large enterprise networks.

Class A IP Addresses 

Class A addresses are used for large networks, ranging from 1.0.0.0 to 126.0.0.0. These addresses have a network portion of 8 bits, leaving 24 bits for the host portion. This allows for a maximum of 16,777,214 unique host addresses within a Class A network.

Class B IP Addresses 

Class B addresses are suitable for medium-sized networks, ranging from 128.0.0.0 to 191.255.0.0. They have a network portion of 16 bits, leaving 16 bits for the host portion. Class B networks can accommodate up to 65,534 unique host addresses.

Class C IP Addresses 

Class C addresses are designed for smaller networks and range from 192.0.0.0 to 223.255.255.0. They have a network portion of 24 bits, leaving 8 bits for the host portion, allowing for a maximum of 254 unique host addresses.

Class D & E IP Addresses 

Class D and Class E addresses are reserved for special purposes. Class D addresses are used for multicast communication, where a single packet can be transmitted to multiple recipients simultaneously. Class E addresses are reserved for experimental purposes, allowing for future development and innovation in network technology.

We’ll go into more detail below.

Class A IP Addresses

What is it? – Class A is the first class of IP addresses in the original IPv4 addressing scheme. This classification system was designed to categorize IP addresses based on their network and host portions, making it easier to allocate addresses and manage networks.

Function – Class A addresses were primarily intended for large networks, which require a significant number of IP addresses to accommodate a vast number of devices. They were often used by major organizations, internet service providers (ISPs), and government agencies with extensive network infrastructure.

Need – The need for Class A addresses stemmed from the desire to allocate a large number of IP addresses efficiently to large organizations and networks. This class allowed for a wide range of unique host addresses within a single network, supporting the connection of numerous devices and services.

Range – Class A addresses range from 1.0.0.0 to 126.0.0.0. This range is characterized by a network portion of 8 bits, leaving 24 bits for the host portion. This configuration allows for up to 16,777,214 unique host addresses within a single Class A network. However, it’s important to note that not all addresses within this range are actually used due to reserved addresses and limitations in the addressing scheme.

Class B IP Addresses

Class B represents the second class of IP addresses in the historical IPv4 addressing scheme. Though largely superseded by Classless Inter-domain Routing (CIDR), this classification system remains relevant for understanding network concepts.

Class B addresses are designed for medium-sized networks catering to organizations with moderate networking needs. They balance the extensive address space of Class A networks and the more limited capacity of Class C networks.

The range of Class B addresses spans from 128.0.0.0 to 191.255.0.0. This range is characterized by a network portion of 16 bits, leaving 16 bits for the host portion. This configuration allows a maximum of 65,534 unique host addresses within a single Class B network.

Medium-sized businesses, schools, and government agencies commonly used class B networks. Their moderate size provided sufficient capacity to accommodate these organizations’ connectivity needs while remaining manageable in terms of IP address allocation and network administration.

Class C IP Addresses

Class C represents the third class of IP addresses in the historical IPv4 addressing scheme. Though largely superseded by Classless Inter-domain Routing (CIDR), this classification system remains relevant for understanding network concepts.

Class C addresses are designed for smaller networks, catering to organizations with limited networking needs. They are ideal for home networks, small offices, or departments within larger organizations. Class C addresses offer a balance between providing enough IP addresses for a small network while minimizing the number of addresses assigned to each network.

The range of Class C addresses spans from 192.0.0.0 to 223.255.255.0. This range is characterized by a network portion of 24 bits, leaving 8 bits for the host portion. This configuration allows for a maximum of 254 unique host addresses within a single Class C network.

Class C addresses became popular due to their suitability for small networks and the efficient use of IP address space. However, as the Internet grew and the demand for IP addresses increased, the limitations of the Classful Addressing system became apparent. Classless Inter-domain Routing (CIDR) emerged as a more flexible and efficient alternative, offering more granular control over IP address allocation and network management.

Class D IP Addresses

What is it? – Class D IP addresses represent the fourth class within the historical IPv4 addressing scheme. While the original system is largely superseded by Classless Inter-domain Routing (CIDR), understanding Class D addresses remains relevant for comprehending network concepts.

Function – Class D addresses are specifically designated for multicast communication. Unlike unicast communication, where a message is sent from one source to a single destination, multicast communication allows a single message to be transmitted from one source to multiple destinations simultaneously.

Need – The need for multicast communication arose from the desire to efficiently transmit data to multiple recipients in a network. This is particularly valuable for scenarios like video conferencing, live streaming, and network management, where distributing information to a group of devices is essential.

Range – Class D addresses range from 224.0.0.0 to 239.255.255.0. This range is characterized by a network portion of 4 bits, leaving the remaining 28 bits for the host portion. The limited range of host addresses is intentional as Class D addresses are primarily used for network-wide communication rather than addressing individual devices.

Class E IP Addresses

Class E represents the fifth and final class of IP addresses in the historical IPv4 addressing scheme. This classification system, though largely superseded by Classless Inter-domain Routing (CIDR), remains relevant for understanding network concepts. While Class A, B, and C addresses are used for everyday network communication, Class D addresses are reserved for multicast communication, and Class E addresses are reserved for specific purposes.

Class E addresses are not typically used for general network communication. They are designated for experimental and research purposes, allowing for the development and testing of new network protocols and technologies. These addresses provide a dedicated space for network researchers and developers to explore innovative ideas and concepts without impacting the existing Internet infrastructure.

The range of Class E addresses spans from 240.0.0.0 to 255.255.255.255. This range is characterized by a network portion of 5 bits, leaving 27 bits for the host portion. This configuration allows for a maximum of 134,217,726 unique host addresses within a single Class E network.

However, it is important to note that only a small portion of these addresses are actually used in practice due to their dedicated experimental purpose.

Exercise

You are given the IP address 192.168.1.0/24. Subnet this address into 4 equal subnets.

  • What are the subnet masks for the 4 subnets?
  • What are the IP ranges for each subnet?
  • What are the broadcast addresses for each subnet?

Understanding the Basics

Start by understanding the concepts of network and host bits. The subnet mask determines the network portion and the host portion of an IP address. In this case, the default subnet mask of 255.255.255.0 indicates that the last octet is reserved for host addresses.

Dividing the Network

To create two subnets, you need to borrow one bit from the host portion of the IP address. This effectively doubles the number of subnets you can create. Now, you have 2 subnets with 126 usable host addresses each. Remember that two addresses are always reserved for the network and broadcast addresses.

Calculating Subnet Masks

The subnet mask for each subnet will be 255.255.255.128. The additional bit borrowed from the host portion is represented as 128 in the subnet mask. This indicates that the first bit of the last octet now defines the subnet.

Network and Broadcast Addresses

The network address of the first subnet is 192.168.1.0, and the broadcast address is 192.168.1.127. The network address of the second subnet is 192.168.1.128, and the broadcast address is 192.168.1.255.

Answers

You are given the IP address 192.168.1.0/24. Subnet this address into 4 equal subnets.

Subnet Mask Calculation:

1.The original subnet mask is /24, which means 24 bits are used for the network portion.

2.To create 4 subnets, we need to borrow 2 bits from the host portion (since 2^2 = 4).

3.The new subnet mask will be /26 (24 + 2 = 26).

Subnet Masks for the 4 Subnets:

1.The new subnet mask is 255.255.255.192 (or /26).

IP Ranges for Each Subnet:

1.Subnet 1: 192.168.1.0 – 192.168.1.63

2.Subnet 2: 192.168.1.64 – 192.168.1.127

3.Subnet 3: 192.168.1.128 – 192.168.1.191

4.Subnet 4: 192.168.1.192 – 192.168.1.255

Broadcast Addresses for Each Subnet:

1.Subnet 1: 192.168.1.63

2.Subnet 2: 192.168.1.127

3.Subnet 3: 192.168.1.191

4.Subnet 4: 192.168.1.255

Explanation:

  • Each /26 subnet has 64 IP addresses (2^6 = 64), where the first address is the network address and the last address is the broadcast address. Therefore, each subnet has 62 usable IP addresses.

You can also take our free IP Subnetting Quiz.

101 Labs Newsletter

ipv6 subnetting - 101 Labs - IP Subnetting Available on Amazon. Pass certification exams.

Newsletter Subscribe

Stay Informed, Stay Inspired: Subscribe for Cutting-Edge IT-Certification Insights

101 Labs Newsletter