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