Skip to main content

IPv4 vs IPv6: Packet structures and difference between ipv4 and ipv6


IPv4 vs IPv6: Significant Size Difference

There is significant difference in size between IPv6 and IPv4 addresses. IPv6 addresses, being 128 bits in length, indeed offer a vastly larger address space compared to IPv4’s 32-bit addresses. This expanded address space allows for an exponentially greater number of unique addresses, ensuring that devices connected to the Internet will not face the issue of address exhaustion, which was becoming a concern with IPv4 due to the rapid growth of internet-connected devices worldwide.

It effectively distinguishes between the roles of IP addresses and MAC addresses in networking. IP addresses serve as identifiers for devices within a network and are akin to postal codes, directing data packets to their intended destinations on the Internet. MAC addresses, on the other hand, are unique identifiers assigned to network interface cards (NICs) and function as hardware addresses within a local network. They play a crucial role in local network communication, ensuring that data is correctly routed to the intended device within the network. While IP addresses are visible to the broader Internet and are essential for global communication, MAC addresses operate at a lower level and are primarily used for communication within a local network.

IPv4 and IPv6 have a significant size difference, mainly in address length and packet header size.

1. Address size (the big difference)

  • IPv4: 32 bits
    Example: 192.168.1.1
    Total addresses: about 4.3 billion
  • IPv6: 128 bits
    Example: 2001:0db8:85a3::8a2e:0370:7334
    Total addresses: about 3.4 × 1038

➡️ IPv6 addresses are 4× longer in bits and astronomically more numerous.

2. Packet header size

  • IPv4 header:
    • Minimum: 20 bytes
    • Maximum: 60 bytes (due to optional fields)
  • IPv6 header:
    • Fixed: 40 bytes
    • No header options (uses extension headers instead)

➡️ IPv6 headers are larger than the minimum IPv4 header, but simpler and more predictable.

3. Efficiency trade-off

Feature IPv4 IPv6
Address size32 bits128 bits
Header size20–60 bytes40 bytes
Header complexityVariableFixed
NAT neededCommonNot required
Routing efficiencyLowerHigher

Even though IPv6 headers are bigger, routing is often faster because:

  • Fixed header size
  • Fewer fields to process
  • No checksum in the header

4. Is the size difference “significant” in practice?

  • Yes for:
    • Address storage
    • Logs and databases
    • Human readability
  • Usually no for:
    • Network performance on modern links
    • Bandwidth usage (40 bytes is tiny compared to typical packet sizes)

Summary

  • IPv6 uses much larger addresses
  • IPv6 headers are larger but simpler
  • The size increase enables massive scalability and cleaner networking

Structural Bit Calculation of IPv4 and IPv6

Yes. Let’s calculate the number of bits step-by-step using the actual structure of IPv4 and IPv6 addresses. This is the clearest justification.

IPv4: Structural Bit Calculation

Example IPv4 Address

192.168.1.1

Total:IPv4 = 32 bits

IPv6: Structural Bit Calculation

2001:0db8:85a3:0000:0000:8a2e:0370:7334
8 × 16 bits = 128 bits

IPv6 = 128 bits

 

What is the main difference between IPv4 and IPv6?


IPv4 was introduced in the 1970s. You may be aware that once we connect our devices to the internet, they are assigned a unique id. More specifically, when two routers begin communicating, they are assigned a unique IP address. Then our gadgets, such as PDAs, computers, and other mobile devices, connect to the internet via nearby routing devices. There could be a lot of intermediary routers in front of them. The main differences between IPv4 and IPv6 systems are discussed in this article. 


We know that IPv4 applications can still be used in IPv6 networks. Because the IPv6 system is backwards compatible with the IPv4 system. When you buy new hardware, it comes pre-configured with IPv6.



Difference in number of addressing bits in IPv4 vs. IPv6

IPv4 addresses are 32 bits long, while IPv6 addresses are 128 bits long. You may be aware that the number of internet-connected gadgets is currently 5-6 times the total number of people on the planet. To assign IP addresses to all devices, IPv4 is insufficient. On the other hand, the number of internet-connected gadgets is rapidly increasing. In this condition, IPv4 can only provide IP addresses to about 20% of the world's population.

IPv4 can only assign IP addresses to 2^(32) devices, however IPv6 can assign IP addresses to 2^(128) devices. If you tally up the numbers, you'll realize that we can assign IPv6 addresses to each and every sand particle in deserts. 



IPv4 vs. IPv6 Header Differences

The IPv4 header is 24 bytes long. We need only 8 bytes for source and destination addresses, and the remaining 16 bytes are used for 12 extra fields. The IPv6 header is only 40 bytes long. The source address is 16 bytes long, the destination address is 16 bytes long, and the header generation portion is 8 bytes long. In comparison to IPv4 networks, IPv6 networks employ a simpler header.



IPv6 has an auto-configuration feature

One of the most significant advantages is that IPv6 is auto-configurable. If you're familiar with IP addresses, you'll notice that devices connected to the same routers use the same prefixes. It is not auto-configurable for IPv4. In the case of IPv6, however, IP addresses are automatically assigned. In this situation, the router sends a prefix link, and connected devices are immediately assigned IP addresses with the same prefix.



IP addresses in IPv4 and IPv6 examples

IPv6 addresses are 128 bits long. Each sub block of the address block is split into eight sub blocks. Each portion has a 16-bit hexadecimal value. As an example,

Example of 128 bit IPv6 addresses 

2010:0BB8:0000:0000:1212:A3AA:0FEF:0714

The IP address given above can be written as

2010:BB8:0:0:1212:A3AA:FEF:714

2010:BB8: : 1212:A3AA:FEF:714

In IPv6, consecutive zeros can be replaced with "::" as illustrated above.


We've already talked abut that the IPv6 network system can still utilize IPv4 addresses. I'll show how IPv4 addresses are represented in IPv6 networks.

For instance, consider the IPv4 address 192.168.0.3. Then, with IPv6, it's referred as 

0:0:0:0:0:0:192.168.0.3

: : 192.168.0.3



How to find out what your internet-connected device's IP address is

When your device is connected to the internet, there are a number of websites where you can check your IP address. You may find your IP address by typing URL address "https://www.iplocation.net" into your browser.

What are the valid ipv6 addresses that can be used for communication across the Internet?




People are good at skipping over material they already know!

View Related Topics to







Contact Us

Name

Email *

Message *

Popular Posts

Theoretical BER vs SNR for binary ASK, FSK, and PSK with MATLAB Code + Simulator

📘 Overview & Theory 🧮 MATLAB Codes 📚 Further Reading Bit Error Rate (BER) Equations BER formulas for ASK, FSK, and PSK modulation schemes. ASK BER = 0.5 × erfc(0.5 × √SNR) FSK BER = 0.5 × erfc(√(SNR / 2)) PSK BER = 0.5 × erfc(√SNR) Theoretical BER vs SNR for Amplitude Shift Keying (ASK) The theoretical Bit Error Rate (BER) for binary ASK depends on how binary bits are mapped to signal amplitudes. For typical cases: If bits are mapped to 1 and -1, the BER is: BER = Q(√(2 × SNR)) If bits are mapped to 0 and 1, the BER becomes: BER = Q(√(SNR / 2)) Where: Q(x) is the Q-function: Q(x) = 0.5 × erfc(x / √2) SNR : Signal-to-Noise Ratio N₀ : Noise Power Spectral Density Understanding the Q-F...

Simulation of ASK, FSK, and PSK using MATLAB Simulink (with Online Simulator)

📘 Overview 🧮 How to use MATLAB Simulink 🧮 Simulation of ASK using MATLAB Simulink 🧮 Simulation of FSK using MATLAB Simulink 🧮 Simulation of PSK using MATLAB Simulink 🧮 Simulator for ASK, FSK, and PSK 🧮 Digital Signal Processing Simulator 📚 Further Reading ASK, FSK & PSK HomePage MATLAB Simulation Simulation of Amplitude Shift Keying (ASK) using MATLAB Simulink In Simulink, we pick different components/elements from MATLAB Simulink Library. Then we connect the components and perform a particular operation. Result A sine wave source, a pulse generator, a product block, a mux, and a scope are shown in the diagram above. The pulse generator generates the '1' and '0' bit sequences. Sine wave sources produce a specific amplitude and frequency. The scope displays the modulated signal as well as the original bit sequence created by the pulse generator. Mux i...

BER vs SNR for M-ary QAM, M-ary PSK, QPSK, BPSK, ...(MATLAB Code + Simulator)

Bit Error Rate (BER) & SNR Guide Analyze communication system performance with our interactive simulators and MATLAB tools. 📘 Theory 🧮 Simulators 💻 MATLAB Code 📚 Resources BER Definition SNR Formula BER Calculator MATLAB Comparison 📂 Explore M-ary QAM, PSK, and QPSK Topics ▼ 🧮 Constellation Simulator: M-ary QAM 🧮 Constellation Simulator: M-ary PSK 🧮 BER calculation for ASK, FSK, and PSK 🧮 Approaches to BER vs SNR What is Bit Error Rate (BER)? The BER indicates how many corrupted bits are received compared to the total number of bits sent. It is the primary figure of merit for a...

OFDM Waveform with MATLAB Code

  In OFDM (Orthogonal Frequency Division Multiplexing) , we transmit multiple orthogonal subcarriers simultaneously. Since the subcarriers are orthogonal , they do not interfere with each other, which is one of the main advantages of OFDM. Practically, OFDM converts a wideband signal into multiple narrowband orthogonal subcarriers. For typical wireless communication, if the signal bandwidth (or symbol duration) exceeds the coherence bandwidth of the channel, the signal experiences frequency-selective fading . Fading distorts the signal, making it difficult to recover the original information. By using OFDM, we transmit the same wideband signal across multiple orthogonal narrowband subcarriers, reducing the effect of fading. For example, if we want to transmit a signal of bandwidth 1024 kHz , we can divide it into N = 8 subcarriers . Each subcarrier is then spaced by: Δf = Total Bandwidth N = 1024 8 kHz...

MATLAB Code for Constellation Diagram of QAM configurations such as 4, 8, 16, 32, 64, 128, and 256-QAM

📘 Overview of QAM 🧮 4-QAM MATLAB 🧮 16-QAM MATLAB 🚀 Online Simulator 📂 Other Topics on Constellation Diagrams... ▼ 🧮 MATLAB Code for 4-QAM 🧮 MATLAB Code for 16-QAM 🧮 MATLAB Code for m-ary QAM 🧮 Simulator for m-ary PSK 🧮 Simulator for m-ary QAM 🧮 Overview of Energy per Bit (Eb / N0) 🧮 Simulator for ASK, FSK, and PSK Overview of QAM One of the best-performing modulation techniques is QAM [↗] . Here, we modulate the symbols by varying the carrier signal's amplitude and phase in response to the variation in the message signal (or voltage variation). So, we may say that QAM is a combination of phase and amplitude modulation. Additionally, it performs better than ASK or PSK [↗] . In fact, any constellation for any type of modulatio...

Power Spectral Density Calculation Using FFT in MATLAB

📘 📘 Overview 🧮 🧮 Steps to calculate 💻 🧮 MATLAB Codes 📚 📚 Further Reading Power spectral density (PSD) tells us how the power of a signal is distributed across different frequency components, whereas Fourier Magnitude gives you the amplitude (or strength) of each frequency component in the signal. Steps to calculate the PSD of a signal Firstly, calculate the fast Fourier transform (FFT) of a signal. Then, calculate the Fourier magnitude (absolute value) of the signal. Square the Fourier magnitude to get the power spectrum. To calculate the Power Spectral Density (PSD), divide the squared magnitude by the product of the sampling frequency (fs) and the total number of samples (N). Formula: PSD = |FFT|^2 / (fs * N) Sampling frequency (fs): The rate at which the continuous-time signal is sampled (in Hz). ...

Online Simulator for ASK, FSK, and PSK

Try our new Digital Signal Processing Simulator!   •   Interactive ASK, FSK, and BPSK tools updated for 2025. Start Now Interactive Modulation Simulators Visualize binary modulation techniques (ASK, FSK, BPSK) in real-time with adjustable carrier and sampling parameters. 📡 ASK Simulator 📶 FSK Simulator 🎚️ BPSK Simulator 📚 More Topics ASK Modulator FSK Modulator BPSK Modulator More Topics Simulator for Binary ASK Modulation Digital Message Bits Carrier Freq (Hz) Sampling Rate (...

FastAPI Static Files – Overview

FastAPI Static Files Often, a web application needs to include resources that do not change, even when dynamic data is rendered. These resources are called static assets . Examples of static files include: Images ( .png , .jpg ) JavaScript files ( .js ) Stylesheets ( .css ) Installing Required Library To handle static files in FastAPI, you need the aiofiles library. pip install aiofiles Mounting Static Files FastAPI uses the StaticFiles class to serve static content. You mount a folder (usually named static ) so that all files inside it can be accessed via a URL. from fastapi import FastAPI from fastapi.staticfiles import StaticFiles app = FastAPI() app.mount("/static", StaticFiles(directory="static"), name="static") Example 1: Using an Image Place an image file (for example, fa-logo.png ) inside the static folder. main.py from fastapi import FastAPI, Request from fastapi.responses import HTMLRespon...