Compare IPv4 and IPv6.
Interview preparation resource from Gate Smashers.
IPv4 and IPv6 are Internet-layer protocols that provide addressing and routing for IP packets. IPv4 uses 32-bit addresses, while IPv6 uses 128-bit addresses, providing a far larger address space. IPv6 also simplifies the base header, replaces ARP with ICMPv6 Neighbor Discovery, eliminates broadcast, and changes fragmentation behavior. They are not directly interoperable, so dual-stack deployment is commonly used during transition.
Addressing and representation
IPv4 addresses are 32 bits long and are usually written in dotted-decimal notation, such as 192.168.1.10. Its address space contains about 4.3 billion possible addresses.
IPv6 addresses are 128 bits long and are written as hexadecimal groups separated by colons, such as 2001:db8::10. The much larger address space reduces the need to conserve addresses through NAT.
Packet header and fragmentation
An IPv4 header has a variable length of 20 to 60 bytes because options are included in the header. IPv6 has a fixed 40-byte base header; optional functionality is carried in extension headers.
IPv4 routers may fragment packets when required by a link's maximum transmission unit. IPv6 routers do not fragment packets; instead, the sending host uses path MTU discovery and may fragment packets using an IPv6 Fragment extension header when necessary.
Address resolution and traffic delivery
IPv4 typically uses ARP to map a local IPv4 address to a link-layer address. IPv6 uses Neighbor Discovery, which operates through ICMPv6, for address resolution and related local-link functions.
IPv4 supports broadcast traffic. IPv6 has no broadcast; multicast is used where group delivery is needed. IPv6 also supports anycast addressing, in which packets are delivered to one member of an anycast group.
Configuration, NAT, and transition
IPv4 hosts are commonly configured manually or through DHCP. IPv6 supports Stateless Address Autoconfiguration (SLAAC) and DHCPv6; the choice depends on the network's addressing and configuration requirements.
NAT is widespread in IPv4 networks because public IPv4 addresses are limited. IPv6 does not normally require NAT for address conservation, although firewalls are still used for traffic control. Because IPv4 and IPv6 are separate protocols, many networks operate both in dual-stack mode during migration.
