
Fabian Tech Tips

Understanding IP Addresses, Subnetting, and Subnet Masks
Feb 8
11 min read
0
3
0
Understanding IP Addresses, Subnetting, and Subnet Masks
The internet, a global network connecting billions of devices, relies on a sophisticated system of protocols and addressing schemes to ensure seamless communication and data exchange. At the heart of this system lie IP addresses, unique identifiers assigned to every device connected to the internet. This article provides a comprehensive overview of IP addresses, exploring the intricacies of IPv4 and IPv6, their respective address ranges, and the essential concepts of subnetting and subnet masks. To ensure the accuracy and comprehensiveness of the information presented, this article is based on a thorough research process, which included examining various articles and tutorials explaining the structure of IPv4 and IPv6 addresses, subnetting, subnet masks, and real-world scenarios where these concepts are applied1.
IPv4 Addresses
IPv4 (Internet Protocol version 4) addresses are the foundation of the modern internet. These 32-bit numerical labels are assigned to each device connected to a network, enabling them to communicate and exchange data. Represented in dotted decimal notation, an IPv4 address consists of four decimal numbers, each ranging from 0 to 255, separated by dots (e.g., 192.168.1.10). Each number represents an 8-bit binary value, also known as an octet5.
Historically, IPv4 addresses were classified into five categories (A, B, C, D, and E) to accommodate different network sizes and simplify routing16. This class-based system, however, proved to be inefficient in managing the ever-growing number of internet-connected devices, leading to the development of Classless Inter-Domain Routing (CIDR) and the concept of subnetting39.
IPv4 Address Range
The 32-bit structure of IPv4 addresses provides a finite address space of 4,294,967,296 (2<sup>32</sup>) unique addresses14. As the internet expanded rapidly, this limited address space became a significant concern, leading to IPv4 address exhaustion14. To mitigate this issue, various strategies were implemented, including the use of private IP addresses, Network Address Translation (NAT), and the development of IPv6.
IPv4 addresses are categorized into different ranges based on their purpose and functionality:
Public IP Addresses: These addresses are assigned to devices that require direct communication over the internet. They are globally unique and allow different networks to recognize and interact with each other. Public IP addresses are allocated by Internet Service Providers (ISPs) and are accessible from anywhere on the internet5.
Private IP Addresses: These addresses are used within private networks, such as those in homes, offices, or internal organizational setups. They are not routable on the public internet, meaning they cannot be accessed directly from outside the network. This design enhances security by preventing external access to internal devices. Private IP ranges include: 5
| Class | IP Range | Number of Addresses | |---|---|---| | A | 10.0.0.0 - 10.255.255.255 | 16,777,216 | | B | 172.16.0.0 - 172.31.255.255 | 1,048,576 | | C | 192.168.0.0 - 192.168.255.255 | 65,536 |
Special-Use Addresses: Certain IPv4 addresses are reserved for specific purposes and cannot be used for general device addressing. These include: 5
Loopback Addresses: These addresses (127.0.0.1) are used by a device to refer to itself, primarily for testing and diagnostics.
Broadcast Addresses: These addresses (255.255.255.255) are used to send a message to all devices on a network simultaneously.
IPv4 Address Classes
As mentioned earlier, IPv4 addresses were initially categorized into classes to accommodate different network sizes. This classification system, while now largely obsolete, provides a historical context for understanding IP addressing. The table below summarizes the key characteristics of each class: 16
Class | IP Range | Default Subnet Mask | Hosts per Network |
A | 10.0.0.0 - 127.255.255.255 | 255.0.0.0 | 16,777,214 |
B | 128.0.0.0 - 191.255.255.255 | 255.255.0.0 | 65,534 |
C | 192.0.0.0 - 223.255.255.255 | 255.255.255.0 | 254 |
D | 224.0.0.0 - 239.255.255.255 | Reserved for multicast | N/A |
E | 240.0.0.0 - 255.255.255.255 | Reserved for future use | N/A |
Subnetting in IPv4
Subnetting is a crucial technique used to divide a larger network into smaller, more manageable subnetworks, known as subnets24. This division is achieved using a subnet mask, which determines how many bits of the IP address are allocated to the network portion and how many to the host portion23.
Subnetting offers numerous benefits, including:
Efficient IP Address Utilization: By dividing a network into smaller subnets, organizations can maximize the use of their allocated IP addresses, preventing wastage and accommodating more devices24.
Enhanced Network Security: Subnetting allows for the isolation of different network segments, restricting unauthorized access and limiting the impact of security breaches24.
Improved Network Performance: Subnetting helps reduce network congestion and improve performance by limiting broadcast traffic within smaller subnets24.
Simplified Network Management: Smaller subnets are easier to manage and troubleshoot, allowing for more efficient network administration24.
Variable Length Subnet Masks (VLSM)
VLSM is a subnetting technique that allows for the use of subnet masks with varying lengths within the same network22. This provides greater flexibility in allocating IP addresses, enabling network administrators to create subnets of different sizes based on the specific needs of different departments or segments.
Subnet Masks in IPv4
Subnet masks are essential for devices to determine whether another device is on the same network27. They function by separating the IP address into two parts: the network address and the host address26. This separation allows devices to identify which part of the IP address represents the network they are on and which part represents their unique address within that network.
Subnet masks play a critical role in:
Efficient Data Routing: Subnetting, facilitated by subnet masks, divides broadcast domains, reducing the amount of broadcast traffic and making data routing more efficient26.
Enhanced Network Security: Subnet masks enable the isolation of different network segments, enhancing security by restricting access and limiting the impact of security breaches26.
Prolonged IPv4 Lifespan: By enabling the creation of smaller subnetworks, subnet masks help maximize the utilization of IPv4 addresses, extending the lifespan of the limited IPv4 address space26.
IPv6 Addresses
IPv6 (Internet Protocol version 6) is the successor to IPv4, designed to address the limitations of its predecessor, primarily the exhaustion of its address space. IPv6 utilizes a 128-bit address format, providing a vast number of unique addresses, sufficient to accommodate the ever-growing number of internet-connected devices5.
IPv6 Address Range
IPv6 addresses range from 0000:0000:0000:0000:0000:0000:0000:0000 to ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff8. They are represented as eight groups of four hexadecimal digits, each group representing 16 bits10. The groups are separated by colons (:). An example of an IPv6 address is: 2001:0db8:85a3:0000:0000:8a2e:0370:733410.
Structure of a Global Unicast Address
A global unicast address in IPv6 is structured hierarchically, consisting of three main parts: 9
Site Prefix: The leftmost three fields (48 bits) represent the site prefix, typically allocated to an organization by an ISP or Regional Internet Registry (RIR).
Subnet ID: The next field (16 bits) is the subnet ID, allocated within an organization to create smaller subnetworks.
Interface ID: The rightmost four fields (64 bits) contain the interface ID, a unique identifier for a specific network interface on a device.
IPv6 Addresses in URLs
When IPv6 addresses are used in URLs, they are enclosed in square brackets to avoid ambiguity and ensure proper interpretation by web browsers and other applications10. For example, a URL with an IPv6 address would look like this: http://[2001:db8:85a3:8d3:1319:8a2e:370:7348]/.
Subnetting in IPv6
Subnetting in IPv6 differs fundamentally from IPv4. While IPv4 subnetting is primarily driven by the need to conserve the limited address space, IPv6 subnetting focuses on creating a hierarchical network structure and improving routing efficiency22.
In IPv6, the smallest possible individual allocation is a subnet for 2<sup>64</sup> hosts, which is the square of the size of the entire IPv4 internet14. This abundance of addresses means that address utilization ratios will be relatively small on any IPv6 network segment14.
Subnet Masks in IPv6
In IPv6, the concept of subnet masks is replaced by prefix notation23. The prefix length, written after the address (e.g., 2001:db8::/48), indicates the number of bits used for the network portion of the address.
Anycast Addresses
IPv6 introduces a new type of address called anycast addresses3. Unlike unicast addresses, which identify a single interface, anycast addresses identify a group of interfaces, typically belonging to different nodes. When a packet is sent to an anycast address, it is delivered to the nearest interface in the group, based on routing metrics. Anycast addresses are often used for services that need to be highly available and geographically distributed.
Solicited-Node Multicast Addresses
Solicited-node multicast addresses are a special type of multicast address in IPv6 used for neighbor discovery and duplicate address detection21. Each unicast address has a corresponding solicited-node multicast address, which is used by devices to send neighbor solicitation messages and resolve link-layer addresses.
Subletting IP Addresses
Subletting IP addresses, also known as IP address leasing, involves allocating a portion of an organization's assigned IP address space to another entity. This practice can be beneficial for organizations with unused IP addresses, allowing them to generate revenue and optimize resource utilization.
Benefits of Subletting IP Addresses
Revenue Generation: Organizations can lease unused IP addresses to other entities, generating additional revenue.
Efficient Resource Utilization: Subletting allows for the efficient use of IP address space, preventing wastage and maximizing resource allocation.
Support for Network Growth: Subletting can provide the sublessee with additional IP addresses to support their network expansion.
Potential Drawbacks of Subletting IP Addresses
Security Risks: If the sublessee does not implement proper security measures, subletting can introduce security risks to the sublessor's network.
Reduced Control: Subletting reduces the sublessor's control over the use of their IP addresses, potentially leading to issues if the sublessee misuses the addresses.
Administrative Overhead: Managing sublease agreements and ensuring compliance can create administrative overhead for the sublessor.
Calculating Subnet Masks
IPv4
Calculating subnet masks in IPv4 involves determining the appropriate number of bits to allocate to the network and host portions of the address. This can be done using the following steps: 28
Determine the number of subnets required.
Calculate the number of bits needed to represent the subnets. This can be done using the formula 2<sup>n</sup>, where 'n' is the number of bits.
Subtract the number of subnet bits from 32 (the total number of bits in an IPv4 address). This gives you the number of host bits.
Create the subnet mask by setting the network bits to 1 and the host bits to 0.
Example:
Let's say you need to create 4 subnets from the network 192.168.1.0/24.
You need 4 subnets.
2<sup>2</sup> = 4, so you need 2 bits for subnets.
32 - 2 = 30, so you have 30 host bits.
The subnet mask in binary is 11111111.11111111.11111111.11111100, which is 255.255.255.252 in decimal notation.
IPv6
Calculating subnet masks in IPv6 is generally simpler than in IPv4. The most common subnet mask for IPv6 is /64, which provides an ample number of addresses for most networks34. However, you can use different prefix lengths to create subnets of varying sizes25.
Real-World Examples of Subnetting
Subnetting is a fundamental technique used in various real-world networking scenarios, including:
Home Networks: Home routers typically use a default address range of 192.168.0.0 through 192.168.0.255 (192.168.0.0/24) to create a private network for devices within the home. This allows devices like computers, smartphones, and printers to communicate with each other while remaining inaccessible from the public internet14.
Corporate Networks: Large companies rely heavily on subnetting to divide their networks into smaller, more manageable segments. This segmentation often separates departments, such as human resources, finance, and IT, or different types of devices, such as servers, workstations, and printers. This enhances security, improves network performance, and simplifies network management47.
Data Centers: Data centers, which house a large number of servers and network devices, utilize subnetting to isolate different services and customers. This isolation improves security by preventing unauthorized access and enhances performance by optimizing traffic flow within each subnet.
Internet Service Providers (ISPs): ISPs use subnetting to efficiently allocate IP addresses to their customers. By dividing their address space into smaller subnets, ISPs can provide internet access to a large number of users while managing their network infrastructure effectively.
Conclusion
IP addresses, subnetting, and subnet masks are foundational elements of modern networking. Understanding these concepts is essential for anyone involved in network design, administration, or security. As the internet continues to evolve and the number of connected devices grows exponentially, the transition from IPv4 to IPv6 is becoming increasingly critical. IPv6, with its vast address space and simplified subnetting scheme, provides a scalable and efficient solution to meet the demands of the future internet. By embracing IPv6 and implementing proper subnetting techniques, organizations can ensure the continued growth, stability, and security of their networks and the internet as a whole.
Works cited
1. docs.oracle.com, accessed on February 6, 2025, https://docs.oracle.com/cd/E19683-01/806-4075/ipref-1/index.html#:~:text=An%20IPv4%20address%20is%20typically,as%20the%20dotted%2Ddecimal%20format.
2. Parts of the IPv4 Address (System Administration Guide: IP Services), accessed on February 6, 2025, https://docs.oracle.com/cd/E19683-01/806-4075/ipref-1/index.html
3. Understanding IPv4 and IPv6 Protocol Families | Junos OS - Juniper Networks, accessed on February 6, 2025, https://www.juniper.net/documentation/us/en/software/junos/interfaces-security-devices/topics/topic-map/security-interface-ipv4-ipv6-protocol.html
4. Parts of the IPv4 Address (System Administration Guide, Volume 3), accessed on February 6, 2025, https://docs.oracle.com/cd/E19455-01/806-0916/6ja85399u/index.html
5. Understanding IP Addresses: Types, Structure, and Management - Atera, accessed on February 6, 2025, https://www.atera.com/glossary/ip-addressing/
6. What is IPv4? - GeeksforGeeks, accessed on February 6, 2025, https://www.geeksforgeeks.org/what-is-ipv4/
7. sites.google.com, accessed on February 6, 2025, https://sites.google.com/site/amitsciscozone/ipv6/ipv6-addressing-architecture#:~:text=IPv6%20addresses%20are%20notified%20in,%3A%200000%3A%20ABDC%3A%200FF0.
8. IPv6 address formats - IBM, accessed on February 6, 2025, https://www.ibm.com/docs/en/i/7.4?topic=concepts-ipv6-address-formats
9. IPv6 Addressing Overview - System Administration Guide: IP Services, accessed on February 6, 2025, https://docs.oracle.com/cd/E18752_01/html/816-4554/ipv6-overview-10.html
10. IPv6 address - Wikipedia, accessed on February 6, 2025, https://en.wikipedia.org/wiki/IPv6_address
11. Knowledge Base - IPv6 Addressing Architecture - Google Sites, accessed on February 6, 2025, https://sites.google.com/site/amitsciscozone/ipv6/ipv6-addressing-architecture
12. IPv6 Addressing Format and Conventions - GeeksforGeeks, accessed on February 6, 2025, https://www.geeksforgeeks.org/ipv6-addressing-format-and-conventions/
13. Intro to Networking - IPv4 Addressing & Subnets - Ubiquiti Help Center, accessed on February 6, 2025, https://help.ui.com/hc/en-us/articles/115005968648-Intro-to-Networking-IPv4-Addressing-Subnets
14. IP address - Wikipedia, accessed on February 6, 2025, https://en.wikipedia.org/wiki/IP_address
15. IPv4 - Wikipedia, accessed on February 6, 2025, https://en.wikipedia.org/wiki/IPv4
16. IPv4 Classes: What are They & How are They Used - Hostwinds, accessed on February 6, 2025, https://www.hostwinds.com/blog/ipv4-classes-what-are-they-and-how-are-they-used
17. Understanding IP Addressing and CIDR Charts — RIPE Network Coordination Centre, accessed on February 6, 2025, https://www.ripe.net/about-us/press-centre/understanding-ip-addressing/
18. What you need to know about IPv6 - Red Hat, accessed on February 6, 2025, https://www.redhat.com/en/blog/what-you-need-know-about-ipv6
19. Getting IPv6/64 ranges - Server Fault, accessed on February 6, 2025, https://serverfault.com/questions/868439/getting-ipv6-64-ranges
20. Help:Range blocks/IPv6 - MediaWiki, accessed on February 6, 2025, https://www.mediawiki.org/wiki/Help:Range_blocks/IPv6
21. IPv6 Address Types - NetworkAcademy.io, accessed on February 6, 2025, https://www.networkacademy.io/ccna/ipv6/ipv6-address-types
22. hlcs.it, accessed on February 6, 2025, https://hlcs.it/files/HCNA_ReS/1/ReS1.09%20Subnetting.pdf
23. IPv4 vs IPv6: Subnetting Differences | NSC - NetSecCloud, accessed on February 6, 2025, https://netseccloud.com/ipv4-vs-ipv6-subnetting-differences
24. A Beginner's Guide to Subnetting IPv4 and IPv6 Addresses - Interlir networks marketplace, accessed on February 6, 2025, https://interlir.com/2024/12/26/a-beginners-guide-to-subnetting-ipv4-and-ipv6-addresses/
25. Subnet masks (IPv4) and prefixes (IPv6) - IBM, accessed on February 6, 2025, https://www.ibm.com/docs/en/ts3500-tape-library?topic=formats-subnet-masks-ipv4-prefixes-ipv6
26. What is an IPv4 Subnet Mask? - Explainer - Brander Group, accessed on February 6, 2025, https://brandergroup.net/2021/02/what-is-ipv4-subnet-mask/
27. I'm mildly confused what the purpose of a subnet mask is : r/CompTIA - Reddit, accessed on February 6, 2025, https://www.reddit.com/r/CompTIA/comments/n6h7og/im_mildly_confused_what_the_purpose_of_a_subnet/
28. Easy IPv4 Subnetting and Mask Calculation Method - Interlir networks marketplace, accessed on February 6, 2025, https://interlir.com/2024/02/19/easy-ipv4-subnetting-and-mask-calculation-method/
29. Subnet Mask Calculator – Accurate IPv4 & IPv6 Network Calculation Tool - GeeksforGeeks, accessed on February 6, 2025, https://www.geeksforgeeks.org/subnet-mask-calculator/
30. IP Subnet Calculator | IPTP Networks, accessed on February 6, 2025, https://www.iptp.net/en_US/iptp-tools/ip-calculator/
31. How to Calculate IPv4 Subnet Masks - Explainer - Brander Group, accessed on February 6, 2025, https://brandergroup.net/2023/06/how-to-calculate-ipv4-subnet-masks/
32. Subnetting - Calculate Subnet Masks & More - Pluralsight, accessed on February 6, 2025, https://www.pluralsight.com/resources/blog/tech-operations/simplify-routing-how-to-organize-your-network-into-smaller-subnets
33. www.techtarget.com, accessed on February 6, 2025, https://www.techtarget.com/searchnetworking/tip/IP-addressing-and-subnetting-Calculate-a-subnet-mask-using-the-hosts-formula#:~:text=To%20calculate%20the%20subnet%20mask,Subnet%20mask%20functionality.
34. IPv6 Subnetting Explained - subnettingpractice.com, accessed on February 6, 2025, https://subnettingpractice.com/how-to-subnet-ipv6.html
35. IPv6 Subnet Calculator - subnettingpractice.com, accessed on February 6, 2025, https://subnettingpractice.com/ipv6-subnet-calculator.html
36. www.geeksforgeeks.org, accessed on February 6, 2025, https://www.geeksforgeeks.org/introduction-to-subnetting/#:~:text=It%20is%20a%20way%20to,data%20traffic%20separate%20from%20others.
37. Networking Basics: What is IPv4 Subnetting? - CBT Nuggets, accessed on February 6, 2025, https://www.cbtnuggets.com/blog/technology/networking/networking-basics-what-is-ipv4-subnetting
38. What Is IP Subnetting? How to Subnet IP Network Addresses - Network Computing, accessed on February 6, 2025, https://www.networkcomputing.com/ip-subnetting/what-is-ip-subnetting-how-to-subnet-ip-network-addresses
39. Subnetting: What It Is and How It Works | Auvik, accessed on February 6, 2025, https://www.auvik.com/franklyit/blog/subnetting-primer/
40. Introduction To Subnetting - GeeksforGeeks, accessed on February 6, 2025, https://www.geeksforgeeks.org/introduction-to-subnetting/
41. Advantages and Disadvantages of Subnetting - GeeksforGeeks, accessed on February 6, 2025, https://www.geeksforgeeks.org/advantages-and-disadvantages-of-subnetting/
42. The Pros and Cons of Subleasing in a Lease Contract - FasterCapital, accessed on February 6, 2025, https://fastercapital.com/content/The-Pros-and-Cons-of-Subleasing-in-a-Lease-Contract.html
43. What is Subnetting? How it Works? Characteristics & Drawbacks - Simplilearn.com, accessed on February 6, 2025, https://www.simplilearn.com/tutorials/cyber-security-tutorial/what-is-sub-netting
44. What is Subnetting, Benefits, and How does it Work? - Field Engineer, accessed on February 6, 2025, https://www.fieldengineer.com/skills/subnetting
45. 5 Subnetting Benefits - Network Computing, accessed on February 6, 2025, https://www.networkcomputing.com/ip-subnetting/5-subnetting-benefits
46. A COMPLETE BEGINNER'S GUIDE TO SUBNETTING - network fun-times, accessed on February 6, 2025, https://www.networkfuntimes.com/a-complete-beginners-guide-to-subnetting/
47. Practical Examples of Subnetting in Small and Large Networks | NSC - NetSecCloud, accessed on February 6, 2025, https://netseccloud.com/practical-examples-of-subnetting-in-small-and-large-networks
48. Understand TCP/IP addressing and subnetting basics - Microsoft Learn, accessed on February 6, 2025, https://learn.microsoft.com/en-us/troubleshoot/windows-client/networking/tcpip-addressing-and-subnetting
49. What are some real life examples of how a subnet mask is used in an office space? - Reddit, accessed on February 6, 2025, https://www.reddit.com/r/HomeNetworking/comments/14jznlx/what_are_some_real_life_examples_of_how_a_subnet/
50. IP Addresses and Subnet Masks - Shure, accessed on February 6, 2025, https://service.shure.com/s/article/ip-addresses-and-subnet-masks
51. A Comprehensive Guide to IPv4 and IPv6 CIDR | IP2Location.com, accessed on February 6, 2025, https://blog.ip2location.com/knowledge-base/a-comprehensive-guide-to-ipv4-and-ipv6-cidr/
52. What is a Subnet Mask? Examples, Uses and Benefits - Auvik Networks, accessed on February 6, 2025, https://www.auvik.com/franklyit/blog/what-is-subnet-mask/
53. Calculating Subnet Masks: Tools and Techniques | NSC - NetSecCloud, accessed on February 6, 2025, https://netseccloud.com/calculating-subnet-masks-tools-and-techniques
54. www.networkacademy.io, accessed on February 6, 2025, https://www.networkacademy.io/ccna/ip-subnetting/what-is-subnetting#:~:text=IP%20subnetting%20is%20the%20process,optimize%20their%20IP%20address%20usage.
55. Subnetting an IP Address - cloudfront.net, accessed on February 6, 2025, https://d12vzecr6ihe4p.cloudfront.net/media/966010/wp-subnetting-an-ip-address.pdf
56. 8 Steps to Understanding IP Subnetting in 2025 - Techopedia, accessed on February 6, 2025, https://www.techopedia.com/8-steps-to-understanding-ip-subnetting