Networking - Miscellaneous - IP
IP stands for Internet Protocol. It is a set of rules that governs how data packets are addressed, routed, and delivered over the internet. IP provides the foundation for communication between devices on different networks, allowing them to send and receive data.
IPv4 (Internet Protocol version 4) is the fourth version of the Internet Protocol. It uses a 32-bit addressing scheme and is the most widely used version of IP. IPv4 addresses are written in the form of four sets of numbers separated by periods (e.g., 192.168.0.1). IPv4 provides approximately 4.3 billion unique IP addresses, which have become increasingly scarce due to the rapid growth of the internet.
Format: IPv4 addresses consist of four octets expressed in decimal form, ranging from 0 to 255. For example, an IPv4 address may look like 192.168.0.1.
Address Classes: IPv4 addresses were initially divided into five address classes, designated as A, B, C, D, and E. Each class has a specific range of addresses, with different portions reserved for network identification and host identification.
- Class A: Used for large networks, with the first octet representing the network portion and the remaining three octets for hosts. The range of Class A addresses is 126.96.36.199 to 188.8.131.52.
- Class B: Used for medium-sized networks, with the first two octets representing the network portion and the remaining two octets for hosts. The range of Class B addresses is 184.108.40.206 to 220.127.116.11.
- Class C: Used for small networks, with the first three octets representing the network portion and the last octet for hosts. The range of Class C addresses is 192.0.0.0 to 18.104.22.168.
- Class D: Reserved for multicast addresses, used for sending data to multiple devices simultaneously. The range of Class D addresses is 22.214.171.124 to 126.96.36.199.
- Class E: Reserved for experimental purposes and not used for general addressing.
Subnetting: To divide a network into smaller subnetworks or subnets, subnetting is used. Subnetting involves borrowing bits from the host portion of an IP address to create a separate network identifier and subnet identifier. It allows for efficient use of IP addresses and better network management.
Private IP Addresses: Private IP addresses are reserved address ranges for use within private networks. These addresses are not globally unique and cannot be routed over the internet. They are commonly used in home networks and private corporate networks. The three private address ranges are:
- Class A: 10.0.0.0 to 10.255.255.255
- Class B: 172.16.0.0 to 172.31.255.255
- Class C: 192.168.0.0 to 192.168.255.255
IPv6 (Internet Protocol version 6) is the sixth version of the Internet Protocol and was introduced to address the limitations of IPv4. It uses a 128-bit addressing scheme, offering a significantly larger pool of IP addresses. IPv6 addresses are written in the form of eight sets of four hexadecimal digits separated by colons (e.g., 2001:0db8:85a3:0000:0000:8a2e:0370:7334). IPv6 provides an enormous number of unique IP addresses, ensuring the availability of addresses for future network expansion.
Format: IPv6 addresses consist of eight groups of four hexadecimal digits, resulting in a total of 32 digits. For example, an IPv6 address may look like 2001:0db8:85a3:0000:0000:8a2e:0370:7334. To simplify the representation, leading zeros within each group can be omitted, and consecutive groups of zeros can be replaced with a double colon (::). For example, the above address can be written as 2001:db8:85a3::8a2e:370:7334.
Address Space: IPv6 provides an address space of 2^128 (approximately 3.4 x 10^38) unique addresses. This vast address space ensures the availability of addresses for future network expansion and the proliferation of internet-connected devices.
Address Types: IPv6 defines various types of addresses to cater to different purposes:
- Unicast Address: Used to identify a single network interface within an IPv6 network. Unicast addresses can be global addresses, unique across the entire internet, or link-local addresses, which are only valid within a specific network segment.
- Multicast Address: Used to send data to multiple devices simultaneously. Multicast addresses begin with the prefix "FF00::/8" and allow efficient group communication.
- Anycast Address: Assigned to multiple devices, but the data is routed to the nearest device based on routing protocols. Anycast addresses enable load balancing and improved network performance.
- Address Allocation: IPv6 addresses are allocated in a hierarchical manner. Internet registries distribute blocks of IPv6 addresses to regional registries, which, in turn, allocate them to Internet Service Providers (ISPs) and organizations. ISPs and organizations further allocate smaller portions of addresses to individual networks and devices.
Autoconfiguration: IPv6 includes built-in support for address autoconfiguration, allowing devices to generate their own unique IPv6 addresses. Stateless Address Autoconfiguration (SLAAC) allows devices to configure addresses using information obtained from the network router, while Dynamic Host Configuration Protocol version 6 (DHCPv6) enables stateful address assignment and additional network configuration.
Transition Mechanisms: As IPv6 adoption continues, transition mechanisms have been developed to facilitate coexistence and interoperability with IPv4 networks. These mechanisms include dual-stack, tunneling, and translation techniques to ensure a smooth transition from IPv4 to IPv6.
Differences between IPv4 and IPv6:
- Addressing Scheme: IPv4 uses a 32-bit address space, allowing for approximately 4.3 billion unique addresses. IPv6 uses a 128-bit address space, providing a virtually unlimited number of unique addresses.
- Address Format: IPv4 addresses are written in decimal format (e.g., 192.168.0.1), while IPv6 addresses are written in hexadecimal format (e.g., 2001:0db8:85a3:0000:0000:8a2e:0370:7334).
- Address Allocation: IPv4 addresses are typically assigned to devices manually or through Dynamic Host Configuration Protocol (DHCP). IPv6 addresses often employ auto-configuration methods, allowing devices to generate their own unique addresses based on network prefixes.
- Header Size: IPv4 headers are 20 bytes in size, while IPv6 headers are 40 bytes in size. IPv6 headers also have additional fields for features like flow labeling, authentication, and optional extension headers.
- Security and Quality of Service (QoS): IPv6 includes built-in support for IPsec (Internet Protocol Security) to provide end-to-end encryption and authentication. IPv4 requires additional configuration for implementing IPsec. IPv6 also includes support for QoS, allowing for improved prioritization and management of network traffic.
- Network Address Translation (NAT): IPv4 often relies on NAT to conserve address space by allowing multiple devices to share a single public IP address. IPv6 eliminates the need for NAT and provides a unique global address to each connected device.