What is Subnetting?

(Rene Molenaar) #1

This topic is to discuss the following lesson:

Subnetting Clarification
(Rick D) #2

I have a few questions around subnetting:

  • My understanding is that networks were broken into classes. This was inefficient. So CIDR was released to allow for “subnet” bits to be browed from the host and additional networks to be created. Is my understanding correct?
  • When subnetting do we always start from the default mask. i.e for a Class A network do I always start with a /8 and then subnet from there?
  • VLSM then allowed for these subnetworks to be variable in length rather then all being the same size. Is my understanding correct?
  • One confusion I have is around RFC1918, the RFC states:

10.0.0.0 - 10.255.255.255 (10/8 prefix)
172.16.0.0 - 172.31.255.255 (172.16/12 prefix)
192.168.0.0 - 192.168.255.255 (192.168/16 prefix)

However, online there seems to be a mix of what the subnet mask should be. Some sites say it should be /8, /12, /16. But on this site, the examples are based on /8, /16, /24.

Thanks,

(Lazaros Agapides) #3

Hello Rick

You got most of it, but I hope this clarifies it a bit more.

CIDR is Classless Inter Domain Routing. This feature allows routing to occur not only between classful addresses but also between classless addresses. Classless addresses are those that allow a variable length subnet mask (VLSM), those that have a subnet mask other than the allowed classful address. So VLSM is the feature of IP addresses that allows CIDR to take place.

When subnetting, you always start with a larger address space and subnet into smaller address spaces. The large address space may be classful or it may be classless. For example, an ISP may provide you with a range of addresses of 147.52.0.0/22 and you have to subnet them appropriately into your network. This range is a class B address, but its subnet mask is not class B. So when you subnet, you are usually given the address space that is available to you and you are to subnet it into subnets that suit your needs.

Here you have to understand the difference between the subnet mask of the classful addresses, and the prefix being used to describe the full range of private addresses.

In the case of 10.0.0.0/8, there is one possible class A private address using the classful subnet mask of /8. Both the subnet mask and the prefix defining the full range of private addresses is the same.

In the second case, the full range of private addresses is 172.16.0.0 -172.31.255.255 which can be defined as 172.16.0.0/12. But the subnet mask of class B addresses is /16. So:

172.16.0.0/12 says that these are ALL of the private IP addresses that can be used, this essentially defines the range.
/16 says that the classful addresses of this range must have a subnet mask of /16. So the following are some classful class B private address subnets:

  • 172.16.0.0/16
  • 172.17.0.0/16
  • 172.18.0.0/16
  • 172.19.0.0/16
    all of which fall within the available range of private addresses.

For the third case, the full range of class C private IP addresses that can be used are defined by 192.168.0.0/16 which is the same as saying 192.168.0.0 - 192.168.255.255. But because these are class C addresses, they must have a /24 subnet, so if you are using classful networks, then some possible private class C addresses are:

  • 192.168.10.0/24
  • 192.168.11.0/24
  • 192.168.12.0/24
  • 192.168.13.0/24

So 8/ 12/ 16/ are the prefixes that define the full range of private addresses while /8 /16 /24 are the classful subnet masks of the subnets for each type.

I hope this has been helpful!

Laz

(Rick D) #4

Thanks. What you have provided makes better sense. However when subnetting with the RFC1918 addresses Im still unclear,

When subnetting a block into small subnets do you calculate from the classful subnet mask or the prefix.
For example an 192.168.x.x. Do you subnet from /16 or 24. And this is the same for 172.16.x.x do you subnet from the /12 or /16.

(Lazaros Agapides) #5

Hello Rick

It all depends on what the requirements are. Remember that subnetting is something that you end up applying to a real world network so the network range you start off with can be anything. If you are given a network of 192.168.0.0/23 and you are asked to further subnet it to segments of /26 then that is what you will do. There is no rule that says you must start with a /16 or /24. Now if you are told to specifically come up with classful result, then this means that the resulting subnets must be classful. So if you are originally given the 192.168.0.0/23 range then the resulting subnets you create must have a /24 subnet mask.

I hope this has been helpful!

Laz

(Rick D) #6

Hi,

Your responses have been really useful. And greatly appreciate your help.
So based on all of this would mean…

I have a 192.168.0.0/24. Im right in thinking I can get a maximum of 254 networks from this as the prefix is /16. The mask is /24. Therefore I have 8 bits as subnet bits to play with.

Lets take another example:
How many subnets and hosts per subnet can you get from the network 172.30.0.0 255.255.255.240 ? Its a class B so /12 bits are used for the network id. Therefore we have /16 subnet bits and 4 host bits. So this would give us… 65536 subnets with 14 hosts.

Thanks

(Lazaros Agapides) #7

Hello Rick

Yes you’re right. Let me say it another way. The 192.168.0.0/24 network defines a range of IP addresses from 192.168.0.0 to 192.168.0.255. This is a single subnet with a subnet mask of 255.255.255.0. If you started off with a range of 192.168.0.0/16 (which is the full range of private class C addresses), and you want to separate this range into /24 subnets, then this means that you can have up to 256 networks with 256 addresses (254 without network and broadcast) in each. In other words, the networks would be:

192.168.0.0/24
192.168.1.0/24
192.168.2.0/24
192.168.3.0/24
192.168.4.0/24
192.168.5.0/24
192.168.6.0/24
…
…
192.168.254.0/24
192.168.255.0/24

For this one, not quite. 255.255.255.240 is the same as /28. If we do the same thing here we will have

172.30.0.0/28
172.30.0.16/28
172.30.0.32/28
172.30.0.48/28
…
…
172.30.255.224/28
172.30.255.240/28

This one is a little harder to see. Looking at the IP address in binary, like you described yourself, we start off with:

10101100.00000011.00000000.00000000

where the italics are the subnet and the bold are the host. The italics are 12 bits, so 2^12 = 4096. We have 4096 subnets each containing 16 (14 without network and broadcast) hosts.

I hope this has been helpful!

Laz

(Rick D) #9

Thanks. Sorry but Im still unclear. Your point of the 192.168 makes sense. We have a /24 but if we want to create more subnets we can use the class c range of /16 to obtain another 8 subnet bits.
However for the 172.30 address…
If wanted to create more subnets with the same amount of hosts in each, then wouldn’t we then again use the Class B range which is /12. Even if i go online it shows it being calculated the same was as you have shown. Also the binary you have shown is 172.3.x.x (?).

image

Thank you for all your help…

(Lazaros Agapides) #10

Hello Rick

My apologies, I made an error in my explanation. Let me clarify:

First of all, yes the binary I showed was incorrect. It should be

10101100.00011110.00000000.00000000

So going back to the original question, you are given an IP address of 172.30.0.0 as your starting address and you want to create equal subnets with a subnet mask of 255.255.255.240. Now what’s confusing here is that we have three different ways of describing the IP address ranges involved. We have:

  • The mask bits of the class B private IP address range which is /12
  • The classful mask of the private IP address range which is /16
  • The subnet size we want to obtain using the subnet mask we are given which is /28 (same as 255.255.255.240)

The first of the three describes the full range of private Class B IP addresses. So 172.16.0.0/12 is the same as saying 172.16.0.0 - 172.31.255.255. This describes the whole range. There is only one such range.

The second gives us the subnet mask to be used if CLASSFUL addressing will be used which is /16 or 255.255.0.0. Here we can say that in the whole range of class B private addresses, there are multiple Classful subnets we can create. Namely:
172.16.0.0/16
172.17.0.0/16
172.18.0.0/16
172.19.0.0/16
…
172.30.0.0/16
172.31.0.0/16

The third is what we want to end up with, which is small subnets of /28 which is the same as a subnet mask of 255.255.255.240. These were described in a previous post.

So, if you are originally given 172.30.0.0 and you are told that this is a class B private range, and you want to separate this into subnets of /28 then:

You are starting with 172.30.0.0/16 (class B) which means addresses from 172.30.0.0 to 172.30.255.255. Going to binary, we have:

10101100.00011110.00000000.00000000

where once again, the italics are the subnet and the bold are the host. The italics are 12 bits, so 2^12 = 4096. We have 4096 subnets each containing 16 (14 without network and broadcast) hosts.

Note that in your image of the IP subnet calculator above, you are using a subnet mask of 255.255.255.248 rather than 255.255.255.240 and this is why you get a value of 8192 and not 4096 for the maximum number of subnets.

I hope this has been helpful!

Laz

(Rick D) #11

Thanks - this is now clear.

1 Like