Tutorials

Ipv4 vs ipv6 - what it is and what it is used for in networks

Table of contents:

Anonim

The Internet and the world of networks would not be as we know it, and would not even exist if it were not for IPv4 addressing. A protocol of the utmost importance in the connections between devices through the network, both physically and wirelessly. Today we will see everything that has to do with IP and we will analyze the differences between IPv4 vs IPv6 explaining its main characteristics.

Index of contents

IPv4 and the OSI model

We will have to start with the basic one, which is to define and understand what an IP address is, whether it is IPv4 or IPv6.

OSI model the networking standard

And for this we must make a quick reference to the OSI (Open System Interconection) model. It is a reference model and not a network architecture, for the different network protocols that intervene in communications through computer equipment. The model divides telecommunications systems into 7 levels to differentiate the different stages of data travel from one point to another as well as the protocols involved in each one.

What is the OSI model: full explanation

We already know that there is a model that classifies, so to speak, the network protocols, and precisely IPv4 and IPv6 are two of these network protocols. In this case they operate at one of the lowest levels of the model, the network layer or layer 3. This layer is responsible for the routing of packets between two connected networks. It will make data available from the transmitter to the receiver through necessary switching and routing from one point to another.

Below it we have the data link layer (layer 2) in which the switches work, and above it there is layer 4 or the transport layer in which the TCP protocol that transports the packets through datagrams intervenes.

What is an IP address

We speak of IP address as a numerical set in decimal or hexadecimal (we will see) that identifies logically and according to a hierarchy a network interface. Every device connected to a network must be assigned an IP address, a temporary identifier such as our DNI while we are in this world or a phone number while we have contracted a telephone service. Thanks to the IP, the different computers can communicate with each other, making the packets travel over the network until they find their recipient.

The IP address can be fixed ( fixed IP) or dynamic (DHCP or Dynamic Host Configuration Protocol), always assigned by a server or router that works at the network layer. When we talk about fixed IP, it means that the host will always have the same IP address, even if it is turned off and on again. While in DHCP the IP is assigned dynamically to the host when it is turned on, of course, the nodes of a network are usually given the same IP address always after associating the first time with the router.

In the network architecture we must differentiate between the public network, which would be the Internet, and the private network, the one behind our router where our computers and Smartphone or Tablets are if we connect to Wi-Fi. In the first case, we are talking about an external IP, which would be the address that is assigned to the router to communicate with the Internet, a dynamic almost always provided by our ISP. In the second we talk about internal IP, to the address that the router gives to the computers on our network, which is almost always of type 192.168.xx

We must not confuse IP with MAC address, which is another address this time fixed and unique that identifies each computer on the network. This is factory set, like the IMEI of a phone, although it is possible to modify it identifies the host in the transport layer of the OSI model. In fact the switch or the router is that it relates the MAC with the IP. A MAC is a 48-bit code expressed in hexadecimal notation in 6 two-character blocks.

IP protocol

The IP address is the identifier belonging to the IP protocol (Internet Protocol), which is the IPv4 and IPv6 addressing system as a newer version and prepared for the future. It is a protocol that operates at the network layer and is not connection oriented, this means that communication between two ends of a network and data exchange can be done without prior agreement. In other words, the receiver transmits data without knowing if the receiver is available, so it will arrive at the receiver when it is turned on and connected.

IPv4 and IPv6 transfer switched data packets through the physical networks that operate according to the OSI model. This is done thanks to routing, a technique that allows the packet to find the fastest route to the destination, but without guarantees that it will arrive, of course, this guarantee is given by the data transport layer with TCP, UDP, or another protocol.

The data handled by the IP protocol is divided into packets called datagrams, which do not have any type of protection or error control for sending. Whether a datagram will be sent only with IP might or might not arrive, broken or complete, and in a random order. It only carries information about the source and destination IP address along with the data. Of course this doesn't seem very reliable, so in the transport layer this datagram is taken and wrapped in a TCP or UDP segment that adds error handling and much more information.

IPv4

Now let's focus on the IPv4 protocol, which has been operating in networks since 1983 when the first ARPANET packet exchange network was created, which is defined by the RFC 791 standard. And as its name says is the IP protocol in version 4, but it is that we do not have previous versions implemented and this was the first of all.

IPv4 uses a 32-bit address (32 ones and zeros in binary) arranged in 4 octets (8-bit numbers) separated by dots in decimal notation. Translating this into practice will be a number such that:

192.168.0.102

In this way we can have addresses that go from 0.0.0.0 to 255.255.255.255. if we translate the previous IP into its binary code we will have:

192.168.0.102 = 11000000.10101000.00000000.01100110

In other words, 32 bits, so with IPv4 we will be able to address a total of:

2 32 = 4 294 967 296 hosts

It may seem like a lot, but at present IPv4 addresses are practically exhausted, since 4 billion computers is a fairly normal figure today. In fact, already in 2011 they began to be scarce, when the body in charge of giving IP addresses in China used the last package, so the IPv6 protocol appeared to the rescue . We have been using this addressing for almost 40 years, so as a lifetime it is not bad.

We must bear in mind that the internal IP addresses will always be the same in LAN networks, and will not be influenced by external IPs. This means that on an internal network we can have a host that has 192.168.0.2, and this will also be used by other hosts on another internal network, being able to replicate as many times as we want. But external IP addresses are seen throughout the Internet network, and these cannot be repeated in any case.

IPv4 header

Therefore, it is convenient to review the structure of an IPv4 header, which has a minimum size of 20 Bytes and a maximum of 40 Bytes.

We will quickly explain each section, since some will later be extensible to IPv6

  • Version (4 bits): identifies the version of the protocol, being 0100 for v4 and 0110 for v6. IHL (4 bits): is the size of the header, which can be from 20 bytes to 60 bytes or what is the same from 160 bits to 480 bits. Service time (8 bits): an identifier in case the package is special, for example more important considering delivery urgency. Total length (16 bits): reflects the total size of the datagram or fragment in octets. Identifier (16 bits): it is used if the datagram is fragmented so that it can later join Flags (3 bits) and Offset or position of the fragment (13 bits): 1st bit will be 0, 2nd bit (0 = divisible, 1 not divisible), 3rd bit (0 = last fragment, 1 = intermediate fragment) TTL (8 bits): IPv4 packet lifetime. It reflects the number of hops in routers it can take, being 64 or 128. When the pack is exhausted it is removed. Protocol: indicates the protocol to which the datagram must be delivered in higher layers, for example TCP, UDP, ICMP, etc. Checksum: to control the integrity of the package, recalculating each time that any previous value changes.

IPv6 and differences with IPv4

Although fully explaining one of these protocols is a world, we cannot do this forever, so we will now continue with IPv6 or Internet Protocol version 6. And where is version 5? Well nowhere, it was only experimental, so let's see what it is and what are the differences with IPv4.

Absolutely all of us will have ever seen an IP address from the previous ones, but surely one of these many fewer times, or we have not even noticed. IPv6 was implemented in 2016 with the definition of its RFC 2460 standard, and it is basically intended to replace IPv4 when necessary. This standard was born out of the need to give Asians more IP addresses. IP addresses are reserved so to speak, and the last packet was reserved in 2011 as discussed above. This does not mean that they are all already used, since companies are using them when more nodes are added to the network.

IPv6 is also designed to provide fixed IP to all types of devices. But how many more IP addresses can we give with this new version? Well, there will be a few, since this address uses 128 bits with a mechanic similar to the previous one. But this time it's done using hexadecimal notation so that it takes up less space, since rendering 128 bits in octets would lead to an enormously long address. So in this case it is made up of 8 sections, each of them 16 bits.

Transferring this back to practice will be an alphanumeric number that will look like this:

fe80: 1a7a: 80f4: 3d0a: 66b0: b24b: 1b7a: 4d6b

In this way we can have addresses ranging from 0: 0: 0: 0: 0: 0: 0: 0 to ffff: ffff: ffff: ffff: ffff: ffff: ffff: ffff. This time we are not going to translate this address into binary code just to avoid depression, but it would have 128 zeros and ones. When we see any of these addresses on our computer or any other host, it is possible that it is represented with fewer groups, and it is that if we have groups with only zeros, these can be omitted as long as they are to the right.

Now with IPv6 and these 128 bits we will be able to address a total of:

2 128 = 340, 282, 366, 920, 938, 463, 463, 374, 607, 431, 768, 211, 456 hosts

In this way, the Chinese will be able to install all the servers they want without any limitation, since their capacity is truly outrageous. Although it is currently not working alone, our computers already have an IPv6 address on their network card.

IPv6 vs IPv4 header and other news

The important thing to implement a new addressing is to make it backwards compatible with the previous protocols and operating in other layers. The use of IPv6 can be used with the other protocols of the application and transport layers with little modification to the headers, except FTP or NTP because they integrate the addresses of the network layer.

We have also studied how to simplify the protocol header, making it simpler than in IPv4 and of fixed length, which greatly helps the speed of its processing and identification of the datagram. This means that we must send the information with IPv4 or IPv6 but not with both mixed. Let's see this header:

Now the header is simplified despite being twice as long as IPv4 if we don't add options in the form of extension headers.

  • Version (4 bits) Traffic class (8 bits): it is the same as the packet priority control Flow label (20 bits): it manages the QoS Data length (16 bits): it is obviously how much it measures the space for data being 64 KB as standard size and determined by jumboframes Next header (8 bits): corresponds to the IPv4 protocol section Hop limit (8 bits): replaces TTL Extension headers : they add extra options for fragmentation, for encryption, etc. There are 8 types of extension headers in IPv6

Among the novelties included in this protocol, it is possible to highlight a greater addressing capacity even in subnets or internal networks and in a more simplified form. Now we can have up to 2 64 hosts in a subnet just by changing a few node identifiers.

Added to this is the possibility that each node can be self-configured when included in an IPv6 res. In this case, an IP will not be requested from the router, but a request asking for the configuration parameters by ND, this is called state-free address autoconfiguration (SLAAC). Although you can also use DHCPv6 if it is not possible to do so.

IPsec in this case is not optional, but mandatory and implemented directly in IPv6 for routers that already operate with this protocol. To this we add support for Jumbograms, that is, Jumbo datagrams much larger than those of IPv4 that were maximum of 64KB, and can now reach up to 4 GB.

In summary here we leave you the two tables to note the difference between both IPv4 vs. IPv6 headers.

  • Blue: common fields in both headers Red: fields that have been removed Green: fields that have been renamed Yellow: new fields

How to know our private, public and IPv6 IP address

Before finishing, we teach ourselves how to know our IP addresses, that of our equipment and that of our router.

To find out the local IPv4 and IPv6 address in Windows 10 there are several methods, but the fastest way is with the command prompt. So we open Start, type CMD and hit Enter. There we will write

ipconfig

And we will receive the result.

And to know the public IP address we will have to resort to our browser or router. we can do on the page:

What is my ip

And finally we can check if we have a public IPv6 address in the following way:

Test-IPv6

We leave you with some network tutorials related to the topic

Did you know that your PC has IPv6, did you know that it existed? If you have any questions or want to point out something we will be happy to help you from the comments.

Tutorials

Editor's choice

Back to top button