Skip to content

Instantly share code, notes, and snippets.

@Synapz3
Last active March 30, 2018 13:17
Show Gist options
  • Save Synapz3/7f5754fb20fbd0b43eff3c85d41b3e84 to your computer and use it in GitHub Desktop.
Save Synapz3/7f5754fb20fbd0b43eff3c85d41b3e84 to your computer and use it in GitHub Desktop.
D0021E/D7002D - Assignment 2

D0021E/D7002D - Assignment 2

Authors: Marcus Lund (amuulo-4) and Jorge Aparicio (jorapa-7)

Task 1: Explain in detail the IPv6 stateless auto-configuration.

The IPv6 stateless autoconfiguration uses link-local addressing to assign itself an local IPv6 address. Link-local is generated by using the 48 bits of the MAC address of an interface along with EUI-64 to fill the host portion of the 128-bit IPv6 address. The host address (most significant 64 bits) are reserved to be FE80::/64 for link-local. Combining this with the host portion will be the unique link-local address.

First step, generating an IPv6 address using EUI-64:

It takes a 48-bit MAC address, inserts FFFE into the middle of the MAC address and flips the seventh most significant bit. I.E.

Assume the following MAC address:

00:11:22:33:44:55

Insert FFFE:

0011:22FF:FE33:4455

Now flip the seventh bit and we get:

00:11:22:33:44:55 
becomes
02:11:22:33:44:55:

0    0    : 1    1    : 2    2    : 3    3    : 4    4    : 5    5   
0000 0000 : 0001 0001 : 0010 0010 : 0011 0011 : 0100 0100 : 0101 0101

0    2    : 1    1    : 2    2    : 3    3    : 4    4    : 5    5   
0000 0010 : 0001 0001 : 0010 0010 : 0011 0011 : 0100 0100 : 0101 0101
       |
Flip the seventh bit!

Hance:

0011:22FF:FE33:4455
becomes
0211:22FF:FE33:4455

This can be written as:

211:22FF:FE33:4455

Now we combine the network and host portions to get the link-local address:

FE80:0000:0000:0000:0211:22FF:FE33:4455/64

This may be written like:

FE80::211:22FF:FE33:4455/64

Duplicate Address Detection

Like the ARP in IPv4, IPv6 uses Neighbour Solicitation and Neighbour Advertisement to detect and avoid duplicate IPv6 addressing. The DAD check is done BEFORE the nodes apply the address to its interface.
This is how it is done:

The node joins the unicast group FF02::1 and then sends a Neighbour Solicitation message to the sociated-node address of that IP to be checked for a duplicate address.If there is a Neighbour Advertisement back, Tha address is already in use. This NA is sent to the unicast address FF02::1. If there are no NA response to the address FF02::1, the node knows the address is not used and may use the address.

An IPv6 node does not use DAD for anycast addresses since anycast addresses are not unique to a node. DAD is run BEFORE the node applies an IPv6 address to an interface.

According to the RFC4862 (https://tools.ietf.org/html/rfc4862#section-5.4), the node is supposed to silently drop any package from the address that failed DAD check. It should also not send any package from the interface.

Router Solicitation

Once the node is connected by link-local address, it will send an RS message to FF02::2 to see if any router has an IPv6 network other than link-local on the LAN.

A Router Solicitation message is used to trigger a router to unicast a Router Advertisement message. This is how a node retrieves the global address scope and uses EUI-64 to generate a unique host address on the LAN that is routable beyond the router (Link-Local addresses are non-routable by default).

RS looks like this on Cisco hardware:

cbr-generator.png

Router Advertisement

RA stands for Router Advertisement. This is a package sent by the router to multicast the global address used on a specific interface or VLAN. This is how a Router Advertisement looks like using Cisco hardware:

cbr-generator.png

Please note: FE80::1 is link-local address of th router.

Once the node recieves a response, It may create a global address based on the network that was advertised from the RA.
The node uses the 64-bit network address along with the 64-bit generated host address to create a global address. This address has to pass the DAD check BEFORE the node is allowed to assign the IPv6 address to the interface. The global address allows the router to route package beyond the local network to the host.

Testing on Cisco hardware

In the picture below, you can see that the Cisco router sends an RA package every 200 seconds.

cbr-generator.png

The above pictures for RA and RS are from a Cisco router.

Discussion

Although EUI-64 is an old standard, Privacy Extensions (RFC4941) was created to make it harder for users (and attackers) to get hold of a device´s MAC address.

https://tools.ietf.org/html/rfc4941

sources

https://tools.ietf.org/html/rfc4862

Task 2: Decide when to handoff

3G (left) vs WiFi (right)

Time (t) Throughput (MB/s) Delay (ms) QoS Throughput (MB/s) Delay (ms) QoS
1 10 50 0.2 20 3 0.86
2 12 40 0.4 15 5 0.57
3 14 30 0.6 12.5 6 0.43
4 16 20 0.8 10 7 0.29
5 18 10 1 5 9 0.00
6 16 20 0.8 10 7 0.29
7 14 30 0.6 12.5 6 0.43
8 12 40 0.4 15 5 0.57
9 10 50 0.2 20 3 0.86
10 8 60 0 22.5 2 1.00

A node starts on the WiFi network and at time t=3 it's handed over to the 3G network because it offers a better QoS (0.6 > 0.43). The node remains on the 3G network until t=8; then it switches back to the WiFi network because it offers a better QoS (0.4 < 0.57).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment