IPv6 subnetting is a bit different from IPv4 subnetting because the host ID portion of IPv4 varies depending on the class of address or subnetting scheme. In IPv6, the host ID, which is the interface ID is fixed at 64 bits.
The global unicast address and the unique local address are divided into three parts; the fixed 45 bits, 16 bits subnet portion and 64 bits interface portion. The first 48 bits of a global unicast address are fixed and allocated by the ISP, unique local address is also fixed at FD00::/8 with a 40-bit randomly generated global ID which is then assigned to the site of an organization. Both of these addresses leaves 16 bits for subnetting.
Subnetting IPv6 addresses can be done at two levels; nibble and bit level. The methods I discuss here makes use of the bit level of subnetting. There are two steps procedure to subnetting the subnet ID portion of both the global unicast and unique local addresses.
- Determine the number of bits required for subnetting.
- Enumerate the new subnetted address prefix.
Subnetting requires proper planning. The number of required subnets will determine the number of bits to be used. For example, if 8 subnets are required then 3 bits will be used. However, at other times, subnetting may not give an exact number of required subnets. Take for example a network requiring 20 subnets to use, 5 bits will be required to produce the required subnets, leaving 16 subnets unused.
Having determined the number of bits for subnetting, we need to determine the prefixes of the new addresses. This can be done in three ways; binary, decimal and hexadecimal. However, I am only going to use the hexadecimal approach because of its simplicity – simplicity sells.
The first 64 bits of an IPv6 is the network address, organizations that have obtained global IPv6 address space from their ISP have only the first 48 bits fixed by the ISP. The final 16 bits of the network ID portion of a global address represent the subnet ID, which is used for subnetting.
I am going to use two different techniques to subnet IPv6 addresses, leaving you to choose whichever one you best understand.
Now pay attention to the following:
On any give level
- There will be a number of bits that are already fixed by the next level up in the hierarchy (F).
- There will be a number of bits used for subnetting at the current level in the hierarchy (S).
- There will be a number of bits remaining for subnetting for the next level down in the hierarchy (R)
Such that F + S + R = 16 (which is the total value of the subnet ID portion of the IPv6 addresses.)
Suppose you’re given an IPv6 address 2001:db8:3c4d:12::/53, and you plan on using 5 bits for subnetting, then F = 53 – 48 = 4; (48 being the prefix length of unsubnetted address.)
S = 5;
R = 7;
Therefore, 4 + 5 + 7 = 16.
This method uses a formulaic approach, just a bit of simple mathematics:
Let S = the number of bits chosen for subnetting.
F = the number of bits within the subnet ID already fixed.
M = the prefix length of the address prefix being subnetted.
N = number of address prefix being obtained.
I = incremental value between each successive subnet ID expressed in hexadecimal form.
L = prefix length of the new subnetted address.
We have the following:
F = M – 48
N = 2S
I = 216 – (F + S)
L = 48 + F + S
Looks daunting huh? No, it’s not, with a little bit of practice it’s going to be a walk in the park.
Let’s perform a 4-bit subnetting on the unique local address FD1A:39C1:4BC2:3D80::/57
Solution: using the formula above
- F = M – 48, but M = 57
F = 57 – 48 = 9
- S = 4
- N = 2S
N = 24 = 16
- I = 216 – (F + S)
I = 216 – (9 + 4) = 23 = 8
0x8 in hexadecimal
- L = 48 + F + S
L = 48 + 9 + 4 = 61
So now we have the following very important info;
Number of subnets = 16;
Incremental value between 2 successive subnet ID in hexadecimal = 0x8
New prefix length = 61
The table below shows the subnets obtained.
|Subnet Number||Subnetted Address Prefix|
To create and enumerate subnets within the subnet ID of the address space using this technique the following steps must be computed:
- Determine the number of bits left for subnetting
Recall that the network ID portion of an IPv6 address is 64 bits. If you’re allocated an address prefix of 54, simply subtract the prefix from 64, i.e. 64 – 54 =10.
- Determine how many bits you need for subnetting
The first step is to determine how many subnets is needed, look for the lowest exponent of 2 that would yield an equal value to or greater than the number of subnets needed. For example, if 6 subnets are needed, 3 bits will be used (23) because it is the lowest exponent of 2 that would yield a value equal to or greater than 6.
- Determine the new network prefix to be used within your subnetted portion of the network.
The new network prefix is obtained by adding the number of bits needed for subnetting to the original network prefix originally assigned to you. For example, if you were assigned the address 2001:DB8:2AC4:C00::/54 and you’ve determined to use 4 bits for subnetting, the new network prefix will be 58 and the network address of the first subnet will be 2001:DB8:2AC4:C00::/58.
- Determine the hexadecimal increment between subnet addresses.
To do this, subtract the new network prefix from 64, and raise 2 to the power of the difference, then translate that value to hexadecimal. For example, if the new network prefix is 58, translate 264 – 58or 26 to hexadecimal.
- Use the hexadecimal increment to determine the network address of each subnet.
To enumerate the address of each new subnet do the following:
- Draw a table with two columns.
- Write down the name of each subnet in a column starting with subnet 1, subnet 2 …etc.
- Write down the network address of each subnet next to each subnet name, starting with subnet 1.
- To determine the network address of subnet 1, write down the original network address of your network space but replace the original network prefix with the new network prefix that you have determined.
- To determine the network address of subnet2, start with subnet1 and add the hexadecimal increment to the subnet ID portion of the address.
- To determine subnet3 start with subnet2 and add the hexadecimal increment to the subnet ID portion of the address. The same thing goes for successive subnets, continue adding the hexadecimal increment as necessary until you have written down the address for each subnet.
Now let’s use this method to subnet the same address in the first method above;
Doing a 4–bit subnetting on FD1A:39C1:4BC2:3D80::/57
- Determine the number of bits left for subnetting:
64 – 57 = 7
- Determine how many bits are needed for subnetting:
4 bits needed, 24 = 16 subnets.
- Determine new network prefix:
57 + 4 = 61
- Determine the hexadecimal increment between subnets:
264 – 61 = 23 = 8
This gives 0x8 in hexadecimal
- Determine the network address of each subnet:
|Subnet Number||Subnetted Address Prefix|
In my next post, I am going to show you how to subnet address prefix less than /48
If you have any question or needs clarification please use the comment section. Thanks for reading