# L'IPv6

#### Structure de l'ipv6 :

L'ipv6 repose sur 128 bits. Il y a donc 2<sup>128</sup> adresses possibles, Soit ≈ 3,4 × 10<sup>38</sup> (340 282 366 920 938 463 463 374 607 431 768 211 456).

##### Exemple : <span style="color: rgb(224, 62, 45);">2001</span><span style="color: rgb(45, 194, 107);">:</span><span style="color: rgb(224, 62, 45);">0db8</span><span style="color: rgb(45, 194, 107);">:</span><span style="color: rgb(224, 62, 45);">0000</span><span style="color: rgb(45, 194, 107);">:</span><span style="color: rgb(224, 62, 45);">85a3</span><span style="color: rgb(45, 194, 107);">:</span><span style="color: rgb(224, 62, 45);">0000</span><span style="color: rgb(45, 194, 107);">:</span><span style="color: rgb(224, 62, 45);">0000</span><span style="color: rgb(45, 194, 107);">:</span><span style="color: rgb(224, 62, 45);">ac1f</span><span style="color: rgb(45, 194, 107);">:</span><span style="color: rgb(224, 62, 45);">8001</span>

Il y a 8 groupes de 16 bits séparé par des : . Les groupes sont en hexadécimal (base 16 \[ 1 2 3 4 5 6 7 8 9 A B C D E F\])

#### Règles de simplification : 

1\) Nous pouvons supprimer les 0 en début de chaque groupe.

2001:0db8:0000:85a3:0000:0000:ac1f:8001 -&gt; 2001:<span style="color: rgb(224, 62, 45);">0</span>db8:<span style="color: rgb(224, 62, 45);">000</span>0:85a3:<span style="color: rgb(224, 62, 45);">000</span>0:<span style="color: rgb(224, 62, 45);">000</span>0:ac1f:8001 -&gt; 2001:db8:0:85a3:0:0:ac1f:8001

2\) Le groupe le plus long de 0 peux être supprimé.

2001:0db8:0000:85a3:0000:0000:ac1f:8001 -&gt; 2001:0db8:0000:85a3:<span style="color: rgb(224, 62, 45);">0000</span>:<span style="color: rgb(224, 62, 45);">0000</span>:ac1f:8001 -&gt; 2001:0db8:0000:85a3::ac1f:8001

Avec les deux règles :

2001:0db8:0000:85a3:0000:0000:ac1f:8001 -&gt; 2001:<span style="color: rgb(224, 62, 45);">0</span>db8:<span style="color: rgb(224, 62, 45);">000</span>0:85a3:<span style="color: rgb(224, 62, 45);">0000</span>:<span style="color: rgb(224, 62, 45);">0000</span>:ac1f:8001 -&gt; 2001:db8:0:85a3::ac1f:8001

#### Masque de sous réseau : 

Avec un masque en /64, l'adresse ipv6 est scindé en deux : <span style="color: rgb(224, 62, 45);">2001:0db8:0000:85a3</span>:<span style="color: rgb(35, 111, 161);">0000:0000:ac1f:8001</span>/64

En rouge le réseau et en bleu les hôtes.

Avec un masque en /56, l'adresse ipv6 est coupé au 56e bits : <span style="color: rgb(224, 62, 45);">2001:0db8:0000:85</span><span style="color: rgb(35, 111, 161);">a3:0000:0000:ac1f:8001<span style="color: rgb(0, 0, 0);">/56</span></span>

#### <span style="color: rgb(35, 111, 161);"><span style="color: rgb(0, 0, 0);">Les 3 types d'adresses ipv6 :</span></span>

##### <span style="color: rgb(35, 111, 161);"><span style="color: rgb(0, 0, 0);">Link local :</span></span>

<span style="color: rgb(35, 111, 161);"><span style="color: rgb(0, 0, 0);">Il s'agit d'une adresse ipv6 auto générée qui commence par fe80: elle ne sont pas routable sur internet. </span></span>

<span style="color: rgb(35, 111, 161);"><span style="color: rgb(0, 0, 0);"> fe80::8744:c353:6a2b:187c%7 ou en entier : fe80:0000:0000:0000:8744:c353:6a2b:187c</span></span>

<span style="color: rgb(35, 111, 161);"><span style="color: rgb(0, 0, 0);">Ces adresses servent à la communication sur le réseau local. </span></span>

##### <span style="color: rgb(35, 111, 161);"><span style="color: rgb(0, 0, 0);">Global unicast (GUA) :</span></span>

<span style="color: rgb(35, 111, 161);"><span style="color: rgb(0, 0, 0);">Il s'agit d'une adresse ipv6 unique routable sur internet. Elle est utilisée par les hôtes pour aller sur internet et commence par 2xxx ou 3xxx (pour le moment)</span></span>

<span style="color: rgb(35, 111, 161);"><span style="color: rgb(0, 0, 0);">2b01:cbd4:8275:1200:8b39:3406:3160:cd40</span></span>

##### <span style="color: rgb(35, 111, 161);"><span style="color: rgb(0, 0, 0);">Unique local (ULA) :</span></span>

<span style="color: rgb(35, 111, 161);"><span style="color: rgb(0, 0, 0);">Il s'agit d'une adresse ipv6 non routable sur internet commençant par FD. <span style="color: rgb(35, 111, 161);"><span style="color: rgb(0, 0, 0);">C'est un peux comme les adresses privée en ipv4.</span></span></span></span>

##### <span style="color: rgb(35, 111, 161);"><span style="color: rgb(0, 0, 0);"><span style="color: rgb(35, 111, 161);"><span style="color: rgb(0, 0, 0);">Bonus : Les adresses multicast : </span></span></span></span>

<span style="color: rgb(35, 111, 161);"><span style="color: rgb(0, 0, 0);"><span style="color: rgb(35, 111, 161);"><span style="color: rgb(0, 0, 0);">Les adresses multicast commencent pas FF0.</span></span></span></span>

#### <span style="color: rgb(0, 0, 0);">Attribution des adresses ipv6 :</span>

<span style="color: rgb(0, 0, 0);">Votre FAI n'attribut pas les adresses a tous les hôtes. On utilise alors une "</span><span style="color: rgb(0, 0, 0);">délégation de préfixe". Dans notre exemple : <span style="color: rgb(35, 111, 161);"><span style="color: rgb(0, 0, 0);">2b01:cbd4:8275:1200::/56</span></span></span>

##### <span style="color: rgb(0, 0, 0);"><span style="color: rgb(35, 111, 161);"><span style="color: rgb(0, 0, 0);">Le SLAAC (StatLess Adress AutoConfiguration) :</span></span></span>

<span style="color: rgb(0, 0, 0);"><span style="color: rgb(35, 111, 161);"><span style="color: rgb(0, 0, 0);">La box fournis le préfixe <span style="color: rgb(35, 111, 161);"><span style="color: rgb(0, 0, 0);">2b01:cbd4:8275:1200::/56 puis chaque hôtes se débrouille à générer une adresse ipv6 qui commence par le préfixe. </span></span></span></span></span>

<span style="color: rgb(0, 0, 0);"><span style="color: rgb(35, 111, 161);"><span style="color: rgb(0, 0, 0);"><span style="color: rgb(35, 111, 161);"><span style="color: rgb(0, 0, 0);"><span style="color: rgb(35, 111, 161);"><span style="color: rgb(0, 0, 0);"><span style="color: rgb(224, 62, 45);">2b01:cbd4:8275:12</span><span style="color: rgb(35, 111, 161);">00:8b39:3406:3160:cd40</span></span></span></span></span></span></span></span>

<span style="color: rgb(0, 0, 0);">Les privacy extention : </span>

<span style="color: rgb(0, 0, 0);">Pour plus d'anonymat sur internet, l'hôte va générer pas une mais deux adresses IPv6 GUA. Une dite stable et l'autre temporaire et va utiliser l'adresse temporaire pour aller sur internet. </span>

<span style="color: rgb(0, 0, 0);"><span style="color: rgb(35, 111, 161);"><span style="color: rgb(0, 0, 0);"><span style="color: rgb(35, 111, 161);"><span style="color: rgb(0, 0, 0);"><span style="color: rgb(35, 111, 161);"><span style="color: rgb(0, 0, 0);"><span style="color: rgb(224, 62, 45);">2b01:cbd4:8275:12</span><span style="color: rgb(35, 111, 161);">00:8b39:3406:3160:cd40 <span style="color: rgb(0, 0, 0);">-&gt; Stable</span></span></span></span></span></span></span></span></span>

<span style="color: rgb(0, 0, 0);"><span style="color: rgb(35, 111, 161);"><span style="color: rgb(0, 0, 0);"><span style="color: rgb(35, 111, 161);"><span style="color: rgb(0, 0, 0);"><span style="color: rgb(35, 111, 161);"><span style="color: rgb(0, 0, 0);"><span style="color: rgb(35, 111, 161);"><span style="color: rgb(0, 0, 0);"><span style="color: rgb(224, 62, 45);">2b01:cbd4:8275:12</span><span style="color: rgb(35, 111, 161);">00:8c37:3f06:316a:cd4ff <span style="color: rgb(0, 0, 0);">-&gt; Temporaire</span></span></span></span></span></span></span></span></span></span></span>

##### <span style="color: rgb(0, 0, 0);">Le DHCPv6 :</span>

<span style="color: rgb(0, 0, 0);">Même principe que le DHCPv4</span>

#### <span style="color: rgb(0, 0, 0);">Le Dual Stack :</span>

<span style="color: rgb(0, 0, 0);">C'est le fait d'utiliser à la fois les ipv4 et ipv6 dans un réseau.</span>

#### <span style="color: rgb(0, 0, 0);">Adresses spécifiques :</span>

<span style="color: rgb(0, 0, 0);">Adresse de loopback : ::1</span>