OsGate.org Logo

IPv6 introduction - ipv6 ipv4 network

Networks Networks

Date 02.12.2010

Visits 4099

"IPv6 is the protocol designated to replace the venerable IPv4. IPv6 will bring to us a series of new improvements in order to manage our network in a better way."

Introduction

IPv6 is the new network protocol introduced some year ago as IPv4 successor. This protocol has reached an high level of usability and in few years it will become the new standard IP protocol.

Its introduction will bring both freshness and a series of new improvements on the old internet network.

Advantages

There are some new significant improvements and corrections in this new protocol that will let the network to enter into a new level, and we can say that these modifications are the logical consequences of what the internet is becomed through the year, but they were also minded with a look in the near future.

Here are some changes:

  • more addresses available: one of the major problem with Ipv4 is that we can only use 2^32 IP , now there are 2^128 addresses available.
  • improved routing: version 6 has been created to be fully functional with routing, especially in modern environments where we can have very complex design, combining efficiency and flexibility.
  • security enhancements: IPv6 has been designed with security in mind, including the possibility to use authentication and encryption header.
  • development of new protocols: with IPv6, new protocols have been developed, as the ICMPv6, alter ego of ICMP on version 4. In addition the ND (Neighbour Discovery) protocol has been added. This plays some tasks of ARP and ICMP of previous version.
  • new topology of addressable messages: with this version broadcast doesn't exist anymore due of its performance problems. So we've the following addresses:
    • unicast => from host to host
    • multicast => send messages to a group of host. This exists also in Ipv4 but is poorly used. Multicast support is mandatory if you want to use IPv6.
    • anycast => is new, a message sent with anycast, it's a message that must be sent to a group of host, but it's enough that only one member of the group receive it.
    • broadcast: is not here anymore. Instead use multicast.

In addition there were a substantial change in representing and managing IPv6 addresses. This because the increase from 2^32 to 2^128 also leads to a different way to handle all kind of IP operations.

Hexadecimal representation

The length of IPv6, our beloved 2^128, don't let us to use full digit numbers to wrote the whole address, because a 2^128 number with only numbers can be a little tricky to remember due of its length:

196.35.210.35.200.0.34.245.0.0.0.0.145.244.135.255

This is a 128 bit number in decimal notation.

Now we can take a look on the same number but with the hexadecimal notation:

Binary
11000100 00100011 11010010 00100011 11001000 00000000 00100010 11110101
00000000 00000000 00000000 00000000 10010001 11110100 10000111 11111111

Hexadecimal
C4 23 D2 23 C8 00 22 F5 00 00 00 00 91 F4 87 FF

Now we have our hexadecimal number. The next step is to group our number every 16 bit, and write a ":" after each group:

C423:D223:C800:22F5:0000:0000:91F4:87FF

If you look at this IPv6 address, you can notice that we have two group of "0000", so we can simplify our notation by compressing ":0000" to ":0".

C423:D223:C800:22F5:0:0:91F4:87FF

There are others trick we can apply to the address, one of them is to replace a series of contiguous zero by "::". Please note that we can use "::" only one time in the address, this because when we use "::" for example two times, at the end we will never know how many zeroes have been replaced. Then when can avoid to write zeroes in front (not at the end) of a group:

0E9C => E9C
E9C0 => E9C0

So at the end we will have:

C423:D223:C800:22F5::91F4:87FF

IPv6 Header

IPv6 header has some modification if compared to ipv4:

Bits	Field			Description
4 Version Protocol version, this will be always 6
8 Traffic Class Replace Ipv4's TOS field
20 Flow Label Used to check datagrams flow and QoS
16 Payload Length Contains payload's bytes number and extension header if any
8 Next Header Contains protocol type / extension header type used after a main or extension header.
8 Hop Limit It has the same function of TTL (Time To Live)
128 Source Address Source address
128 Destination Address Destination address

The header has a fixed length of 40 byte (320 bits).

In the table above we've talked about extension header, a new feature of IPv6. These contain additional information about how to threat a packet, and they also have their own header.

We can use how many header we want or nothing at all.

Here we've the six extension header available:

  • Hop-by-hop Options
  • Routing
  • Fragment
  • ESP (Encapsulatin Security Payload)
  • AH (Authentication Header)
  • Destinations Options

Usually after the last extension header comes the payload. Notice that extension header are placed between main header and payload.

IPv6 Unicast

Hierarchical management of addresses

An IPv6 unicast address can be divided in three main parts, each of them with a specific purpose. This let us to have hierarchy based on each part of the address.

Bits	Field		Description
0-48 Prefix It's address prefix, called also Global Routing Prefix. We can also call this field network ID.
16 Subnet ID Represents a subnet
64 Interface ID Represents a device or an host on the network. It's a unique number.

Each filed is a level in our hierarchy, the first 48 bits , also called Prefix, represents a /48 addresses class which can be directly assigned to a company. Then our hypothetical company can further choose to divide the next 16 bits, the Subnet ID field, into subnets (there are 65536 subnet available) in the same manner of an IPv4 subnet, our can simply set to zero this field, which mean no subnet.

Last 64 bits represents uniquely an host on the network.

Interface ID

As we've seen above last 64 bit represents an host on the network, and we can obtain this from the MAC address. The problem in this operation is that MAC address is a 48 bits number but we need a 64 bits one, and this modifications are made by modifying the address as specified in the IEEE EUI-64 format (EUI: extended unique identifier).

First step to define the Interface ID is to obtain the MAC address:

23:0C:6E:CC:13:89

Then we divide the address as shown below:


OUI (Organizationally Unique Identifier)
23:0C:6E => 230C:6E

Device Identifier
CC:13:89 => CC:1389

First part must be placed on the left side and second on the right side.

Then we add in the middle 16 bits with the "FF:FE" value (must be always this value):

230C:6EFF:FECC:1389

Last step is to change the seventh bit (universal/local bit) starting from left:

29 0C

00101001 00001100

2A 0C

00101011 00001100

So at the end of this procedure we will have this as interface ID:

2A0C:6EFF:FECC:1389

Address types

In the IPv6 world as in the IPv4, there are some special adrresses, like the loopback address, here we've the special type of address in IPv6:

  • loopback: the same loopback address in IPv4, we represent it as 0:0:0:0:0:0:0:1 or ::1 in its compressed form
  • not specified: a non specified address is used when the device doesn't know its address. The value is 0:0:0:0:0:0:0:0 or :: compressed.
  • private: with IPv6, NAT it's no more necessary for a local network, and for this reason we need to subdivide the private class of IP:
    • site-local address: a site-local address is usable only in the local network and cannot be routed to the internet. These addresses begin always with FEC, FED, FEE or FEF.
    • link-local address: these addresses aren't forwarded by routers so we can use a link-local address only on a given network segment. These addresses are used only in special cases and they begin with FE8, FE9 FEA or FEB.

IPv6 Multicast

Multicast transmission type, lets you to send a message to to a group of host at the same time.

We can distinguish those addresses because they begin with FF.

Format

The format of a multicast address is the following::

Bits 	Field 	 	Description

8 - First eight bits are always set to 1. This distinguishes a multicast address from the others.
4 Flags Are address flags
4 Scope ID It's the scope where the address can act. Below we will see the possible value
112 Group ID Is the address of the multicast group

The ScopeID is used to define where the address can act in the network scope, here we've a list of possible scope:

  • 0 = Reserved
  • 1 = Node-local => It refers to a node on the network
  • 2 = Link-local => It refers to a local network, these address cannot be forwarded by a router
  • 5 = Site-local => It refers to a local network, can be forwarded
  • 8 =Organization-local => Can act between more internet networks
  • 14 = Global => Internet
  • 15 = Reserved

For each scope we can use multicast already defined by the IANA corporation.

For example the FF02:0:0:0:0:0:0:9 multicast address, is a link-local used by RIP routers or another example can be the FF0X:0:0:0:0:0:0:101 that is a variable multicast address used with by the NTP (Network Time Protocol).

On the IANA website we can find the IPv6 multicast addresses already assigned for each scope => http://www.iana.org/assignments/IPv6-multicast-addresses/http://www.iana.org/assignments/IPv6-multicast-addresses/

IPv6 Stateless Configuration

IPv6 is shipped with a feature that lets an host to configure the address automatically without the need to use a DHCP server. This feature is called stateless configuration, and the table below show you the steps executed to determine the address.

  1. Link-local address generation => the device generates an unicast link-local address, using its MAC address or using a token
  2. Test of the generated address => in this step the device verifies that the generated address is unique on the network. This step is mostly valid when it uses a token to generate the address. It uses the ND protocol.
  3. Address assignment => if the previous test was successful, the host will assign the address to an interface
  4. Router contact => The router is contacted in order to get more information on how to continue with the configuration
  5. Router direction => The router replies by sending information on how continue auto-configuration. It replies by saying if the auto-c configuration is enabled on the network or if not, by sending the address of a DHCP server.
  6. Global address configuration => Our host defines its own global address for internet

ICMPv6

ICMPv6 is the twin of ICMPv4, and basically it provides the same functions but only with some improvements. Below you will find the most common messages in this version of the internet control message protocol.

Error messages

Destination Unreachable

Tell the host that the datagram sending is failed because the destination is not reachable.

Packet Too Big

The "Packet too big" message is a new feature, because it's changed the way on how the IPv6 datagrams are fragmented by the router. In fact a router doesn't fragment anymore datagrams with higher dimension than the MTU, and then it will simply reply to the host with a "Packet Too Big" failure message. In IPv6 the default MTU is set to 1280 byte.

Time Exceeded

This message is generated when an IPv6 packet reach the limit of hop it can pass on the network. The old TTL (Time to live) now has been renamed to Hop Limits, so when this field reaches zero the packet cannot be routed anymore and the you have to expect a "Time Exceeded".

Parameter Problem

The "Parameter Problem" is used when in the IPv6 header is present a serious error. This kind of messages refer to a general error of the datagram, and not like the others that specifies a defined problem.

Below you will find the problem that generates this failure:

  • Erroneous Header Filed Encountered, header contains a critical error and cannot be forwarded
  • Unrecognized Next Header Type Encountered, a Next Header in the header contains unknown data 
  • Unrecognized IPv6 Option Encountered, an unrecognized IPv6 option is present.

Informative messages

Here we've the most common informative messages you will find in ICMPv6:

  • Echo, these are the classical echo messages we've in Ipv4, like Echo Request and Echo Reply, used in the ping command
  • Router Advertisement , these are the messages sent by router on the network, in order to letan host to know that there are router on the network.
  • Router Solicitation, an host that send this message is able to know which router exist on the network
  • Neighbor Advertisement, it works like the Router Advertisement, but works with host instead of router
  • Neighbot Solicitation, like Router Solicitation, but works between host on the network

ND

The Neighbor Discovery (ND) protocol is a new entry shipped with IPv6 and it includes a lot of functions about communication between devices on a network replacing some of ICMP or ARP.

This protocol is strictly related with ICMPv6 and "help" IPv6 communications.

ND is composed of 9 main functions that we can subdivide in more communication group:

Communication Host -  Router

  • Router Discovery, used by the host to know if there are router on the network
  • Prefix Discovery, used to discover network prefix, and so to know on which network we're
  • Parameter Discovery, used to know others network parameters, such as MTU
  • Address Auto configuration, used for stateless configuration

Communication Host -  Host

  • Address Resolution, used to get the MAC of an host using its IP. It's like ARP in IPv4.
  • Next-hop determination, checking the destination of IP datagram an host can determine the next hop to send the packet
  • Neighbor Unreachability Detection, with this function an host is able to determine if and adjacent host is reachable or not
  • Duplicate Address Detection, it simply check if the address we want use is already assigned on the network

Redirect

Redirect is a function used when a router inform an host that exist a better route to send data to a destination.

Useful commands

  • ping6
  • traceroute6
  • tracepath6
  • ip6tables