The ungleich IPv6 book » History » Version 4
Ahmed Bilal, 06/10/2019 01:22 PM
1 | 1 | Nico Schottelius | h1. The ungleich IPv6 book |
---|---|---|---|
2 | |||
3 | 2 | Ahmed Bilal | A resource for IPv6 beginners |
4 | 1 | Nico Schottelius | |
5 | h2. Status |
||
6 | |||
7 | **IN PROGRESS** |
||
8 | |||
9 | 2 | Ahmed Bilal | h2. Tools needed |
10 | |||
11 | You would need the following things to follow this Wiki. |
||
12 | # A Linux Distribution |
||
13 | # *sipcalc* utility |
||
14 | |||
15 | 1 | Nico Schottelius | h2. Understanding networks, network masks |
16 | |||
17 | 2 | Ahmed Bilal | Sample IPv6 Address **2001:0db8:85a3:0000:0000:8a2e:0370:7334** |
18 | |||
19 | IPv6 address have a size of 128 bits while IPv4 have a size of 32 bits. |
||
20 | |||
21 | 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). |
||
22 | |||
23 | h3. Address Compression |
||
24 | |||
25 | We can compress the IPv6 address. Following are some simple rules |
||
26 | |||
27 | 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: |
||
28 | |||
29 | 2001:db8:85a3:0:0:8a2e:370:7334 |
||
30 | |||
31 | |||
32 | 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: |
||
33 | |||
34 | 2001:db8:85a3::8a2e:370:7334 |
||
35 | |||
36 | |||
37 | 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 |
||
38 | |||
39 | |||
40 | h3. Address Ranges |
||
41 | |||
42 | 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** |
||
43 | |||
44 | |||
45 | 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. |
||
46 | |||
47 | h3. Cool Tricks with @sipcalc@ |
||
48 | |||
49 | Run the following command on your terminal |
||
50 | |||
51 | @sipcalc 2a0a:e5c1:100::/40@ |
||
52 | <pre> |
||
53 | [meow@meow-pc ~]$ sipcalc 2a0a:e5c1:100::/40 |
||
54 | -[ipv6 : 2a0a:e5c1:100::/40] - 0 |
||
55 | |||
56 | [IPV6 INFO] |
||
57 | Expanded Address - 2a0a:e5c1:0100:0000:0000:0000:0000:0000 |
||
58 | Compressed address - 2a0a:e5c1:100:: |
||
59 | Subnet prefix (masked) - 2a0a:e5c1:100:0:0:0:0:0/40 |
||
60 | Address ID (masked) - 0:0:0:0:0:0:0:0/40 |
||
61 | Prefix address - ffff:ffff:ff00:0:0:0:0:0 |
||
62 | Prefix length - 40 |
||
63 | Address type - Aggregatable Global Unicast Addresses |
||
64 | Network range - 2a0a:e5c1:0100:0000:0000:0000:0000:0000 - |
||
65 | 2a0a:e5c1:01ff:ffff:ffff:ffff:ffff:ffff |
||
66 | </pre> |
||
67 | |||
68 | If we subtract the network range |
||
69 | <pre>0x2a0ae5c101ffffffffffffffffffffff - 0x2a0ae5c1010000000000000000000000</pre> |
||
70 | How many addresses we get? **2^88**. We can also get the same result by 2^(128 - network bits) = 2^(128 - 40) = 2^88. |
||
71 | |||
72 | Similarly, How many addresses we get if we have **2a0a:e5c1:100::/48** network? |
||
73 | |||
74 | **Answer:** 2^(128-48) = 2^80. Good. |
||
75 | |||
76 | 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?** |
||
77 | |||
78 | |||
79 | Run the following command on your terminal |
||
80 | |||
81 | @sipcalc 2a0a:e5c1:100::/40@ |
||
82 | then |
||
83 | @sipcalc 2a0a:e5c1:100::/48@ |
||
84 | |||
85 | <pre> |
||
86 | [meow@meow-pc ~]$ sipcalc 2a0a:e5c1:100::/40 |
||
87 | -[ipv6 : 2a0a:e5c1:100::/40] - 0 |
||
88 | |||
89 | [IPV6 INFO] |
||
90 | Expanded Address - 2a0a:e5c1:0100:0000:0000:0000:0000:0000 |
||
91 | Compressed address - 2a0a:e5c1:100:: |
||
92 | Subnet prefix (masked) - 2a0a:e5c1:100:0:0:0:0:0/40 |
||
93 | Address ID (masked) - 0:0:0:0:0:0:0:0/40 |
||
94 | Prefix address - ffff:ffff:ff00:0:0:0:0:0 |
||
95 | Prefix length - 40 |
||
96 | Address type - Aggregatable Global Unicast Addresses |
||
97 | Network range - 2a0a:e5c1:0100:0000:0000:0000:0000:0000 - |
||
98 | 2a0a:e5c1:01ff:ffff:ffff:ffff:ffff:ffff |
||
99 | </pre> |
||
100 | |||
101 | <pre> |
||
102 | [meow@meow-pc ~]$ sipcalc 2a0a:e5c1:100::/48 |
||
103 | -[ipv6 : 2a0a:e5c1:100::/48] - 0 |
||
104 | |||
105 | [IPV6 INFO] |
||
106 | Expanded Address - 2a0a:e5c1:0100:0000:0000:0000:0000:0000 |
||
107 | Compressed address - 2a0a:e5c1:100:: |
||
108 | Subnet prefix (masked) - 2a0a:e5c1:100:0:0:0:0:0/48 |
||
109 | Address ID (masked) - 0:0:0:0:0:0:0:0/48 |
||
110 | Prefix address - ffff:ffff:ffff:0:0:0:0:0 |
||
111 | Prefix length - 48 |
||
112 | Address type - Aggregatable Global Unicast Addresses |
||
113 | Network range - 2a0a:e5c1:0100:0000:0000:0000:0000:0000 - |
||
114 | 2a0a:e5c1:0100:ffff:ffff:ffff:ffff:ffff |
||
115 | </pre> |
||
116 | |||
117 | **Answer:** 2^(48 - 40) = 2^8 = 256. So, you can put 256 /48 networks in /40. |
||
118 | 3 | Ahmed Bilal | |
119 | h2. References |
||
120 | |||
121 | * https://en.wikipedia.org/wiki/IPv6_address |