Every device that communicates across an IP network needs addressing information so that data can be delivered to the correct destination.
Two major versions of the Internet Protocol are used for this purpose: IPv4 and IPv6.
IPv4 has been the dominant version of IP for decades, while IPv6 was developed to provide a vastly larger address space and support the continued growth of internet-connected devices.
In this guide, you will learn how IPv4 and IPv6 addresses work, their formats, important differences, private and public addressing, NAT, subnetting, IPv6 features, transition technologies, and practical commands for checking IP configuration.
What Is an IP Address?
An IP address is a logical network address used by the Internet Protocol to identify an interface and help deliver packets across an IP network.
A simplified communication model looks like this:
Computer A
IP: 192.0.2.10
|
| Network
v
Router
|
v
Computer B
IP: 192.0.2.20
The exact addressing and routing behavior depends on the network architecture.
What Is IPv4?
IPv4 stands for Internet Protocol version 4.
IPv4 uses 32-bit addresses.
Because 32 bits are available, IPv4 provides:
232 = 4,294,967,296 possible address values
Not all addresses are assignable as ordinary host addresses because certain ranges and values have special purposes.
What Does an IPv4 Address Look Like?
IPv4 addresses are normally written in dotted-decimal notation.
Example:
192.168.1.10
An IPv4 address contains four decimal octets separated by periods.
192 . 168 . 1 . 10 | | | | 8-bit 8-bit 8-bit 8-bit
Each octet can represent a value from 0 to 255.
What Is IPv6?
IPv6 stands for Internet Protocol version 6.
IPv6 uses 128-bit addresses.
This provides an enormously larger address space than IPv4.
The total number of IPv6 address values is:
2128
The purpose of IPv6 is not merely to provide more addresses. It also introduces changes and capabilities to the IP protocol, including a redesigned address format and mechanisms such as SLAAC and Neighbor Discovery.
What Does an IPv6 Address Look Like?
IPv6 addresses are written using hexadecimal notation.
Example:
2001:db8:1234:5678:abcd:ef01:2345:6789
The address is divided into groups separated by colons.
There are up to eight groups, with each group representing 16 bits.
2001 : db8 : 1234 : 5678 : abcd : ef01 : 2345 : 6789
Why Was IPv6 Created?
The main reason for developing IPv6 was the limited address space of IPv4.
The growth of:
- Computers
- Smartphones
- Cloud systems
- Servers
- IoT devices
- Home routers
- Industrial systems
created increasing demand for IP addresses.
IPv4 conservation mechanisms such as NAT extended the practical life of IPv4, but they did not increase the total IPv4 address space.
IPv4 vs IPv6 at a Glance
| Feature | IPv4 | IPv6 |
|---|---|---|
| Address size | 32 bits | 128 bits |
| Address notation | Dotted decimal | Colon-separated hexadecimal |
| Address space | Much smaller | Extremely large |
| Broadcast | Supports broadcast | No broadcast; uses multicast and other mechanisms |
| Address configuration | Manual configuration and DHCP are common | Manual configuration, DHCPv6, and SLAAC can be used |
| Header design | IPv4 header | Redesigned IPv6 base header |
IPv4 Address Example
192.168.1.25
This is an example from the private IPv4 address space used in local networks.
IPv6 Address Example
2001:db8:abcd:1234::25
The 2001:db8::/32 range is reserved for documentation examples, so it should not be treated as a normal public internet address.
IPv6 Address Compression
IPv6 addresses can become long, so the notation provides shorthand rules.
Leading zeros in a hexadecimal group can be omitted.
For example:
2001:0db8:0000:0000:0000:0000:0000:0025
can be shortened to:
2001:db8:0:0:0:0:0:25
Consecutive groups of zeros can also be compressed using ::, but this notation can only be used once in a single IPv6 address.
2001:db8::25
IPv4 Address Classes
You may encounter the old IPv4 classful addressing system in textbooks and introductory networking courses.
Historically, IPv4 addresses were grouped into classes such as A, B, and C based on leading bits.
Modern IP networks generally use CIDR rather than relying on the old classful model.
What Is a Private IPv4 Address?
Private IPv4 addresses are intended for use within private networks and are not globally routable on the public internet.
The commonly used private IPv4 ranges are:
| Range | CIDR |
|---|---|
| 10.0.0.0 – 10.255.255.255 | 10.0.0.0/8 |
| 172.16.0.0 – 172.31.255.255 | 172.16.0.0/12 |
| 192.168.0.0 – 192.168.255.255 | 192.168.0.0/16 |
Your home router may assign a private IPv4 address such as:
192.168.1.20
What Is a Public IPv4 Address?
A public IPv4 address is an address that can be globally routed on the internet, subject to routing and allocation rules.
A home or office network commonly uses private addresses internally while a router or firewall may use a public address for internet connectivity.
Laptop
192.168.1.20
|
v
Home Router
Public IPv4
|
v
Internet
What Is NAT?
NAT stands for Network Address Translation.
NAT allows a network device to translate addresses between different network address spaces.
A common home-network configuration uses many private IPv4 addresses behind one public IPv4 address.
Laptop 192.168.1.10
Phone 192.168.1.11
Desktop 192.168.1.12
\ | /
\ | /
v v v
Home Router
Public IPv4
|
v
Internet
NAT helped conserve IPv4 addresses, although it also introduces architectural considerations and can complicate some types of direct connectivity.
Does IPv6 Need NAT?
IPv6 was designed with a vastly larger address space, which reduces the need for address conservation through NAT.
However, IPv6 networks can still use forms of address translation for specific architectural or compatibility requirements. NAT should therefore not be considered an absolute requirement or absolute impossibility for IPv6.
What Is Subnetting?
Subnetting divides an IP address space into smaller logical networks.
For example:
192.168.1.0/24 Can be divided into smaller networks
Subnetting can improve address management, routing organization, security segmentation, and network design.
What Is CIDR?
CIDR stands for Classless Inter-Domain Routing.
CIDR represents an IP network using an address followed by a prefix length.
Example:
192.168.1.0/24
The /24 indicates that the first 24 bits form the network prefix.
IPv6 also uses prefix lengths, for example:
2001:db8:1234::/48
IPv4 Header vs IPv6 Header
IPv6 redesigned the base IP header compared with IPv4.
IPv6 removes or changes certain fields and introduces a simpler fixed base header structure with optional information handled through extension headers.
This allows the protocol to support a very large address space while providing a cleaner architecture for certain functions.
IPv4 and IPv6 Fragmentation
Fragmentation is handled differently in the two protocols.
In IPv4, routers can fragment packets under certain circumstances.
In IPv6, routers do not fragment packets in transit. Fragmentation, when needed, is performed by the sending host using an IPv6 Fragment extension header.
IPv4 Broadcast vs IPv6 Multicast
IPv4 supports broadcast communication, where a packet can be sent to all hosts on a subnet.
IPv6 does not use broadcast. Instead, IPv6 relies on multicast and other mechanisms for functions that need group communication.
IPv6 Address Types
IPv6 includes several important address categories.
Unicast
A unicast address identifies a single interface for one-to-one communication.
Multicast
A multicast address identifies a group of interfaces.
Anycast
An anycast address can be assigned to multiple interfaces, with routing delivering traffic to an appropriate member of the set according to the routing system.
IPv6 Link-Local Addresses
IPv6 interfaces commonly use link-local addresses for communication on the local network link.
These addresses use the fe80::/10 range.
Example:
fe80::1234:5678:abcd:ef01
Link-local addresses are not globally routable.
IPv6 Global Unicast Addresses
Global unicast addresses are intended for globally routable IPv6 communication.
An example used in documentation is:
2001:db8:1234::10
Again, 2001:db8::/32 is reserved for documentation and examples.
IPv6 Unique Local Addresses
IPv6 also provides unique local addresses for private internal networking.
They are defined within the fc00::/7 range, with commonly generated local addresses using the fd00::/8 portion.
These addresses are not intended for global internet routing.
How Does IPv6 Configure an Address?
IPv6 supports multiple address-configuration mechanisms.
SLAAC
SLAAC stands for Stateless Address Autoconfiguration.
It allows hosts to configure IPv6 addresses using information advertised by routers on the local link.
DHCPv6
DHCPv6 can also be used to provide configuration information to IPv6 clients.
Networks can use different combinations of these mechanisms according to their requirements.
What Is Neighbor Discovery Protocol?
IPv6 uses the Neighbor Discovery Protocol (NDP), which operates through ICMPv6 messages.
NDP supports functions such as:
- Neighbor discovery
- Router discovery
- Address resolution
- Neighbor reachability detection
- Router advertisements
This replaces several functions associated with ARP and router discovery in IPv4.
IPv4 ARP vs IPv6 Neighbor Discovery
| IPv4 | IPv6 |
|---|---|
| Uses ARP for IPv4-to-link-layer address resolution | Uses Neighbor Discovery through ICMPv6 |
| Uses broadcast-based ARP requests | Uses multicast-based Neighbor Discovery messages |
IPv4 vs IPv6 Security
IPv6 was designed with support for modern IP security mechanisms, but using IPv6 does not automatically make a network secure.
Both IPv4 and IPv6 deployments require security controls such as:
- Firewalls
- Access controls
- Secure routing practices
- Network segmentation
- Monitoring
- Secure host configuration
- Patch management
Security teams should also understand IPv6 specifically rather than assuming that IPv4-only security policies automatically cover IPv6 traffic.
IPv4 and IPv6 DNS
DNS can provide both IPv4 and IPv6 addressing information.
An A record provides an IPv4 address.
An AAAA record provides an IPv6 address.
example.com A 203.0.113.10 AAAA 2001:db8::10
A hostname can have both record types.
What Is Dual Stack?
Dual stack means a device or network supports both IPv4 and IPv6.
Application
|
+-------+-------+
| |
IPv4 IPv6
| |
v v
Network Network
Dual-stack operation is one common way to support both protocols during IPv6 adoption.
What Is IPv6 Tunneling?
Tunneling can carry one protocol through another network infrastructure by encapsulating packets.
Historically, various IPv6 transition mechanisms used tunneling to support IPv6 connectivity across IPv4 infrastructure.
The exact transition approach depends on the deployment environment.
Why Can't We Simply Replace IPv4 With IPv6 Everywhere?
The transition is complex because the two protocols are not directly interchangeable at the packet level.
Internet service providers, organizations, operating systems, applications, network equipment, data centers, and security systems have all had to accommodate IPv6 alongside existing IPv4 infrastructure.
This is why IPv4 and IPv6 continue to coexist in many environments.
IPv4 vs IPv6: Practical Differences
| Area | IPv4 | IPv6 |
|---|---|---|
| Address length | 32-bit | 128-bit |
| Written as | Decimal octets | Hexadecimal groups |
| Private addressing | RFC 1918 private ranges | Unique local addressing |
| Broadcast | Supported | Not used |
| Neighbor resolution | ARP | NDP |
| Address configuration | Manual/DHCP commonly used | SLAAC/DHCPv6/manual configuration available |
| NAT dependency | Widely used for address conservation | Much less necessary for address conservation |
How to Check Your IPv4 and IPv6 Address
Windows
Open Command Prompt or PowerShell and run:
ipconfig
The output can include IPv4 addresses, IPv6 addresses, gateways, and other interface configuration information.
Linux
Use:
ip addr
or:
ip -6 addr
How to Test IPv4 Connectivity
You can use ping to test basic network reachability.
ping 192.0.2.1
Use real addresses appropriate to your network when testing.
How to Test IPv6 Connectivity
An IPv6 destination can be tested using ping tools that support IPv6.
ping -6 example.com
On some systems, the command may be named ping6.
IPv6 and Websites
A website can support IPv4, IPv6, or both.
DNS can publish:
A 203.0.113.10 AAAA 2001:db8::10
Clients with IPv6 connectivity can potentially use the IPv6 destination, while other clients can use IPv4 according to the client's networking behavior and the service's configuration.
IPv6 and Cloud Computing
Cloud environments increasingly support IPv6 alongside IPv4.
Cloud engineers may need to understand:
- IPv4 and IPv6 subnets
- Security groups and firewall rules
- Routing tables
- Load balancers
- DNS A and AAAA records
- Address allocation
- Dual-stack architectures
When designing a cloud application, IPv6 should be considered explicitly rather than assumed to behave exactly like IPv4.
IPv6 and Cybersecurity
Cybersecurity professionals need visibility into both IPv4 and IPv6 traffic.
An organization that monitors only IPv4 can miss IPv6 traffic paths and configuration issues.
Security testing should consider:
- IPv6 firewall rules
- Router advertisements
- Neighbor Discovery
- IPv6 DNS records
- Dual-stack applications
- IPv6 routing
- IP-based access controls
Common IPv4 and IPv6 Mistakes
- Assuming every IP address is publicly reachable.
- Confusing private addresses with public addresses.
- Forgetting that IPv6 uses hexadecimal notation.
- Writing IPv6 addresses incorrectly.
- Applying IPv4-only firewall assumptions to IPv6.
- Ignoring AAAA DNS records.
- Misunderstanding NAT as a complete security solution.
- Assuming IPv6 automatically eliminates all security problems.
IPv4 vs IPv6 for Beginners
As a beginner, you do not need to memorize every IPv6 feature immediately.
Start by understanding these concepts:
IPv4 ↓ 32-bit address ↓ Dotted decimal ↓ Private/Public ↓ NAT ↓ CIDR ↓ Subnetting IPv6 ↓ 128-bit address ↓ Hexadecimal ↓ Unicast / Multicast / Anycast ↓ Link-Local ↓ SLAAC / DHCPv6 ↓ NDP ↓ CIDR / Prefixes
IPv4 vs IPv6 Interview Questions
What is IPv4?
IPv4 is version 4 of the Internet Protocol and uses 32-bit addresses.
What is IPv6?
IPv6 is version 6 of the Internet Protocol and uses 128-bit addresses.
Why was IPv6 introduced?
IPv6 was developed primarily to provide a much larger IP address space and to improve the IP protocol architecture.
What is the main difference between IPv4 and IPv6?
The most fundamental difference is the address size: IPv4 uses 32 bits, while IPv6 uses 128 bits.
Does IPv6 use broadcast?
No. IPv6 does not use broadcast. It uses multicast and other mechanisms instead.
What is NAT?
NAT stands for Network Address Translation. It translates addresses between network address spaces and is widely used in IPv4 networks.
What is SLAAC?
SLAAC stands for Stateless Address Autoconfiguration. It allows IPv6 hosts to configure addresses using router-advertised information.
What is NDP?
NDP stands for Neighbor Discovery Protocol. It is an IPv6 protocol suite function implemented using ICMPv6 messages.
What is an AAAA record?
An AAAA DNS record maps a hostname to an IPv6 address.
What is dual stack?
Dual stack means a host or network supports both IPv4 and IPv6.
Frequently Asked Questions
Which is bigger, IPv4 or IPv6?
IPv6 has a vastly larger address space because it uses 128-bit addresses compared with IPv4's 32-bit addresses.
How many IPv4 addresses are possible?
IPv4 has 232, or 4,294,967,296, possible address values, although not all are available for ordinary host assignment.
How many IPv6 addresses are possible?
IPv6 has 2128 possible address values, providing an enormously larger address space.
Is IPv6 faster than IPv4?
Neither protocol should be considered universally faster. Performance depends on network architecture, routing, connectivity, configuration, and the path between endpoints.
Is IPv6 more secure than IPv4?
IPv6 provides capabilities designed into the protocol, but neither IPv4 nor IPv6 is automatically secure. Both require proper firewalling, configuration, monitoring, authentication, and application security.
Can IPv4 and IPv6 work together?
Yes. Dual-stack networks can operate IPv4 and IPv6 simultaneously, and additional transition mechanisms can be used in other architectures.
What is the difference between A and AAAA records?
An A record provides an IPv4 address, while an AAAA record provides an IPv6 address.
What is a private IPv4 address?
A private IPv4 address belongs to one of the ranges reserved for private networks and is not directly globally routable on the public internet.
What is a link-local IPv6 address?
A link-local IPv6 address is used for communication on the local network link and comes from the fe80::/10 range.
What is the IPv6 loopback address?
The IPv6 loopback address is ::1. It is used by a host to refer to itself.
```Final Thoughts
IPv4 and IPv6 are two versions of the Internet Protocol that provide addressing and packet-delivery functionality for IP networks.
The biggest difference is easy to remember:
IPv4 → 32-bit → 192.168.1.10 IPv6 → 128-bit → 2001:db8::10
However, becoming comfortable with networking requires more than knowing the address sizes. Learn CIDR, subnetting, private/public addressing, NAT, routing, DNS, IPv6 SLAAC, NDP, multicast, and dual-stack networking.
These concepts form an important foundation for cloud computing, DevOps, system administration, cybersecurity, and web development.
When troubleshooting connectivity, check both protocol versions. A service can work over IPv4 while failing over IPv6 because of DNS, routing, firewall, application, or hosting configuration.
Related Articles on CodeWithAV
What Is DNS? Complete Domain Name System Guide
What Is the Internet and How Does It Work?
Explore More Networking and Cybersecurity Guides
CodeWithAV — Learn, Discover & Build.