A Beginner's Guide to IP Addressing: IPv4 & IPv6 Explained
IP addressing is the foundation of networking. It’s how devices communicate across the internet and within private networks. Whether you’re designing a network or troubleshooting, understanding IP addresses is essential. This guide will break down IP addressing concepts from basic to intermediate levels, covering IPv4, IPv6, subnetting, CIDR notation, public vs. private IPs, and more.
1. What is an IP Address?
An IP address is a unique identifier assigned to each device connected to a network. There are two primary types: IPv4 and IPv6.
2. IPv4 (Internet Protocol version 4)
IPv4 is the most widely used version. It uses 32 bits (4 octets) for the address, and it's written in the format x.x.x.x
, where x
is a number between 0 and 255.
IPv4 Example:
192.168.1.1
IPv4 Address Breakdown:
Network Address: Identifies the network.
Host Address: Identifies the device within that network.
IPv4 Address Types:
Static IP Address: This address doesn’t change.
- Example:
192.168.0.10
(for a web server).
- Example:
Dynamic IP Address: This address is assigned by a DHCP server and can change.
- Example: A home computer gets a new IP each time it connects to the router.
3. IPv6 (Internet Protocol version 6)
IPv6 was developed to overcome the limitations of IPv4, especially the shortage of IP addresses. It uses 128 bits (16 octets), providing a vast number of possible unique addresses.
IPv6 Example:
2001:0db8:85a3:0000:0000:8a2e:0370:7334
IPv6 addresses are written with colon-separated groups of hexadecimal values, often with shorthand to omit leading zeros.
Why IPv6?
IPv4 exhaustion: IPv4 addresses have been exhausted due to internet growth.
Larger address space: IPv6 provides 340 undecillion addresses, solving the shortage.
Improved routing: Simplified and more efficient routing.
4. Subnetting
Subnetting allows you to break a network into smaller, manageable sub-networks (subnets), optimizing the usage of IP addresses.
What is a Subnet Mask?
A subnet mask helps distinguish between the network and host parts of an IP address.
Subnet Mask Example:
255.255.255.0
means the first 24 bits are the network, and the remaining 8 bits are for hosts.
CIDR Notation
CIDR (Classless Inter-Domain Routing) is another way to write IP addresses with their subnet mask. It's written as IP address /subnet bits
.
CIDR Example:
192.168.1.0/24
(24 bits for the network, 8 bits for hosts)
5. Public vs. Private IP Addresses
Private IP addresses are used within local networks and cannot be routed over the internet.
Public IP addresses are used to identify devices on the internet.
Private IP Ranges (IPv4):
10.0.0.0 - 10.255.255.255
172.16.0.0 - 172.31.255.255
192.168.0.0 - 192.168.255.255
Public IP Example:
8.8.8.8
(Google's DNS server)
6. How to Calculate Subnets (Example)
Subnetting involves dividing a network into subnets, which requires understanding how to calculate the subnet mask and ranges.
Example: Subnetting 192.168.1.0/24
into 4 subnets:
Step 1: Borrow 2 bits (because 2^2 = 4) → New subnet mask becomes
/26
.Step 2: Divide the network:
192.168.1.0/26
(Range:192.168.1.0 - 192.168.1.63
)192.168.1.64/26
(Range:192.168.1.64 - 192.168.1.127
)192.168.1.128/26
(Range:192.168.1.128 - 192.168.1.191
)192.168.1.192/26
(Range:192.168.1.192 - 192.168.1.255
)
7. Common IP Addressing Examples
Static IP Example: A company server has a fixed IP,
192.168.1.10
.Dynamic IP Example: A laptop gets a new IP like
192.168.1.100
each time it connects to the network.Private Network Example: Home network uses
192.168.1.0/24
, with devices like192.168.1.5
,192.168.1.10
.Public Network Example: A website might use a public IP like
8.8.8.8
.
Conclusion
Understanding IP addressing is essential for managing networks effectively. By mastering IPv4 and IPv6, subnetting, CIDR notation, and the difference between public and private IPs, you’ll be better equipped to design, troubleshoot, and optimize IP addressing schemes for any network.
If you’re just starting out, don't worry—practice with the examples and keep learning. Network management becomes easier as you dive deeper into these concepts.