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. ๐Ÿ˜Š

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

Top comments (0)