Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com
Table of contents
1.
Introduction
2.
What is IP?
3.
What is IPv4?
3.1.
Drawback of IPv4
3.2.
Features of IPv4
4.
What is IPv6?
4.1.
Features of IPv6
4.2.
Address format
5.
Difference between IPv4 and IPv6
6.
Frequently Asked Questions
6.1.
IPv4 vs IPv6
6.2.
Which is better IPv4 or IPv6?
6.3.
Is IPv4 faster than IPv6?
6.4.
Why is IPv4 mostly used than IPv6?
7.
Conclusion
Last Updated: Mar 27, 2024
Easy

IPv4 vs IPv6

Master Python: Predicting weather forecasts
Speaker
Ashwin Goyal
Product Manager @

Introduction

Imagine manually moving files from one location to another without internet or network, it would be a significant inconvenience, and it is currently impossible.

Think of a world without the internet... It almost seems impossible in 2022. We can conclude that the Internet is an essential part of our lives. The IP is the heart of internet communication.

IPv4 vs IPv6

This blog will introduce you to Internet protocol and its version, i.e., IPv4 and IPv6. We will mainly focus on the differences between Internet Protocol Version 4 and Internet Protocol Version 6, commonly known as IPv4 and IPv6, respectively. Before jumping on the differences, let’s first understand an Internet Protocol.

Also read, Basic Networking Commands.

What is IP?

The Internet Protocol (IP) is a collection of rules for routing and addressing data packets so that they can transit across networks and reach their intended destination.

An IP address is a numerical identifier assigned to every device connected to a computer network that communicates using the IP protocol. An IP address serves as a unique identifier for a device on a network. IP addresses are also referred to as IP numbers or Internet addresses. It specifies the packet's technical format.

There are two types of Internet Protocol versions: IPv4 and IPv6.Now we will learn about IPv4 and IPv6.

Get the tech career you deserve, faster!
Connect with our expert counsellors to understand how to hack your way to success
User rating 4.7/5
1:1 doubt support
95% placement record
Akash Pal
Senior Software Engineer
326% Hike After Job Bootcamp
Himanshu Gusain
Programmer Analyst
32 LPA After Job Bootcamp
After Job
Bootcamp

What is IPv4?

IPv4 is a version of the Internet Protocol commonly used to identify devices on a network via an addressing system. In 1983, it was the first version of IP to be used in production on the ARPANET. It stores 232 addresses, which is more than 4 billion addresses, using a 32-bit address scheme. It is the most crucial Internet Protocol, carrying 94% of all Internet traffic.

Computers only understand integers in binary form in today's computer network environment and do not understand IP addresses in the usual numeric format. Either 1 or 0 is a valid binary number. IPv4 comprises four sets, each of which represents an octet. Each octet's bits indicate a number.

An octet's bits can be either 1 or 0. If the bit is a 1, the number it represents will be counted; if the bit is a 0, the number it represents will not be counted. For example, The binary representation of IP address 120.64.56.12 is

What is IPv4?

Let us see in detail how to obtain the binary representation.

Step 1: First, we will find the binary representation of 120. For 120, we will put 1 under 64, 32, 16, and 8 because the sum of 64, 32, 16, and 8 is 120. And the rest bit will be 0. So the binary representation of 120 will be 01111000.

Step 2: Now, we will see the binary representation of 64. As there is a direct 64 available in the 8-bit octet, so we will put 1 under 64, and the rest bit will be set to 0. And the binary bit of 64 will be 01000000.

Step 3: Next, we have to find the binary representation of 56. The sum of 32, 16, and 8 leads to 56. So we will put 1 under each value, and the rest bit will be set to 0. The binary bit of 56 will be 00111000.

Step 4: Lastly, we have to find the binary representation of 12. The sum of 8 and 4 leads to 12. So we will put 1 under each, and the rest bit will be set to 0. The binary bit of 12 will be 00001100.

So, at last, the binary representation of IP address 120.64.56.12 is 0111 1000.0100 0000.0011 1000.0000 1100.

Drawback of IPv4

In this section of the blog, we will see what are the major drawbacks of IPv4.

  • IPv4 requires manual or automatic configuration. Dynamic Host Configuration Protocol is required for manual IPv4 configuration. (DHCP). DHCP configurations are complicated.
     
  • Because IPv4 was released so long ago, it was not designed to be secure against attacks present today.
     
  • Individual address prefixes are given in IPv4 so that each one can function as a new router. Additionally, today's internet uses both flat and hierarchical routers. The internet backbone routers, however, have more than 85 000 routes.
     
  • Although IPv4 has a mobility specification, it is seen to be ineffective. The fact that it has its own infrastructure accounts for this.
     
  • Another issue with utilizing IPv4 is public address exhaustion. The initial address class allocation procedures are primarily to blame for this. 

Features of IPv4

The main features of IPv4 are as follows

  • It is a connectionless protocol.
     
  • It is used to identify the device's location on the internet uniquely.
     
  • IPv4 requires less memory and ease of remembering addresses.
     
  • It offers video libraries and conferences.
     
  • It uses 32-bit addressing.

What is IPv6?

The Internet Protocol version 6 (IPv6) is the most recent. This new IP address version is being implemented to meet the need for additional Internet addresses. It was created to resolve IPv4 difficulties.

IPv4 addresses are 32 bits long, but IPv6 addresses are 128 bits long. In comparison to IPv4, IPv6 has a larger address space and a more specific header. There are both integers and alphabets in this hexadecimal address.

IPv6 is a 128-bit hexadecimal address composed of eight groups of 16 bits each, separated by a colon. Each hexadecimal character in IPv6 represents four bits. As a result, we must translate four bits at a time to a hexadecimal integer.

Example:

What is IPv6?

Features of IPv6

The main features of IPv4 are as follows

  • The latest version of Internet Protocol is IPv6.
     
  • It is used to identify the device's location on the internet uniquely.
     
  • Each device on the internet must have its IP address, which is used to place it on the internet uniquely.
     
  • IPv6 uses 128-bit addressing.
     
  • IPv6 supports approximately 340 trillion devices.
     
  • IPv6 uses a total of 8 groups of four hexadecimal digits which are separated by colons.
     
  • IPv6 was designed by Internet Engineering Task Force, commonly known as IETF.

Address format

Let us see the address format of IPv4 and IPv6. 

Address format of IPv4: 

Address format of IPv4

Address format of IPv6:

Address format of IPv6

An IPv4 is a 32-bit decimal address. Each of its 4 octets, or fields, is 8 bits in size and is separated from the others by a dot. Each field should contain an integer that falls between 0 and 255. An IPv6 is a 128-bit hexadecimal address. Each of its 8 fields, which are each 16-bits in size, is separated by a colon.

Difference between IPv4 and IPv6

IPv4 IPv6
It has a 32-bit addressing system. It has a 128-bit addressing system.
The checksum field is in IPv4. The checksum field is not in IPv6.
The header is 20-60 bytes. The header is 40 bytes.
The number of header fields is 12. The number of header fields is 8.
It has classes from A to E. No such classes are present in Ipv6.
It supports VLSM. It does not support VLSM.
Both sender and receiver routers perform fragmentation. Fragmentation is performed by the sender router only.
Authentication and encryption facility is not provided in IPv4. Authentication and encryption facility is provided in IPv6.
IPv4 has a broadcast message transmission scheme.  IPv6 has multicast and anycast message transmission scheme. 
The integrity of the connection is not achieved in IPv4.  The integrity of the connection of devices is committed in IPv6. 
IPv4 supports manual and DHCP configuration of addresses. IPv6 supports auto and renumbering address configuration. 
IPv4 uses ARP for mapping the MA address.  IPv6 uses NDP for mapping the MAC address.
It is separated using dot(.) notation.  It is isolated using the colon(:) notation.
The routed daemon supports IPv4.  IPv6 uses static routers.
IPv4 can generate an address space of 4.29 * 10^9  IPv6 can create an address space of 3.4 * 10^38 
Decimal notation is used to represent the address of IPv4. Hexadecimal notation is used to represent the address of IPv6.

Frequently Asked Questions

IPv4 vs IPv6

The fourth edition of the Internet Protocol (IP), IPv4, enables both manual and DHCP address set up and has a 32-bit address length. The latest Internet Protocol (IP) release, IPv6, has 128-bit addresses and permits automatic and renumbering address setup.

Which is better IPv4 or IPv6?

Compared to IPv4, version 6 of the Internet Protocol (IPv6) is more sophisticated and offers superior functionality. It offers an endless supply of addresses. It handles the expanding number of networks globally and assists in addressing the issue of running out of IP addresses.

Is IPv4 faster than IPv6?

No, IPv4 is not faster than IPv6. In network devices, IPv6 is faster than IPv4 because it lacks network-address translation. (NAT). For those who need a high processing speed for their network, IPv6 is a superior option.

Why is IPv4 mostly used than IPv6?

In the case of IPv4, there is a routing protocol that is supported by the routed daemon. As a result, IPv4 is preferred over IPv6 in terms of routing performance. And also, IPv6 only uses static routes because it doesn't allow any specific routing protocols. 

Conclusion

In this article, we discussed Internet Protocol, Internet Protocol Version 4, and Internet Protocol Version 6 and the differences between IPv4 and IPv6.

Recommended Reading:


Do check out The Interview guide for Product Based Companies as well as some of the Popular Interview Problems from Top companies like Amazon, Adobe, Google, etc. on Coding Ninjas Studio.

Also check out some of the Guided Paths on topics such as Data Structure and Algorithms, Competitive Programming, Operating Systems, Computer Networks, etc. as well as some Contests, Test Series, Interview Bundles, and some Interview Experiences curated by top Industry Experts only on Coding Ninjas Studio.

We wish you Good Luck! Keep coding and keep reading Ninja!!

Previous article
What is IPv4?
Next article
User Datagram Protocol (UDP)
Live masterclass