IPV4
Internet Protocol version 4 is the fourth version of the Internet Protocol. It is used to identify devices on a network and route traffic across the internet. It uses a 32-bit address format, allowing for about 4.3 billion unique IP addresses. An IPv4 address is typically written in four octets, separated by periods. Examples are 192.168.1.1, 10.1.1.1 etc.. IPv4 is widely used for internet communication.
IPv4 IP address Classes
There are five classes in IPv4 : A, B, C, D and E.
Each class has a specific range of IP addresses (Each Ranges have its own number of devices and number of networks).
Class A, B, and C are used by the majority of devices on the Internet.
Class D and class E are for special uses.
IP addresses are categorized into private and public ranges
Public IP Address Range:
Public IP addresses are used on the internet and can be routed globally.
Private IP Address Ranges
These are reserved for use in private networks and are not routable over the public internet.
Class A (Supports 16 million hosts per network)
- IP Range: 1.0.0.0 to 127.255.255.255
- Subnet Mask: 255.0.0.0 (or /8)
- Default Network Size: 8 bits for the network portion, 24 bits for the host portion
- Usage: Primarily used for large networks.
- Private Range: 10.0.0.0 to 10.255.255.255
- Hosts per Network: 16,777,214
Class B (Supports 65,534 hosts per network)
- IP Range: 128.0.0.0 to 191.255.255.255
- Subnet Mask: 255.255.0.0 (or /16)
- Default Network Size: 16 bits for the network portion, 16 bits for the host portion
- Usage: Medium to large networks.
- Private Range: 172.16.0.0 to 172.31.255.255
- Hosts per Network:65,534
Class C (Supports 254 hosts per network)
- IP Range: 192.0.0.0 to 223.255.255.255
- Subnet Mask: 255.255.255.0 (or /24)
- Default Network Size: 24 bits for the network portion, 8 bits for the host portion
- Usage: Typically used for small networks, such as home and small office networks.
- Private Range: 192.168.0.0 to 192.168.255.255
- Hosts per Network:254
Class D (Multicast Addresses)
- IP Range: 224.0.0.0 to 239.255.255.255
- Usage: Used for multicast communications (group communication, like streaming, or broadcast applications).
- Default Subnet Mask : Reserved
- Hosts per Network : Multicast Addresses
Class E (Experimental Addresses)
- IP Range: 240.0.0.0 to 255.255.255.255
- Usage: Reserved for experimental or research purposes and not used in general networking.
- Default Subnet Mask : Reserved
- Hosts per Network :Experimental and Research
Subnetting
A subnet (short for "subnetwork") is a logical division of an IP network into smaller, more manageable segments. Subnetting allows network administrators to organize a larger network into smaller, efficient sub-networks, improving performance and security.
An IPv4 address is 32 bits long, typically written as four octets (e.g., 192.168.1.0).
Subnet Mask Defines which portion of the IP address refers to the network and which part refers to the host within that network. It is also written in dotted decimal format (e.g., 255.255.255.0).
The subnet mask uses 1s to identify the network portion and 0s to identify the host portion.
Example:
- IP Address: 192.168.1.10
- Subnet Mask: 255.255.255.0
- Step-by-Step:
Convert IP Address and Subnet Mask to Binary:
192.168.1.10 = 11000000.10101000.00000001.00001010
255.255.255.0 = 11111111.11111111.11111111.00000000 - Network Address
By performing a bitwise AND operation between the IP address and subnet mask, the network address is 192.168.1.0.
- Subnet Information
This subnet allows for 256 IP addresses (from 192.168.1.0 to 192.168.1.255)
but the first address (192.168.1.0) is reserved for the network
and the last address (192.168.1.255) is reserved for broadcast.
The valid host range is from 192.168.1.1 to 192.168.1.254.
To subnet the IP address 192.168.1.0/27, let's break it down:
Understanding the /27 Prefix:
A /27 subnet mask means that the first 27 bits of the IP address are used for the network part, and the remaining 5 bits are used for hosts. The subnet mask for /27 is:
Copy code
255.255.255.224
This gives us 32 total addresses in each subnet (2^5 = 32). Out of these, 30 addresses can be assigned to hosts (2 addresses are reserved: one for the network address and one for the broadcast address).
- Subnetting the 192.168.1.0/27 Network:
The network address is 192.168.1.0 and the subnet mask is 255.255.255.224.
The first address of the subnet is the Network Address.
The last address of the subnet is the Broadcast Address.
The remaining addresses are available for host assignment.
- Calculating Subnets:
Since the subnet mask is /27, the network is divided into 8 subnets of 32 addresses each. Below is the breakdown of each subnet.
Subnet Number | Network Address | First Usable IP | Last Usable IP | Broadcast Address | Number of Hosts |
---|---|---|---|---|---|
1 | 192.168.1.0 | 192.168.1.1 | 192.168.1.30 | 192.168.1.31 | 30 |
2 | 192.168.1.32 | 192.168.1.33 | 192.168.1.62 | 192.168.1.63 | 30 |
3 | 192.168.1.64 | 192.168.1.65 | 192.168.1.94 | 192.168.1.95 | 30 |
4 | 192.168.1.96 | 192.168.1.97 | 192.168.1.126 | 192.168.1.127 | 30 |
5 | 192.168.1.128 | 192.168.1.129 | 192.168.1.158 | 192.168.1.159 | 30 |
6 | 192.168.1.160 | 192.168.1.161 | 192.168.1.190 | 192.168.1.191 | 30 |
7 | 192.168.1.192 | 192.168.1.193 | 192.168.1.222 | 192.168.1.223 | 30 |
8 | 192.168.1.224 | 192.168.1.225 | 192.168.1.254 | 192.168.1.255 | 30 |
- Subnet Details:
Total Subnets: 8
Hosts per Subnet: 30
Subnet Mask: 255.255.255.224 or /27
Network Size: 32 addresses per subnet (30 usable for hosts)
Usable IP addresses in the subnets can be assign to devices, like computers, printers, or other network devices.
IPv4 has several advantages
Mature and Well-Established: IPv4 has been in use since the 1980s, making it highly reliable, well-supported, and compatible with almost all devices and networks worldwide.
Simple and Lightweight: Its 32-bit address structure is relatively simple, which helps in easy implementation and minimal processing overhead for devices and routers.
Wide Adoption: IPv4 is universally deployed, meaning that virtually all internet services, devices, and networks support it, ensuring global connectivity.
Established Routing Infrastructure: The routing mechanisms and protocols (e.g., OSPF, BGP) in IPv4 are well-understood, efficient, and have been optimized over time.
Extensive Documentation and Tools: Due to its long history, there is an abundance of tools, tutorials, and documentation available for IPv4, making it easier to troubleshoot and manage networks.
IPv4 has several disadvantages
Limited Address Space: IPv4 uses 32-bit addresses, which allows for only about 4.3 billion unique IP addresses. With the growing number of devices, this address space is quickly exhausted.
Address Exhaustion: Due to the limited number of IPv4 addresses, many organizations rely on techniques like NAT (Network Address Translation) to share a single public IP address, which can complicate network management and performance.
Inefficient Routing: IPv4 addresses are not as efficient for routing as they could be, leading to increased overhead in routing tables and slower processing times.
Security Issues: IPv4 was designed without strong built-in security features, and while security protocols like IPsec can be added, they are not universally implemented.
Network Configuration Complexity: IPv4 networks often require manual configuration for tasks like assigning IP addresses, making management more difficult as networks grow.
IPV6
IPv6 (Internet Protocol version 6) is the most recent version of the Internet Protocol (IP), designed to address the limitations of its predecessor, IPv4.
IPv6 uses 128-bit addresses, allowing for a vastly larger address space—around 340 undecillion (3.4×10²⁸) unique IP addresses—compared to the 32-bit address space of IPv4.
This expansion was necessary due to the exhaustion of IPv4 addresses. IPv6 also simplifies network configuration, improves security features (like mandatory IPsec encryption), and supports better routing and network efficiency.
The address format is typically written in eight groups of four hexadecimal digits, separated by colons (e.g., 2001:0db8:85a3:0000:0000:8a2e:0370:7334).