CIDR Notation, Subnetting and Mathematics

SauRoN

Active Member
Joined
May 2, 2020
Messages
494
Another question, if you may. This question came across to me during a practice test which kind of caught me off guard.

You are over complicating this needlessly.

This question isn’t asking you to go work out what easy one does by hand.

It expects you to have memorised the most common subnets and answer the question in the 3 seconds it took to read it and answer it.

If you are going to work this out manually you are going to fail the exam for a lack of time and understanding the concept of testing in the first place.

The concept is indeed that you would have memorised this stuff through exposure and experience. They generally aren’t out to get you by asking for the most obscure shit either.

If you know /16, /24 and then upwards from memory you’ll be just fine.

There is absolutely no need for calculators or finger counting of any kind.

Using Sinbad’s tricks for what you can’t remember off hand should do the job just fine without needing to do anything binary/octal/hex.
 
Last edited:

SauRoN

Active Member
Joined
May 2, 2020
Messages
494
PS. I was told that it's usually the first address and last address reserved. Is it that so?

Crazy that you were told this and that it’s not covered in the materials provided.

It should surely be covered before they go down the path of all the math or at least during that process.


Sent from my iPhone
 

BloodrayneZA

Well-Known Member
Joined
May 2, 2020
Messages
2,822
Location
Helheim
@SauRoN lol. I have actually finally gotten the grasp of subnetting and all that. Took me the better part of 4 days of studying to actually get it into my head.

My only issue is that my memory isn't what it used to be 10 years ago so I'm having a bit of trouble remembering the ranges. Thing is I do know what Class A, Class B and Class C is. However it is calculating the range in, say Class B, from a certain address which poses a different story entirely.

Now if I recall correctly, Class A is 24 bits, Class B is 16 bits and Class C is 8 bits, and so on. So if I'm asked about a Class C subnet to calculate which range this IP address falls into, the first and the last with this particular IP address randomly picked out of nowhere in between that range.

like this example:

204.17.5.0 255.255.255.224 host address range 1 to 30
204.17.5.32 255.255.255.224 host address range 33 to 62
204.17.5.64 255.255.255.224 host address range 65 to 94
204.17.5.96 255.255.255.224 host address range 97 to 126
204.17.5.128 255.255.255.224 host address range 129 to 158
204.17.5.160 255.255.255.224 host address range 161 to 190
204.17.5.192 255.255.255.224 host address range 193 to 222
204.17.5.224 255.255.255.224 host address range 225 to 254

Now this is my issue - working out the host address range.

I'll pick a random number from the first range at 15. That's in the middle. This is one of the questions that will randomly catch me off guard in an exam. I want to be better prepared for it.

204.17.5.15
255.225.255.224

This is where I am clueless.
 

SauRoN

Active Member
Joined
May 2, 2020
Messages
494
@SauRoN lol. I have actually finally gotten the grasp of subnetting and all that. Took me the better part of 4 days of studying to actually get it into my head.

My only issue is that my memory isn't what it used to be 10 years ago so I'm having a bit of trouble remembering the ranges. Thing is I do know what Class A, Class B and Class C is. However it is calculating the range in, say Class B, from a certain address which poses a different story entirely.

Now if I recall correctly, Class A is 24 bits, Class B is 16 bits and Class C is 8 bits, and so on. So if I'm asked about a Class C subnet to calculate which range this IP address falls into, the first and the last with this particular IP address randomly picked out of nowhere in between that range.

like this example:



Now this is my issue - working out the host address range.

I'll pick a random number from the first range at 15. That's in the middle. This is one of the questions that will randomly catch me off guard in an exam. I want to be better prepared for it.



This is where I am clueless.

Be careful of overthinking it and then running out of time.

Work out up front how much time you have and how many questions there are and then how much you have to spend per question and you have an idea of the expectation of “work” required.

The samples you’ve gotten will be like for like in the exams just more randomised, they won’t be any more complex.

Presumably this is N+? You haven’t actually mentioned which exam anywhere.

Class A, B and C all work exactly the same it’s just a matter of standards which should be used where, not that work any different.

Class A is basically just the biggest address space with the most addresses for publicly routable internet use and then for each Class subsequently they get smaller until you get to the domestic private home user or small business Class C networks that aren’t publicly routable and get duplicated behind NATs. But the lines blur between the lot of them and hence also the need for IPv6.

It’s a standard more than than a functional thing.

The CIDR ultimately defines the Class.

Class A = /8
Class B = /16
Class C = /24

You’ve already covered all this in your very first post with the chart.

Also in your last example I don’t understand what the question is?

Sinbad’s post with the trick you need to work it out should really be the only thing you need to memorise for anything you can’t memorise directly.

But in all seriousness these questions are blatantly obvious with clear answers. You need only look at it for 10 seconds to figure out which ones are wrong and then choose the one that is obviously right.

They are testing your ability to work in the real world of IT, not your ability to do mathematical equation. As long as you understand what the mask means you are good to go.

Sent from my iPhone
 
Last edited:

BloodrayneZA

Well-Known Member
Joined
May 2, 2020
Messages
2,822
Location
Helheim
There's a trick to this, for subnets of greater than 24 bits. (ie smaller subnets than /24)

Subtract the subnet mask's last significant octet from 256, gives you the size of the subnet.
One address for network, one address for broadcast (always).

So 255.255.255.192
256 - 192 = 64 addresses. Subtract 2 for network and broadcast, 62 available.

255.255.255.252
256 -252 = 4, so 2 addresses available. That's why that subnet mask is used for point to point links...

255.255.255.224
256-224 = 32, so 30 usable addresses.

For subnets bigger than a /24 it's a little more complex. You do the same maths but multiply by 256 in the middle.

Eg 255.255.252.0
256 - 252 = 4
4x256 = 1024
So 1022 usable addresses. Always first ip is network and last is broadcast.

Similar logic for a subnet bigger than 16.

255.252.0.0
4x256x256 = 262144, so 262142 available ips in the subnet.


Make the sense?
Thank you @Sinbad and @SauRoN, I finally get this one.
 

BloodrayneZA

Well-Known Member
Joined
May 2, 2020
Messages
2,822
Location
Helheim
Please correct me if I'm wrong on this one.

I found a random IP address for my VirtualBox Host, after running ipconfig /all as I wanted an IP address and subnet mask to work with (not some lesson online where they give you all the answers, even if you get it wrong). I won't learn that way.

192.168.56.1
255.255.255.0

Working this out

11000000.10101000.00111000.00000001 = /9
11111111.11111111.11111111.00000000 = /24

256-255 = 1x256 = 256-2 = 254

Now in this:

If working in bit increments for a range, the question asking me to find the first IP and last IP of 192.168.56.1 range

I would assume that following the 128, 64, 32, 16, 8, 4, 2 rule would apply? If so, this falls between 64 and 32 (reserving the 1st and last address).

@SauRoN this is exactly what I was referring to (Sorry about last night, I was kind of overwhelmed and tired so I didn't word it correctly)
 

SauRoN

Active Member
Joined
May 2, 2020
Messages
494
The range is defined by the subnet mask.

The only IP’s in that range based on the subnet mask are 192.168.56.1 - 192.168.56.254

0 and 255 being reserved.

192.168.56.1 is an IP not a range. You already have the IP in hand.

If you wrote it as a range it would be...

192.168.56.0/24

Or

192.168.56.0/255.255.255.0

You didn’t need to work anything out to know that /24 = 255.255.255.0 = 254 addresses.

Same way /16 = 255.255.0.0 etc.

Sent from my iPhone
 

dabean

Well-Known Member
Joined
Jul 17, 2020
Messages
582
11111111.11111111.11111111.00000000 = /24

256-255 = 1x256 = 256-2 = 254

Now in this:

If working in bit increments for a range, the question asking me to find the first IP and last IP of 192.168.56.1 range
The first IP is 192.168.56.1 and the last IP is 192.168.56.254.

The whole point of subnetting is to define what counts as a local address. The subnet mask is applied to the destination address and if it's determined to be local the network sends out a broadcast (192.168.56.255) so that the matching device can reply.

If the subnet doesn't match the request goes to a router (default gateway) which handles it from there (through routing tables).
 

BloodrayneZA

Well-Known Member
Joined
May 2, 2020
Messages
2,822
Location
Helheim
Food for thought (though I got all the answers right this time)

A 26-bit subnet mask will result into 4 subnets for the given address range as follows:

192.168.16.0
192.168.16.64
192.168.16.128
192.168.16.192


For the given subnets, the IP address and the default gateway address should be on the same subnet for proper communication to the Internet. Also, an auto duplex setting will not result into mismatch errors that can affect the communication. Therefore, a possible configuration is as follows:
  • IP address: 192.168.16.1
  • Default gateway: 192.168.16.62
  • Subnet mask: 255.255.255.192
  • Duplex: Auto

My bad, it's subnetworks.
 
Last edited:

BloodrayneZA

Well-Known Member
Joined
May 2, 2020
Messages
2,822
Location
Helheim
@SauRoN got it. here we go

Question 16: What will be the subnetwork of a host if it has the address 172.16.45.14/30?

A: 172.16.45.12
B: 172.16.45.8
C: 172.16.45.4
D: 172.16.45.0
E: 172.16.45.16

So why is it 12 and not 16? I get this one wrong every time.
 
Last edited:

dabean

Well-Known Member
Joined
Jul 17, 2020
Messages
582
@SauRoN got it. here we go



So why is it 12 and not 16? I get this one wrong every time.
This one you can work out by knowing that /30 leaves two available addresses (or 4 with network/broadcast). The network address is always lower than the IP (broadcast always higher).

Eliminate any answers higher than the IP and then anything out of range (assuming that the test will be multiple choice).
 

BloodrayneZA

Well-Known Member
Joined
May 2, 2020
Messages
2,822
Location
Helheim
This one you can work out by knowing that /30 leaves two available addresses (or 4 with network/broadcast). The network address is always lower than the IP (broadcast always higher).

Eliminate any answers higher than the IP and then anything out of range (assuming that the test will be multiple choice).
Only one answer for that one, not multiple choice. There are a couple that have multiple choices.

Ok that makes sense. Yeah I know /30 leaves me with 2 available hosts. I just had another look at the part of the course relating to that and well I understood some of it, I just need to read again and figure it out.

Something about working out the subnet address, first valid host, last valid host and broadcast address after I work out the subnet

Practice Example #3C: 255.255.255.224 (/27)
This time, we'll subnet the network address 192.168.10.0 and subnet mask 255.255.255.224.

192.168.10.0 = Network address
255.255.255.224 = Subnet mask
  • How many subnets? 224 is 11100000, so our equation is 23 = 8.
  • How many hosts? 25 – 2 = 30.
  • What are the valid subnets? 256 – 224 = 32. We just start at zero and count to the subnet mask value in blocks (increments) of 32: 0, 32, 64, 96, 128, 160, 192, and 224.
  • What's the broadcast address for each subnet (always the number right before the next subnet)?
  • What are the valid hosts (the numbers between the subnet number and the broadcast address)?
To answer the last two questions, first, just write out the subnets, and then write out the broadcast address—the number right before the next subnet. Last, fill in the host address. The following table gives you all the subnets for the 255.255.255.224 Class C subnet mask:

The subnet address032 64 96 128 160 192 224
The first valid host1336597129161193225
The last valid host306294126158190222254
The broadcast address316395127159191223255

This is kind of what I need to do.
 

dabean

Well-Known Member
Joined
Jul 17, 2020
Messages
582
It's been around 20 years since I did my N+ but I can't remember having to work anything out on paper.

I'm sure you'll be fine.
 

BloodrayneZA

Well-Known Member
Joined
May 2, 2020
Messages
2,822
Location
Helheim
I created a custom practice test yesterday - all of the questions related to subnetting and IP addressing including the labs. I scored 92% on it.

So thank you guys all for the help, I really appreciate your advice.

I am definitely about ready to write the exam now.
 

BloodrayneZA

Well-Known Member
Joined
May 2, 2020
Messages
2,822
Location
Helheim
There's a trick to this, for subnets of greater than 24 bits. (ie smaller subnets than /24)

Subtract the subnet mask's last significant octet from 256, gives you the size of the subnet.
One address for network, one address for broadcast (always).

So 255.255.255.192
256 - 192 = 64 addresses. Subtract 2 for network and broadcast, 62 available.

255.255.255.252
256 -252 = 4, so 2 addresses available. That's why that subnet mask is used for point to point links...

255.255.255.224
256-224 = 32, so 30 usable addresses.

For subnets bigger than a /24 it's a little more complex. You do the same maths but multiply by 256 in the middle.

Eg 255.255.252.0
256 - 252 = 4
4x256 = 1024
So 1022 usable addresses. Always first ip is network and last is broadcast.

Similar logic for a subnet bigger than 16.

255.252.0.0
4x256x256 = 262144, so 262142 available ips in the subnet.


Make the sense?
@Sinbad where does the 256 come from for subtracting purposes?
 
Top