Sunday, June 8, 2014

Beginning IPv6 - Understanding the Header

As we continue to learn about IPv6, it is time to now take a look at the entire IPv6 header. Working from RFC 2460, we have the following header.

IPv6 Header Format


   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |Version| Traffic Class |           Flow Label                  |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |         Payload Length        |  Next Header  |   Hop Limit   |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                                                               |
   +                                                               +
   |                                                               |
   +                         Source Address                        +
   |                                                               |
   +                                                               +
   |                                                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                                                               |
   +                                                               +
   |                                                               |
   +                      Destination Address                      +
   |                                                               |
   +                                                               +
   |                                                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
 
The first 4 bits of the header represents the "Version". In this case we would expect this number to be 6

Next we have the "Traffic Class" which is 8 bits. This field is "available for use by originating nodes and/or forwarding routers to identify and distinguish between different classes or priorities of IPv6 packets."

Next up we have the 20-bit "Flow Label". "A flow is uniquely identified by the combination of a source address and a non-zero flow label.  Packets that do not belong to a flow carry a flow label of zero. ... All packets belonging to the same flow must be sent with the same source address, destination address, and flow label. ...   There is no requirement that all, or even most, packets belong to flows"

Next we have the Payload length. This is a 16-bit field or 2 octets. This represents the length of the IPv6 payload including any additional headers.

Following the Payload Length, we see the Next header which is an 8-bit or 1 Octet value and represents the header immediately following the IPv6 header.

The next field is the Hop Limit. This field is similar to the TTL field in IPv4 and gets decremented by each host forwarding the data. Similarly to IPv4 TTL, if a value of 0 is reached, the packets gets discarded.

Next we see the source and then finally the destination addresses. Both of these addresses represents 128 bits. My two previous posts dealt with understanding these two specifically.

An important point to note is while IPv4 header is typically 20 bytes but can be a variable of up to 60 bytes, the IPv6 header is a fixed 40 bytes.

Since we have now broken down the entire IPv6 header, it is now time for us to analyze some application layer protocol running unto of IPv6.


References and Additional Readings: 
http://tools.ietf.org/html/rfc2460
http://tools.ietf.org/html/rfc4193
http://tools.ietf.org/html/rfc3513
http://www.tcpipguide.com/free/t_IPv6DatagramMainHeaderFormat.htm 



No comments:

Post a Comment