Routing and Switching

IPv6 Subnetting

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.

 

Method 1

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.

Example 1

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
1 FD1A:39C1:4BC2:3D80::/61
2 FD1A:39C1:4BC2:3D88::/61
3 FD1A:39C1:4BC2:3D90::/61
4 FD1A:39C1:4BC2:3D98::/61
5 FD1A:39C1:4BC2:3DA0::/61
6 FD1A:39C1:4BC2:3DA8::/61
7 FD1A:39C1:4BC2:3DB0::/61
8 FD1A:39C1:4BC2:3DB8::/61
9 FD1A:39C1:4BC2:3DC0::/61
10 FD1A:39C1:4BC2:3DC8::/61
11 FD1A:39C1:4BC2:3DD0::/61
12 FD1A:39C1:4BC2:3DD8::/61
13 FD1A:39C1:4BC2:3DE0::/61
14 FD1A:39C1:4BC2:3DE8::/61
15 FD1A:39C1:4BC2:3DF0::/61
16 FD1A:39C1:4BC2:3DF8::/61

 

 

Method 2

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:

  1. Draw a table with two columns.
  2. 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.
  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.
  2. To determine the network address of subnet2, start with subnet1 and add the hexadecimal increment to the subnet ID portion of the address.
  3. 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

  1. Determine the number of bits left for subnetting:

64 – 57 = 7

  1. Determine how many bits are needed for subnetting:

4 bits needed, 24 = 16 subnets.

  1. Determine new network prefix:

57 + 4 = 61

  1. Determine the hexadecimal increment between subnets:

264 – 61 = 23 = 8

This gives 0x8 in hexadecimal

  1. Determine the network address of each subnet:
Subnet Number Subnetted Address Prefix
1 FD1A:39C1:4BC2:3D80::/61
2 FD1A:39C1:4BC2:3D88::/61
3 FD1A:39C1:4BC2:3D90::/61
4 FD1A:39C1:4BC2:3D98::/61
5 FD1A:39C1:4BC2:3DA0::/61
6 FD1A:39C1:4BC2:3DA8::/61
7 FD1A:39C1:4BC2:3DB0::/61
8 FD1A:39C1:4BC2:3DB8::/61
9 FD1A:39C1:4BC2:3DC0::/61
10 FD1A:39C1:4BC2:3DC8::/61
11 FD1A:39C1:4BC2:3DD0::/61
12 FD1A:39C1:4BC2:3DD8::/61
13 FD1A:39C1:4BC2:3DE0::/61
14 FD1A:39C1:4BC2:3DE8::/61
15 FD1A:39C1:4BC2:3DF0::/61
16 FD1A:39C1:4BC2:3DF8::/61

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

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s