IPv6

From neil.tappsville.com
Jump to navigationJump to search

https://www.ietf.org/rfc/rfc2460.txt

Sample IPv6 ICMP Packet https://www.cloudshark.org/captures/84fd54ad03e0

IPv6 Packet Header

   IPv6 Header - fixed length of 40 octets, any header extensions are
   included in the payload length 


   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |Version| Traffic Class |           Flow Label                  |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |         Payload Length        |  Next Header  |   Hop Limit   |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                                                               |
   +                                                               +
   |                                                               |
   +                         Source Address                        +
   |                                                               |
   +                                                               +
   |                                                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                                                               |
   +                                                               +
   |                                                               |
   +                      Destination Address                      +
   |                                                               |
   +                                                               +
   |                                                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   Version              4-bit Internet Protocol version number = 6. [0110] 0x6

   Traffic Class        8-bit traffic class field. DSCP 6bits [000000] + ECN 2bit [00]
                        DSCP Traffic classification (network), and Explicit Congestion Notification    

   Flow Label           20-bit flow label. (under development)

   Payload Length       16-bit unsigned integer.  Length of the IPv6
                        payload, i.e., the rest of the packet following
                        this IPv6 header, in octets.  (Note that any
                        extension headers [section 4] present are
                        considered part of the payload, i.e., included
                        in the length count.)

   Next Header          8-bit selector.  Identifies the type of header
                        immediately following the IPv6 header.  Uses the
                        same values as the IPv4 Protocol field [RFC-1700
                        et seq.]
                          0x003A decimal 58 = ICMPv6 payload
                          0x0006 decimal 6 = TCP segment in payload
                          0x0011 decimal 17 = UDP segment in payload

   Hop Limit            8-bit unsigned integer.  Decremented by 1 by
                        each node that forwards the packet. The packet
                        is discarded if Hop Limit is decremented to
                        zero.

   Source Address       128-bit address of the originator of the packet.
                        See [ADDRARCH].

   Destination Address  128-bit address of the intended recipient of the
                        packet (possibly not the ultimate recipient, if
                        a Routing header is present).  See [ADDRARCH]
                        and section 4.4.

IPv6 Extension Headers

Extension Headers are optional RFX8200

  • Type 0 - Hop by hop options
  • Type 43 - Routing
  • Type 44 - Fragment
  • Type 60 - Destination Options
  • Type 51 - Authentication (AH)
  • Type 50 - Encapsulating Security Payload (ESP)


IPv6 Addresses

Represented in Hexadecimal, there are 8x 4 hexdecimal digits fields mapping to 16 binary bits separated by ':' Each hex digit represents a nibble. IE 0x2 --> 0010 In total 32 hex digita in a IPv6 address --> 128 binary bits


  • Leading zeros in any field may be omitted when writing an address
  • '::' may be used once to compress adjacent fields that would otherwise only contain zeros,
    • RFC5952 is multiple opportunies to shorten zero bits, the longer should be used, or the left most if the two options are the same length

IPv6 Prefix and URI

ipv6_address/Prefix length prefix length is the left most bits.

2001:db8::/32 --> prefix 2001:0db8
2001:0db8:0000:0000:0000:0000:0000:0000/32

2001:db8:1::36e:1250:2b00/48 --> prefix = 2001:0db8:00001
2001:

RFC3986 - '[]' square brackets are used to enclose the IP liternal

IPv6 Neighbour Discovery

ICMPv6 is used by IPv6 nodes to report errors encountered in processing packets and to perform other internet-layre functions such as diagnostics (ping)

Functions of Neighbour Discovery

Nodes on the same link use ND

  • discover each other presence
  • determine each other's link-layer addresses
  • find routers
  • maintain reachability info about the paths to active neighbours

Messages used:

  • Router Solicitation (RS) - host send this to prompt routers to send RA quickly
  • Router Advertisement (RA) - routers send periodically or in response to RS
  • Neighbour Solicitation (NS) - (multicast) to request link-layer address of target node while aso supplying their own, unicast when a node tried to verify the reachability of a neighbour
  • Neighbour Advertisement (NA) - sent in response to NS, and send unrequested NA to propagate new information quickly
  • Redirect - routers send to inform a host of a better first-hop node

IPv6 Address Auto configuration

Stateless

Stateless Address Auto configuration (SLAAC), no hosts are maintaining the address allocation table

Stateful (via DHCPv6)

Dynamic Host Configuration for IPv6. DHCPv6 server will keep track of what MAC's have been assigned IPv6 Addresses.

fe80 Auto configuration of link-local addresses

Link local is generated by SLAAC with the fe80 prefix, duplicate address detection should be performed before the address is used.

Duplication Address Detection (DAD)

Using Neighbour Solicitation (NS) and Neighbour Advertisement (NA) messages

NS is sent with a source address of '::' and destination is the multicast address of the specified address. The ICMP body contains the tentative IPv6 link local address

Next is section 5.5. https://academy.apnic.net/en/course/ipv6-fundamentals/module/module-5-ipv6-neighbor-discovery-address-autoconfiguration/resource/topic-5-4-ipv6-address-autoconfiguration-duplicate-address-detection