Project

General

Profile

The ungleich IPv6 book » History » Version 5

Nico Schottelius, 06/10/2019 03:05 PM

1 1 Nico Schottelius
h1. The ungleich IPv6 book
2
3 5 Nico Schottelius
{{toc}}
4
5 2 Ahmed Bilal
A resource for IPv6 beginners
6 1 Nico Schottelius
7
h2. Status
8
9
**IN PROGRESS**
10
11 2 Ahmed Bilal
h2. Tools needed
12
13
You would need the following things to follow this Wiki.
14
# A Linux Distribution
15
# *sipcalc* utility
16
17 1 Nico Schottelius
h2. Understanding networks, network masks
18
19 2 Ahmed Bilal
Sample IPv6 Address **2001:0db8:85a3:0000:0000:8a2e:0370:7334**
20
21
IPv6 address have a size of 128 bits while IPv4 have a size of 32 bits.
22
23
IPv6 address is divided into 8 groups each made up of 4 hexadecimal digits. (Each hexadecimal digit takes 1 nibble or 4 bits). So, each group takes 2 bytes (16 bits).
24
25
h3. Address Compression
26
27
We can compress the IPv6 address. Following are some simple rules
28
29
1. Leading zeroes in a group may be omitted, but each group must retain at least one hexadecimal digit. Thus, the example address **2001:0db8:85a3:0000:0000:8a2e:0370:7334** can be written as:
30
31
    2001:db8:85a3:0:0:8a2e:370:7334
32
33
34
2. One or more consecutive groups containing zeros only may be replaced with a single empty group, using two consecutive colons (::).[1] The substitution may only be applied once in the address, however, because multiple occurrences would create an ambiguous representation. Thus, the example address **2001:0db8:85a3:0000:0000:8a2e:0370:7334** can be further simplified:
35
36
    2001:db8:85a3::8a2e:370:7334
37
38
39
The localhost (loopback) address, 0:0:0:0:0:0:0:1, and the IPv6 unspecified address, 0:0:0:0:0:0:0:0, are reduced to ::1 and ::, respective
40
41
42
h3. Address Ranges
43
44
    Just to check we are on same page. What is the expanded form of **2a0a:e5c1:100::/48**? Answer: **2a0a:e5c1:100:0:0:0:0:0**
45
46
47
The size of a block of addresses is specified by **writing a slash (/) followed by a number in decimal** whose value is the length of the **network prefix** in bits. For example, an address block with 48 bits in the prefix is indicated by /48. Such a block contains 2^(128 − 48) = 2^80 addresses. The smaller the value of the network prefix, the larger the block.
48
49
h3. Cool Tricks with @sipcalc@
50
51
Run the following command on your terminal
52
53
@sipcalc 2a0a:e5c1:100::/40@
54
<pre>
55
[meow@meow-pc ~]$ sipcalc 2a0a:e5c1:100::/40
56
-[ipv6 : 2a0a:e5c1:100::/40] - 0
57
58
[IPV6 INFO]
59
Expanded Address	- 2a0a:e5c1:0100:0000:0000:0000:0000:0000
60
Compressed address	- 2a0a:e5c1:100::
61
Subnet prefix (masked)	- 2a0a:e5c1:100:0:0:0:0:0/40
62
Address ID (masked)	- 0:0:0:0:0:0:0:0/40
63
Prefix address		- ffff:ffff:ff00:0:0:0:0:0
64
Prefix length		- 40
65
Address type		- Aggregatable Global Unicast Addresses
66
Network range		- 2a0a:e5c1:0100:0000:0000:0000:0000:0000 -
67
			  2a0a:e5c1:01ff:ffff:ffff:ffff:ffff:ffff
68
</pre>
69
70
If we subtract the network range
71
<pre>0x2a0ae5c101ffffffffffffffffffffff - 0x2a0ae5c1010000000000000000000000</pre>
72
How many addresses we get? **2^88**. We can also get the same result by 2^(128 - network bits) = 2^(128 - 40) = 2^88.
73
74
Similarly, How many addresses we get if we have **2a0a:e5c1:100::/48** network?
75
76
**Answer:** 2^(128-48) = 2^80. Good.
77
78
Now, let me ask you a slightly different question. **How many 2a0a:e5c1:100::/48 networks can we fit into 2a0a:e5c1:100::/40 network?**
79
80
81
Run the following command on your terminal
82
83
@sipcalc 2a0a:e5c1:100::/40@
84
then
85
@sipcalc 2a0a:e5c1:100::/48@
86
87
<pre>
88
[meow@meow-pc ~]$ sipcalc 2a0a:e5c1:100::/40
89
-[ipv6 : 2a0a:e5c1:100::/40] - 0
90
91
[IPV6 INFO]
92
Expanded Address	- 2a0a:e5c1:0100:0000:0000:0000:0000:0000
93
Compressed address	- 2a0a:e5c1:100::
94
Subnet prefix (masked)	- 2a0a:e5c1:100:0:0:0:0:0/40
95
Address ID (masked)	- 0:0:0:0:0:0:0:0/40
96
Prefix address		- ffff:ffff:ff00:0:0:0:0:0
97
Prefix length		- 40
98
Address type		- Aggregatable Global Unicast Addresses
99
Network range		- 2a0a:e5c1:0100:0000:0000:0000:0000:0000 -
100
			  2a0a:e5c1:01ff:ffff:ffff:ffff:ffff:ffff
101
</pre>
102
103
<pre>
104
[meow@meow-pc ~]$ sipcalc 2a0a:e5c1:100::/48
105
-[ipv6 : 2a0a:e5c1:100::/48] - 0
106
107
[IPV6 INFO]
108
Expanded Address	- 2a0a:e5c1:0100:0000:0000:0000:0000:0000
109
Compressed address	- 2a0a:e5c1:100::
110
Subnet prefix (masked)	- 2a0a:e5c1:100:0:0:0:0:0/48
111
Address ID (masked)	- 0:0:0:0:0:0:0:0/48
112
Prefix address		- ffff:ffff:ffff:0:0:0:0:0
113
Prefix length		- 48
114
Address type		- Aggregatable Global Unicast Addresses
115
Network range		- 2a0a:e5c1:0100:0000:0000:0000:0000:0000 -
116
			  2a0a:e5c1:0100:ffff:ffff:ffff:ffff:ffff
117
</pre>
118
119
**Answer:** 2^(48 - 40) = 2^8 = 256. So, you can put 256 /48 networks in /40.
120 3 Ahmed Bilal
121
h2. References
122
123
* https://en.wikipedia.org/wiki/IPv6_address