DEV Community

Cover image for Day 4: IP Addressing and Subnetting
arjun
arjun

Posted on

Day 4: IP Addressing and Subnetting

Day 4: IP Addressing and Subnetting

πŸ“… Date: 3-2-2025

The Internet Protocol (IP) Addressing system is the foundation of modern networking, enabling devices to communicate over the Internet and private networks. Whether you’re streaming a video, sending an email, or browsing a website, IP addressing ensures that data reaches the correct destination.

In this article, we'll explore IPv4 vs. IPv6, Public vs. Private IPs, the basics of subnetting, and how CIDR notation helps manage IP networks efficiently.


What is an IP Address? (IPv4 vs. IPv6)

An IP address is a unique numerical identifier assigned to devices for communication over a network. There are two versions in use today:

1️⃣ IPv4 (Internet Protocol version 4)

βœ” Format: 32-bit address (e.g., 192.168.1.1)

βœ” Total Addresses: ~4.3 billion

βœ” Uses Dotted Decimal Notation

βœ” Example: 192.168.0.1

βœ” Limitation: Due to the rapid growth of the Internet, IPv4 addresses are running out.

2️⃣ IPv6 (Internet Protocol version 6)

βœ” Format: 128-bit address (e.g., 2001:db8::1)

βœ” Total Addresses: 340 undecillion (virtually unlimited)

βœ” Uses Hexadecimal Notation

βœ” Example: 2001:0db8:85a3:0000:0000:8a2e:0370:7334

βœ” Advantage: Provides a much larger address space and improved security features.

πŸ‘‰ Why IPv6? The demand for unique IP addresses is growing with IoT devices, cloud computing, and global digital expansion. IPv6 ensures the Internet can scale without address shortages.


Public vs. Private IP Addresses

IP addresses are categorized into public and private based on their accessibility on the Internet.

Public IP Address

βœ” Assigned by Internet Service Providers (ISPs)

βœ” Unique across the Internet

βœ” Used to identify devices globally

βœ” Example: 8.8.8.8 (Google’s DNS Server)

Private IP Address

βœ” Used within local networks (LANs)

βœ” Not routable on the Internet

βœ” Helps conserve public IPs

βœ” Examples:

  • Class A: 10.0.0.0 – 10.255.255.255
  • Class B: 172.16.0.0 – 172.31.255.255
  • Class C: 192.168.0.0 – 192.168.255.255

πŸ’‘ Key Point: Private IPs require Network Address Translation (NAT) to communicate with the Internet.


Introduction to Subnetting and Why It’s Important

Subnetting is the process of dividing a larger IP network into smaller, more manageable sub-networks (subnets). It improves network efficiency, security, and performance.

βœ… Why Subnetting?

  • Efficiently utilizes IP addresses by reducing waste.
  • Enhances network security by isolating sensitive parts of the network.
  • Reduces network congestion by segmenting traffic.
  • Enables better network management and scalability.

How to Calculate Subnets (CIDR Notation)

CIDR (Classless Inter-Domain Routing) is a method used to allocate IP addresses more efficiently.

Understanding CIDR Notation

CIDR uses a slash (/) followed by the number of bits used for the network portion. For example:

  • 192.168.1.0/24 β†’ 24 bits for network, 8 bits for hosts
  • 10.0.0.0/16 β†’ 16 bits for network, 16 bits for hosts

Subnet Calculation Example

If you have 192.168.1.0/24 and want to create 4 subnets:

  • Formula: 2^x β‰₯ Number of subnets
  • x = Number of bits borrowed from host portion
  • 2Β² = 4 β†’ Borrow 2 bits β†’ Subnet mask: /26 (255.255.255.192)

Resulting subnets:
| Subnet | Network Address | Usable IPs | Broadcast Address |
|--------|----------------|-----------|------------------|
| 1 | 192.168.1.0/26 | 192.168.1.1 - 192.168.1.62 | 192.168.1.63 |
| 2 | 192.168.1.64/26 | 192.168.1.65 - 192.168.1.126 | 192.168.1.127 |
| 3 | 192.168.1.128/26 | 192.168.1.129 - 192.168.1.190 | 192.168.1.191 |
| 4 | 192.168.1.192/26 | 192.168.1.193 - 192.168.1.254 | 192.168.1.255 |

πŸ’‘ Key Takeaway: Subnetting allows for better resource allocation and network organization.


Conclusion

Understanding IP addressing and subnetting is essential for network engineers, system administrators, and developers.

βœ” IPv4 vs. IPv6 β†’ IPv6 solves the address exhaustion issue.
βœ” Public vs. Private IPs β†’ Private IPs need NAT for Internet access.
βœ” Subnetting β†’ Helps optimize and secure networks.
βœ” CIDR Notation β†’ Efficient way to manage IP allocations.

πŸš€ Coming up in Day 5: We'll dive into Routing & Packet Forwardingβ€”a crucial concept for how data moves across networks! Stay tuned. 😊

Top comments (0)