[#vlsmchrt]:

# VLSM Chart

There are multiple VLSM charts (sometimes called a “subnetting” chart, or “CIDR” chart), including Daniel Raffo's VLSM chart: last octet subnetting.

Following this paragraph is the results of JavaScript code that shows an automatically calculated VLSM chart. (These results will only show up in web browsers that are using JavaScript.) Details for both IPv6 and IPv4 are shown there. This chart simply shows a block of 256 network addresses and how it may be split up using common VLSM techniques.

The first and the last row, both labelled “Subnet size”, are identical. The information is provided twice for ease of use.

## Understanding the chart

Here are a couple of sample questions.

Example with small subnets

Question and answer time. The question is...

Is 192.0.2.10 and 192.0.2.14 part of the same subnet?

The answer is: it depends on the size of the subnet!

Narrowing down the focus

First of all, we'll write out the addresses in long-hand. The addresses are “192.000.002.010” and “192.000.002.014”. Doing this is typically unnecessary with IPv4, but can remove some potential for confusion, and can be even more useful when working with IPv6.

Now, we'll notice that the first groups of numbers are the same. In IPv4, each group of numbers (between two periods) represents eight bits. Because each of these groups are eight bits, these groups of numbers are frequently called “octets”. (In IPv6, numbers between two colons are 16-bits, except for the complication of when there are two colons next to each other. However, that complication goes away when the address is written out in long-hand.)

So, we're going to basically ignore the first three groups of numbers. Those numbers are related to the first 24 bits of an address, which is bit zero and also bit one through bit 23. (Bit 1 through bit 23 are 23 bits, and there is also bit zero, so that is 24 bits.)

Very often, people who are learning about IPv4 subnetting will start by focusing on subnets that do not have more addresses than a /24. This way, people can focus on the smallest amount of numbers, which simplifies things.

By doing all this, we may now look at just the numbers after the last period... this explains why the remaining steps will compare the “10” and the “14”, but ignore the first part of the address, which is the “192.0.2.”.

Determining whether the addresses are in the same subnet involves figuring out whether those addresses are in the same group. Visusally, this can be done by figuring out whether both numbers fit/belong in the same box. As we can see on this chart, the column related to IPv4 /29 subnets has larger blocks than the column related to IPv4 /30 subnets.

For an IPv4 /29 subnet, the answer is: Yes. There is a box that says “8 to 15”. Both 192.0.2.10 and 192.0.2.14 are in the subnet that goes contains 192.0.2.8 through 192.0.2.15.

However, if the subnet is an IPv4 /30 subnet, the answer is: No. In that case, 192.0.2.10 is in the subnet that contains addresses from 192.0.2.8 through 192.0.2.11, and 192.0.2.14 is in the subnet that contains addresses from 192.0.2.12 through 192.0.2.15.

What amount an IPv4 /28 subnet? The answer is: Yes. There is a box in the IPv4 /28 column that goes from “0 to 15”. In the IPv4 /27 column, there is a box that goes from “0 to 31”. In the IPv4 /26 column, there is a box that goes from “0 to 63”. As the number after a slash gets smaller, the boxes closer to the left side of the chart are getting bigger. So, if the number after the slash is a 29 or smaller, then the boxes will be big enough for 192.0.2.11 and 192.0.2.14 to fit in the same box.

Understanding larger subnets

The “Number of address(es)” row in the chart shows information for the subnet sizes shown in the “Subnet size” row. So, an IPv6 /125 has 8 addresses. Also, an IPv4 /29 has 8 addresses. (The “Number of address(es)” is just counting to total number of addresses, including any addresses that are used as a Network ID or an IPv4 broadcast address.)

Moving left on the chart, an IPv6 /124 has 16 addresses. Also, an IPv4 /28 has 16 addresses.

With each column moving left, the number of addresses doubles. When starting from an IPv6 /121 or an IPv4 /25 with 128 addresses, and going left one column to an IPv6 /121 or an IPv4 /25, the number of addresses is doubled to 256 addresses.

The doubling continues to happen. (At this point, the “Number of adress(es)” row in the chart stops being useful, and can be ignored.) When starting from an IPv6 /121 or an IPv4 /25 with 128 addresses, and going left one column to an IPv6 /121 or an IPv4 /25, the number of addresses is doubled to 256 addresses.

For example, an IPv4 /24 subnets may go from 192.168.0.0 through 192.168.0.255 and another IPv4 /24 subnets may go from 192.168.1.0 through 192.168.1.255. Each of those IPv4 /24 subnets contain 256 addresses. The IPv4 /23 subnet that starts at 192.168.0.0 will contain 512 addresses, so that subnet will contain all of the addresses from 192.168.0.0 through 192.168.1.255.

This means that the IPv4 /23 going from 192.168.0.0 through 192.168.1.255 contains all of the addresses from “192.168.0.0” through “192.168.0.255” and also all of the addresses from “192.168.1.0” through “192.168.1.255”.

Once again, the chart helps to visualize this. Two columns help to show this. The first column is the column that says “IPv6 127” and “IPv4 /31” Notice that this column says the information in this column is “like IPv4IPv4 /23”. Also notice that the next column over says that the information is “like IPv4IPv4 /24”.

Looking at these columns, one can begin to visually see that there a single larger /23 subnet contains all of the addresses of two smaller /24 subnets. In the example being discussed, this represents how addresses starting with “192.168.0” and addresses starting with “192.168.1” all fit within one /23 subnet, but two /24 subnets are needed.

Likewise, just to complicate this a little bit further, consider the next column over. In the column that contains information “like IPv4 /22”, the first netblock shows values of 0 to 3. The addresses from 192.168.0.0 through 192.168.3.255 can all be represented by this box. By comparing this box to the information in the section of the “like IPv4 /24” box, we can see that the addresses from four IPv4 /24 subnets can fit within a single IPv4 /22 subnet.

To describe that more thoroughly: an IPv4 /24 subnet that starts with 192.168.0.0 will contain all of the addresses up through 192.168.3.255, so it contains all of the addresses from the following /24 subnets:

• 192.168.0.0 through 192.168.0.255
• 192.168.1.0 through 192.168.1.255
• 192.168.2.0 through 192.168.2.255
• 192.168.3.0 through 192.168.3.255

So, how many addresses does a IPv4 /22 have? 1,024. That is four times as many addresses as an IPv4 /24 subnet.

This does make sense: As the chart shows, the number of addresses in an /22 is twice as many addresses as the number of addresses in an /23, and the number of addresses in an /23 is twice as many addresses as the number of addresses in a /24.

## Patterns

There are a lot of patterns here that can be nice to know about. These patterns are frequenty not taught, and so are typically not tested on during industry-wide examinations.

Before trying to learn about these patterns, have a firm understanding of just what a subnet is, and how to determine (by looking at this chart) whether a network address is part of a particular subnet. That is going to be far more useful than learning about how some of these numbers relate.

However, after the concepts of a subnet are thoroughly understood, then knowing some of the patterns may help to increase a further understanding about how subnet sizes are related. Knowing these patterns can helpful when trying to re-create charts using only memory, and perhaps also using a pen and paper. For example, knowing how to quickly obtain one number may provide an easy way to quickly calculate another number.

Nearly all of these patterns are more useful when dealing with IPv4 addresses and using the “IPv4 subnet mask” notation for writing out subnets. Some of these patterns just don't seem as useful when dealing with CIDR notation, which is why they aren't quite as helpful when dealing with IPv4.

Patterns may include:

Comparing IPv4

The chart indicates there are some similarities between an IPv6 /125 and an IPv4 /29. Indeed, there are some similarities. Both 125 and 29 are the result of taking the maximum number of bits in a network address, and subtracting 3. So, the simple math is 128 - 3 == 125, and 32 - 3 == 29. Both of these sizes have three “host bits”, which results in a subnet size of eight addresses.

Since an IPv6 /125 and an IPv4 /29 are the same size, they are the same information in the row called “Number of address(es)”.

Similarly, an IPv6 /125 subnet and an IPv4 /29 subnet contain a lot of other details that are identical, which is why they share so many details on the chart.

First block
The “number of addresses” will be one higher than the last address of the first block.
Using a number as a subnet mask

The following is useful when dealing with IPv4.

Last 8 bits as decimal matching subnet mask octet

In a /29, the subnet mask will be 255.255.255.248. So, the last octet will match the number shown in the “Last 8 bits as decimal” row.

In a /21, the subnet mask will be 255.255.248.0.

In a /13, the subnet mask will be 255.248.0.0.

In a /5, the subnet mask will be 248.0.0.0.

The number “248” keeps showing up when the subnet size increases or decreases by 8. (The reason for this has to do with the fact that there are 8 bits represented by each period in an IPv4 address.)

This is one of the key reasons for the row of the chart that says “Similar chart to”. After finding the number in the “Similar chart to” row, looking at the corresponding “Last 8 bits as decimal” row will show a number that becomes part of the IPv4 subnet mask.

Let's look at a very different example of how some different subnet sizes end up sharing some similar patterns. Compare the addresses that start with 16.

 Subnet size Mask First address Last address /5 248.0.0.0 16.0.0.0 23.255.255.255 /13 255.248.0.0 10.16.0.0 10.23.255.255 /21 255.255.248.0 172.30.16.0 172.30.23.255 /29 255.255.255.248 192.0.2.16 192.0.2.23

The numbers at the start of the “First address” and the “Last address” (the “10.” and the “172.30.” and the “192.0.2.”) are examples; the main thing to notice is that those numbers match in both the first address and the last address.

After the first set of numbers is the number “16”. Every one of these subnet sizes has one of the subnets starting with a “16” followed by a bunch of cleared bits (that have a value of zero). This is not true of some other subnet sizes (like /11).

When the subnet starts with “16”, the last address of that subnet has a “23” in it. All of the bits after the “23” are set to a value of 1, which is why the larger subnets all end with “.255”s.

These obversations are true for not only /29, but also /21 and /13 and /5. (Again, it should be pointed out that this is really only discussing IPv4 subnets.) All the other subnet sizes have similar patterns but use different numbers.

Some VLSM charts contain less information, and only show details for IPv4 /24 through /30. The information on those charts could also be useful if trying to figure out which /21 subnet an address is in. The information in the VLSM chart for /29 will be most useful.

This is still discussing the standard notation of an IPv4 subnet mask (and so will probably not be of as much use when dealing with IPv6 subnets).

Checking the end
The Network ID (which is the first address, not the first “usable” address) of the last subnet matches the value in the “Last 8 bits as decimal” row which contains a number that is part of the IPv4 subnet mask.
Checking the beginning

Another way, sometimes quicker, to find the subnet mask is to take 255 and then subtract the last address of the first network block. (The reason to use the number 255 is likely because 255 is the largest number in the subnet.) So, for example, a /29 has a first network block that goes from 0 through 7. 255 minus 7 results in 248, which is part of the subnet mask.

This really only works for the /24 and smaller subnets. For larger subnets, keep adding 8 to the prefix length to get a number that is greater than 24 (and is 32 or smaller). For example, to check the value of a /7, take 7+8+8+8=23. Now that the number is greater-than /24, check the last value of a /23 subnet. (Note that we're not looking for the last “usable” address; just the last address.) That is a 1. 255 minus 1 is 254. Indeed, the subnet mask of a /7 is 254.0.0.0

Sum

This relates to the “Laqst 8 bits as decimal” row, which is primarily of interest when dealing with IPv4 (and not-so-much when dealing with IPv6).

An obversation

For instance, at least when looking at a chart that shows IPv4 /24 through IPv4 /32, the value in the “Number of address(es)” can be added to the “Last 8 bits as decimal” row, and the result will be the number 256.

Using the whole “if a + b == c, then c - b == a” logic, this also means that 256 minus the number of address(es) will reveal the “Last 8 bits as decimal” row. Another true observation is that 256 minus the number in the “Last 8 bits as decimal” row will provide the number of addresses in the first block.

Another obversation

The number in the “Last 8 bits as decimal” row for /24 is 0. For all of the later columns, the value in the “Last 8 bits as decimal” row is equal to the value of the previous column, plus the number of addresses in the same column.

So, for example, /27 has a “Last 8 bits as decimal” row value of 224. 224 is 192+32. 192 is the value of the “Last 8 bits as decimal” row in the /26 column, which is the previous column. 32 is the value of the the “Number of address(es)” row in the /27 column.