IPv6 Basics

 

What is IPv6 ?   

Overall Specification in RFC 2460

IPv6 is a new version of IP created to counter the foreseen limitation of IPV4 due to its size being of only 32 bits. IPV6 Addresses are 128 bits in size and use hexa-decimal which offer an exponentially  larger address space than for IPV4.

Why Use IPv6 ?

  • Larger address space. I mean REALLY LARGE, apparently there is 664 BILLION IP addresses for every grain of sand on all the beaches on Earth. That’s crazy !
  • Globally unique IP addresses : instead of each node in a LAN to “hind” behind NAT every host can have it’s own address.
  • Header format efficiency : reduced header processing time thus more efficient packet switching.
  • improved option mechanism : instead of having the options in a field inside the header , IPV6 options are placed in a header between  IPV6 header and transport layer header.
  • Address autoconfiguration : Similar to the APIPA address in IPV4, IPV6 gives the possibility to dynamically configure a Link-Local address
  • Flow labeling capability : instead of using Type of Service (TOS) byte as in IPv4 IPv6 gives the capability to label packets belonging to a particular type of traffic.
  • security capabilities : very secure, IPsec is a requirement.
  • MTU discovery : to avoid packet fragmentation  IPV6 has the capability of discovering MTU before sending packets.
  • site multi-homing : hosts can have IPv6 addresses and networks can have multiple IPv6 prefix with makes it easier to work with different ISP’s.
  • Mobility : mobile IPv6 allows nodes to change locations but still keep their connections via a permanent address.
  • No more need for broadcast, replaced by multicasts

So, What’s in the IPv6 header  ?

Let’s break it down :

  • Version : As in IPv4 the version field which is 4 bits long indicates the version of IP we are using, for IPv6 packets the bits are set to 0110.
  • Traffic Class : 8 bits in length : similar to the TOS byte in IPv4, this field describes the class or priority of the IPv6 packet.
  • Flow Label : 20 bits in length , its a value given to a flow of packets, and that value is the same across that flow. its simply to identify them as part of that flow.
  • Payload length : 16 bits in length , indicates the payload’s size in bytes
  • Next Header : 8 bits in length, indicates the type of extension header that will follow 
  • Hop Limit : 8 bits , like a TTL , where there is a counter that decrements at each hop and discards the packet if it hits 0
  • Source Address : Sender IP
  • Destination Address : Reciever  IP

The header is 40 bytes where it is 20 in IPv4 , even though the address size is 4 times bigger, instead of options inside the header like IPv4, IPv6 includes the options in extended headers.


IPv6 Address Representation

IPv6 has always scared me in my early career but when you look at it closely it’s not so complicated, in some aspects it’s even easier than IPv4. Here is an example of an IPv6 Address :

2001:0db8:3333:4444:5555:6666:7777:8888

The first thing you can see is that there are 8 portions of the address separated by colons, each portion is 16 bits which mean each character is 4 bits,


4*4 = 16bits

16*8 = 128bits .


There are  also numbers and letters, which we call hexadecimal format, that’s the first thing that makes us reluctant to learn IPv6, let’s break that down :
Remember how IPv4 addresses are 32 bits ?

source : https://newtheblogger.files.wordpress.com/2018/05/images-4.png


That means that each one of the 4 numbers is a octet which is 8 bits and the maximum value that we can get with all bits turned to 1 is 255, no need for hexadecimal here.

What about IPv6 ?

source :https://www.computernetworkingnotes.org/images/ip-tutorials/it04-01-ipv-6-structure-and-format.PNG

IPv6 Introduced hexadecimal because, as stated above, each individual digit is 4 octets  which means that the maximum value of an octet (if you turn on all four 1’s) is 15 which we can’t represent in decimal because of the limited address space. for this we need to use hexadecimal.

source : https://blogger.googleusercontent.com/img/proxy/AVvXsEin4XUnvEH0UOApfs9Y0EpqT7JkKYGGTyqZtYfVzxOi27w34-l23bKbf7BdkXFysHZTlMrPDGcsaggTidxg6OIACiA8ekjGCk44ql-V8f5Gp4MbSsZ-Y2tCc3Z1XqMBhi1PHhRinekBKi0DG2kXEG1qIOBYafqzVtTL_gPpdeW12jJq49o=


You can see above what I’m talking about, We count from 1 to 9 and after that for every double digit number we count from A to F.


IPv6 Address simplification

There are ways to simplify IPv6 addresses for it to be easier to write down and remember, take the address 2001:0db8:0000:000b:0000:0000:0000:001A, there are two things we can do here :

  • Remove leading zeros : We can remove the leading zeros in any octet starting by one, leading zeros in previous address are highlighted in red  : 2001:0db8:0000:000b:0000:0000:0000:001A which makes the address : 2001:db8:0:b:0:0:0:1A
  • we can compress consecutive fields of zeros using double colon (::) : taking back our previous address you can see highlighted that there are 3 octets with only zeros inside : 2001:db8:0:b:0:0:0:1A, we can simplify this by writing 2001:db8:0:b::1A, which  makes it much easier to read, note that double colons can only be used one because otherwise it would be impossible to know how many zeros are compressed in each one of them.

IPv6 Address allocations

The first part of an IPv6 address can tell us more on what it is reserved / used for,  The IPv6 address space was delegated to IANA, you can find the prefix allocation chart below :

IPv6 PrefixAllocation Reference Notes
0000::/8Reserved by IETF[RFC3513][RFC4291]Loopback Addresses comparable to 127.0.0.1 in IPv4, compatible with IPv4
0100::/8Reserved by IETF[RFC3513][RFC4291]0100::/64 reserved for Discard-Only Address Block [RFC6666]. Complete registration details are found in [IANA registry iana-ipv6-special-registry].
0200::/7Reserved by IETF[RFC4048]Deprecated as of December 2004 [RFC4048]. Formerly an OSI NSAP-mapped prefix set [RFC4548].
0400::/6Reserved by IETF[RFC3513][RFC4291]
0800::/5Reserved by IETF[RFC3513][RFC4291]
1000::/4Reserved by IETF[RFC3513][RFC4291]
2000::/3Global Unicast[RFC3513][RFC4291]The IPv6 Unicast space encompasses the entire IPv6 address range with the exception of ff00::/8, per [RFC4291]. IANA unicast address assignments are currently limited to the IPv6 unicast address range of 2000::/3. IANA assignments from this block are registered in [IANA registry ipv6-unicast-address-assignments]. [7] [8] [9] [10] [11] [12] [13] [14] [15]
4000::/3Reserved by IETF[RFC3513][RFC4291]
6000::/3Reserved by IETF[RFC3513][RFC4291]
8000::/3Reserved by IETF[RFC3513][RFC4291]
a000::/3Reserved by IETF[RFC3513][RFC4291]
c000::/3Reserved by IETF[RFC3513][RFC4291]
e000::/4Reserved by IETF[RFC3513][RFC4291]
f000::/5Reserved by IETF[RFC3513][RFC4291]
f800::/6Reserved by IETF[RFC3513][RFC4291]
fc00::/7Unique Local Unicast[RFC4193]For complete registration details, see [IANA registry iana-ipv6-special-registry].
fe00::/9Reserved by IETF[RFC3513][RFC4291]
fe80::/10Link-Scoped Unicast[RFC3513][RFC4291]Reserved by protocol. For authoritative registration, see [IANA registry iana-ipv6-special-registry].
fec0::/10Reserved by IETF[RFC3879]Deprecated by [RFC3879] in September 2004. Formerly a Site-Local scoped address prefix.
ff00::/8Multicast[RFC3513][RFC4291]IANA assignments from this block are registered in [IANA registry ipv6-multicast-addresses].

Good to know but the ones that interest us are below :

PrefixDescriptionNotes
::1128Reserved by IETF[RFC3513][RFC4291]Loopback Addresses comparable to 127.0.0.1 in IPv4, compatible with IPv4
::/8Reserved addresses
2000::/3Adresses unicast routable on internetAddresses assigned from ISP
fc00::/7 or FEC0::/10Reserved by IETFDeprecated by [RFC3879] in September 2004. Formerly a Site-Local scoped address prefix.
fe80::/10Link-local unicast addressEnvoi individuel sur liaison locale (RFC 429124)similar to APIPA 169.254.x.x
ff00::/8Adresses multicastDiffusion groupée (RFC 429124)Multicast

IPv6 unicast addresses

So what are the most important addresses we have to know for IPv6 ?

  • Global unicast address : These addresses are the internet routable IP addresses, instead oh having private and public addresses in IPv4, we have so many addresses in V6 that we can afford for each host to have it’s own internet routable address. The address is composed of 3 parts
    • Global routing prefix : it is the portion of the address assigned by the provider / ISP to the customer.
      • Usually 48 bits for example /48 for the ISP
    • Subnet ID : This portion of the network is for allocating subnets in the customer site.
      • Usually 16 bits , for example /16  from which the client creates multiple /64’s
    • Interface ID : This portion of the network identifies the interface of the subnet .
      • Usually 64 bits, the Interface ID field is composed of the 48 bit mac address with the FFFE hexadecimal value inserted in between, for example if the MAC  is 01:00:0C:A4:BC:D0 the Interface ID field of the address would be 0100:0CFF:FEA4:BCD0
  • Link-Local addresses : These addresses are a little bit like APIPA addresses in the sense that it’s an auto-configured address that’s used to communicate between hosts on the same subnet if there is no DHCP server or static IP addressing. You can identify it with the leading FE8 hexadecimal numbers.
  • Unique local addresses : These addresses compares to IPv4 private addresses, they are used fo internal communications without the need of routability on the internet.You can identify it with the leading FC00::/7 hexadecimal numbers.

The IP addresses that you see above can all be used at once so a we can have 3 IPv6 addresses on a single host ! This can be used for ISP multihoming, and also for migration scenarios.For example if you want to readdress global addresses but still want to maintain reachability in the network, you can use unique local address alongside global ones for hosts to be able to communicate with each other during the migration, cool right ? 


IPv6 anycast addresses

We’ve been hearing it over and over again, no more broadcast in IPv6 huh ? Yes exactly, broadcast has been replaced with Anycast, but what exactly is Anycast ? Broadcast is a “one-to-all” address that means if one host sends a broadcast message it is  is sent to all devices in the switching domain (also called broadcast domain) it’s like device A is yelling through a megaphone and that device B,C and D that are all in the same room with him hears the yell. Anycast is a “one-to-nearest” address which means that all routers have the same IP address for  a gateway and that the device sends it’s request to the nearest gateway. imagine host A is in North America and Host B is in Asia and they want to access the closest Gateway/ Datacenter to them, then we would use Anycast addresses on the routers for the host to be routed to the closest gateway.  The routers / nodes have to be specifically configured to recognize the address as an Anycast address.


IPv6 multicast addresses

IPv6 multicast is much similar than in IPv4, it is a “one-to-many” address, the idea is that there is a specific address that identifies a set of hosts. There is a function added to IPv6 multicast compared to IPv4 multicast is that you can simulate a broadcast message with an “all-nodes” multicast address instead of “many nodes” one.  you can identify the address by the leading FF0x hexadecimal numbers :

  • FF01 is for the All-Nodes multicast address.
  • FF02 is for the many nodes multicast address.

Well, folks we’ll stop here for today ! I think it’s enough to sleep on tonight, as you can see IPv6 is very interesting once you get past the initial fear, instead of making our lifes harder as everyone is scared of, it will make it much easier. Way to go IPv6 !


Comments