Chapter 17 of 28

IPv4 & IPv6

Whenever devices communicate over the Internet or a private network, they need an IP address so that data can be delivered to the correct destination.

There are two major versions of the Internet Protocol:

  • IPv4 – Internet Protocol version 4

  • IPv6 – Internet Protocol version 6

IPv4 has been used for decades and is still extremely common, while IPv6 was developed to provide a much larger address space and support the continued growth of the Internet.


What Is IPv4?

IPv4 (Internet Protocol version 4) is a version of the Internet Protocol that uses 32-bit addresses.

An IPv4 address is usually written as four decimal numbers separated by dots.

Example:

192.168.1.10

Each number represents 8 bits, so there are four 8-bit sections:

192  .  168  .  1  .  10
 ↓       ↓      ↓      ↓
8 bits  8 bits  8 bits  8 bits

This gives a total of:

8 + 8 + 8 + 8 = 32 bits

IPv4 provides about 4.3 billion possible addresses. That sounds like a huge number, but the rapid growth of computers, smartphones, servers, IoT devices, and other connected systems made IPv4 addresses increasingly scarce.


What Is IPv6?

IPv6 (Internet Protocol version 6) is the newer version of the Internet Protocol and uses 128-bit addresses.

An IPv6 address is written using hexadecimal numbers separated by colons.

Example:

2001:db8:1234:5678::1

A full IPv6 address contains eight groups of hexadecimal digits, with rules that allow consecutive zeros to be shortened.

Because IPv6 uses 128 bits, it provides an enormously larger address space than IPv4.


Why Was IPv6 Introduced?

The biggest reason is the limited IPv4 address space.

With the growth of the Internet, the number of devices requiring IP addresses increased dramatically.

IPv6 provides a practically enormous number of addresses, making it possible to assign unique addresses to a vastly larger number of network interfaces.

IPv6 also introduces improvements in areas such as:

  • Addressing

  • Neighbor discovery

  • Multicast support

  • Packet header design

  • Network configuration


IPv4 vs IPv6

Feature

IPv4

IPv6

Full Name

Internet Protocol version 4

Internet Protocol version 6

Address Size

32 bits

128 bits

Address Format

Decimal

Hexadecimal

Example

192.168.1.10

2001:db8::1

Address Space

About 4.3 billion addresses

Extremely large

Broadcast

Supported

No traditional broadcast

Address Configuration

Manual or DHCP

Manual, SLAAC, DHCPv6, etc.

Header

Variable length

Fixed base header

Address Resolution

ARP commonly used with IPv4

Neighbor Discovery Protocol

NAT

Very common

Not required to solve address exhaustion


IPv4 Address Example

Consider:

192.168.10.25

Each section is called an octet.

192 | 168 | 10 | 25

Each octet can have a value from 0 to 255.

So an IPv4 address can look like:

0.0.0.0

up to:

255.255.255.255

Although not all addresses in that numerical range are available for ordinary host assignment because some have special purposes.


IPv6 Address Example

An IPv6 address looks quite different:

2001:0db8:0000:0000:0000:ff00:0042:8329

IPv6 allows leading zeros within a group to be omitted:

2001:db8:0:0:0:ff00:42:8329

And consecutive groups containing only zeros can be compressed using :::

2001:db8::ff00:42:8329

The :: can only be used once in an IPv6 address.


Private IPv4 Addresses

IPv4 has specific address ranges reserved for private networks.

The main private ranges are:

Private Range

Example

10.0.0.0/8

10.0.0.5

172.16.0.0/12

172.16.10.20

192.168.0.0/16

192.168.1.10

For example, your laptop might use:

192.168.1.10

inside your home network.

These addresses are not directly routed across the public Internet.

IPv6 has a different concept called Unique Local Addresses (ULA) for private/local addressing, commonly from fc00::/7.


How IPv4 and IPv6 Communicate

IPv4 and IPv6 are different network-layer protocols. An IPv4 device does not automatically communicate directly with an IPv6 device simply because both use IP.

Networks can use different transition techniques, including:

Dual Stack

A device or network runs both IPv4 and IPv6.

Device
 ├── IPv4
 └── IPv6

This is one of the most common approaches during the transition from IPv4 to IPv6.

Tunneling

IPv6 traffic can sometimes be carried through an IPv4 network using a tunneling mechanism.

Translation

Network devices can translate between IPv4 and IPv6 in certain scenarios using technologies designed for that purpose.


IPv4 and IPv6 Address Configuration

IPv4 networks commonly use DHCP to automatically assign addresses and other network configuration.

IPv6 supports multiple configuration methods.

One important method is SLAAC (Stateless Address Autoconfiguration), which allows a device to automatically configure an IPv6 address using information advertised by a router.

IPv6 can also use DHCPv6 when additional configuration is required.


Does IPv6 Replace IPv4?

IPv6 was designed as the long-term successor to IPv4, but IPv4 has not disappeared.

Today, both IPv4 and IPv6 are used across the Internet. Many networks use dual-stack networking, allowing devices to communicate using either protocol when appropriate.

The transition has taken a long time because replacing IPv4 across the entire Internet is not a simple task.


Easy Way to Remember

The biggest difference is the address size:

IPv4 → 32 bits
IPv6 → 128 bits

And their notation:

IPv4 → 192.168.1.10
IPv6 → 2001:db8::1

So, remember:

IPv4 = Smaller address space + dotted decimal

IPv6 = Huge address space + hexadecimal

Conclusion

IPv4 and IPv6 are two versions of the Internet Protocol used for addressing and routing packets across networks.

IPv4 uses 32-bit addresses, while IPv6 uses 128-bit addresses. IPv6 was introduced mainly to solve the long-term limitations of IPv4's address space and also provides several improvements to the IP architecture.

For beginners, focus on these points first:

  • IPv4 → 32-bit

  • IPv6 → 128-bit

  • IPv4 → Decimal with dots

  • IPv6 → Hexadecimal with colons

  • IPv4 and IPv6 are different protocols

  • Both are currently used on the Internet

Once you understand this difference, the next important topic is Subnetting, which explains how IPv4 networks are divided into smaller networks.