📜 ⬆️ ⬇️

IPv6 theory and practice: packet types and autoconfiguration

This second article continues the IPv6 cycle. The first introductory article dealt with the structure of the IPv6 packet, the address entry, the prefix. Today we will talk about what types of packets are in IPv6, the importance of multicasts, as well as the types of automatic configuration of a host in IPv6.
Note: in this and other articles, by the word “router” I mean “cisco router”.

Types of IPv6 Broadcasts


In IPv6, there are three types of mailing:
  1. Unicast - one source, one recipient
  2. Multicast - one source, several recipients
  3. Anycast - one source, several potential recipients, but is sent only to one of them.

As we see, there is no broadcast ( Broadcast ) distribution. Where broadcasting was previously used, multicast addresses are used in IPv6. Indeed, why limit yourself to the broadcast framework when multicast is much more flexible - sometimes you can send a message to a group of hosts, and sometimes to everyone.

More about multicastes


In IPv6, a special range FF00 :: / 8 is allocated for multicast addresses. That is, all addresses starting with FF are multicast .
Multicast addresses are of two types:
  1. Assigned multicast - special addresses whose purpose is predefined.
  2. Solicited multicast - the rest of the addresses that devices can use for applications.

Assigned Addresses

Assigned addresses are multicast addresses reserved for specific device groups. A package sent to such an address will be received by all devices in the group. There are two special assigned multicast addresses:
  1. FF02 :: 1 - this group includes all devices in the local network. Thus, this special multicast address behaves like a broadcast address in IPv4. All devices are required to accept packets sent to FF02 :: 1.
  2. FF02 :: 2 - this group includes all routers. With the help of this address it is possible to make distribution to the routers present in the local network. As soon as the Cisco router turns on routing mode for IPv6, it automatically becomes a member of this group and begins to accept all traffic addressed to FF02 :: 2.

Requested Addresses

This type of address automatically appears when a unicast address appears on some interface. The address is formed from the FF02 network: 0: 0: 0: 0: 1: FF00 :: / 104, the remaining 24 bits are the same as the configured unicast address. Note that / 104 means that from this network only the first 104 bits are taken to form the address (the last two zeros do not participate in the record).
When a device receives a packet that has the recipient's address on the FF02 network: 0: 0: 0: 0: 1: FF00 / 104, it must accept this packet if the remaining 24 bits in this address are equal to the last 24th bits in the unicast address of the device itself.
Suppose there is a device with the address 2001: 0DB8: ABCD: 0001: 0000: 0000: 0123: A050. The last 24 bits (6 hexadecimal digits) in this case are “23: A050”. This device must also accept traffic arriving at the multicast address FF02: 0: 0: 0: 0: 1: FF23: A050.
Such multicast addresses are actively used in the situation when a device wants to know the MAC address of its neighbor (an analogue of ARP in IPv4).
For example, some device wants to send a packet to the local address FE80 :: 1234: 5678. This is the local address (since it starts with FE80, more about the types of addresses in the previous article), it means it is in our local network. Accordingly, in order to send something to it, you need to know the MAC address of the target device (to form an Ethernet frame). The host sends to the requested (solicited) multicast address, FF02: 0: 0: 0: 0: 1: FF34: 5678 packet. The last 24 bits of “34: 5678” were taken from the IPv6 address of the device being searched for. In the case of a bunch of IPv4 and ARP, this packet would be sent to the address 255.255.255.255.
Next, the device being searched for responds to this multicast packet with a unicast, reporting its MAC address in the response.
There may be situations when several devices process such a packet (if they have the last 24 bits of the address), but there is nothing to worry about, since in any case it is better than broadcasting when all devices processed the request.

Autoconfiguration


In IPv6, a new node autoconfiguration mechanism has appeared. It is called Stateless Address Autoconfiguration or SLAAC. It is used to automatically obtain an IP address and network prefix by the host, without using a DHCPv6 server, or in conjunction with it.
Indeed, when we create a certain network, we prescribe the gateway address and the prefix of this network on the router. This information is enough to give addresses to devices. The SLAAC mechanism allows the router to assign addresses to devices even if there is no DHCPv6 on the network.
A Cisco IPv6 router with a working IPv6 interface sends information about this network to the network, including the network portion of the IP address and the prefix length. In addition, this message contains the default gateway address for the network. This message is called Router Advertisement (RA) and is usually sent once every 200 seconds to the multicast address FF02 ::.
If a new device appears on the network that needs an address, it does not have to wait 200 seconds for the next broadcast, it can send a request to the router (Router Solicitation or RS) and ask it to send the settings immediately. The request to the router is made to the address FF02 :: 2.
Both RA and RS messages are sent via ICMPv6, with the multicast destination address in the IP packet.
In order for the router to fully serve the network (send RA to it and respond to RS), it is not enough to configure the IPv6 address on the interface, you must also enable routing mode for IPv6 networks by entering the ipv6 unicast routing command in global configuration mode.
There are three ways to assign an address:
  1. The router provides the subnet, prefix and gateway address. Other information devices do not receive.
  2. The router provides the subnet, the prefix and the gateway address, and a separate DHCPv6 server provides additional information: options, routes, DNS server addresses, and more - as needed.
  3. Stateless Address Autoconfiguration is not used at all - the device does not use RA from the router, but it accesses the DHCPv6 server, which provides all the necessary information, including the address, gateway, prefix, DNS server, and another, depending on the DHCP settings.

In the case of the third option, the DHCP server provides the client with a full IPv6 address - all 128 bits that are assigned on the client interface. In the case of using the first two options, the router tells the client only the network in which it is located, the gateway and the prefix. Thus, the client lacks the second half of the IP address (interface identifier). Let me remind you that the address consists of 128 bits, and the router produces a maximum, only the first 64. The remaining 64 bits, where the host information should be located, must be filled by the device itself, the router does not care what the device puts there, it’s important that the first 64 bits (network) were correct. To generate the right half of the IP address, the EUI-64 algorithm is used or a random set of numbers is generated.
UPD1: They asked me in a personal on the right side of the address, why so little information about it. I answer. They gave you the IPv4 mesh 192.168.0.0/24, and invent yourself the right side of what you please. The same is here, only now there is a place where fantasies can be played around :) Who has a scant imagination - there is an EUI-64

')

Source: https://habr.com/ru/post/210224/


All Articles