What is an IP Address?
There are two primary versions of IP addresses:
- IPv4 (Internet Protocol version 4): 32-bit numeric address written in decimal format, e.g.,
192.168.1.1
- IPv6 (Internet Protocol version 6): 128-bit alphanumeric address written in hexadecimal format, e.g.,
2001:0db8:85a3:0000:0000:8a2e:0370:7334
Structure of IPv4 Addresses
IPv4 addresses are divided into four octets, each containing 8 bits, totaling 32 bits. For example:
11000000.10101000.00000001.00000001
Translates to:
192.168.1.1
Each IP address has two main components:
- Network : Identifies the specific network.
- Host : Identifies the device within that network.
IP Address Classes
IPv4 addresses are categorized into five classes (A to E), with Class A, B, and C used for general addressing.
Public vs. Private IP Addresses
Private IP addresses are reserved for internal use within organizations and cannot be routed over the internet.
Public IP addresses are routable on the internet and must be unique across the globe.
What is Subnetting?
Subnetting is the practice of dividing a large network into smaller, manageable sub-networks, or subnets. This enhances performance, improves security, and optimizes IP address allocation.
Each subnet has its own network address and broadcast address, with IPs in between used for hosts.
Understanding Subnet Masks
A subnet mask identifies which portion of an IP address is the network part and which is the host part.
For example:
-
IP:
192.168.1.10
- Subnet Mask:
255.255.255.0
In binary:
IP: 11000000.10101000.00000001.00001010
Subnet: 11111111.11111111.11111111.00000000
Here, the first 24 bits (the network) are fixed, and the last 8 bits (the host) vary.
CIDR Notation Explained
CIDR (Classless Inter-Domain Routing) is a flexible way of assigning IP addresses and subnet masks.
Instead of using default classful subnet masks, CIDR uses a slash notation, e.g., /24
, to define the number of bits used for the network portion.
How to Subnet a Network: Step-by-Step
Let’s say we have a Class C network: 192.168.1.0/24
and we need 4 subnets.
Step 1: Determine the number of subnets needed
To get at least 4 subnets, you need 2 bits (2^2 = 4
).
Step 2: Calculate new subnet mask
Starting with /24
, add 2 bits for subnetting: /26
New Subnet Mask: 255.255.255.192
Step 3: Calculate the range of each subnet
-
Subnet 1:
192.168.1.0 – 192.168.1.63
- Subnet 2:
192.168.1.64 – 192.168.1.127
- Subnet 3:
192.168.1.128 – 192.168.1.191
- Subnet 4:
192.168.1.192 – 192.168.1.255
Each subnet has 64 addresses: 62 usable (excluding network and broadcast).
Benefits of Subnetting
- Improves network performance by reducing broadcast domains.
- Enhances security through segmentation.
- Efficient IP address utilization within organizations.
- Simplifies troubleshooting and management.
- Enables hierarchical addressing in large networks.
IPv6 Addressing Overview
Due to IPv4 exhaustion, IPv6 was introduced, featuring:
- 128-bit addresses
- Written as eight groups of four hexadecimal digits, separated by colons
- Example:
2001:0db8:0000:0042:0000:8a2e:0370:7334
Key Features:
- Vast address space (2^128 addresses)
- Built-in support for auto-configuration and security
- Simplifies routing and subnetting
Subnetting in IPv6
- Subnetting in IPv6 is more straightforward due to its large address space.
- Commonly used prefix:
/64
, meaning the first 64 bits are for network identification. - You can use prefixes like
/48
,/56
,/60
,/64
depending on your hierarchy needs.
IP Addressing and Subnetting Tools
Here are some valuable tools:
- Subnet Calculator: Quickly calculates subnets and IP ranges.
- IP Address Planner: Helps organize IP allocation.
- Whois Lookup Tools: Identifies IP ownership and geo-location.
- Packet Tracer / GNS3 / Cisco Labs: Simulates network configurations for practice.
Best Practices for IP Addressing and Subnetting
- Plan IP schemes in advance to avoid conflicts.
- Reserve IPs for routers, servers, and gateways.
- Use VLSM (Variable Length Subnet Masking) to reduce waste.
- Implement DHCP where possible for dynamic assignment.
- Monitor IP address usage and reclaim unused IPs.
- Document every subnet and its purpose.