# How can you calculate IP address subnet ranges?

If you're given:

``````Number of needed subnets: 2
``````

``````Address Class: C
Total number of subnets: 2^2 = 4
Total number of host addresses: 2^6 (8-2 = 6)
Number of usable addresses: 2^6 -2
Number of bits borrowed: 2
``````

``````What is the 3rd subnet range?
What is the subnet number for the 2nd subnet?
What are the assignable addresses for the 3rd subnet?
``````

How would I answer these... All I remember from the procedure is to look at the last number in the Custom subnet mask (192) and do 256 - 192 to get 64 and then use 64 to increment something. But I'm not sure what each question is asking. Please help, and explain step by step for each question.

Also, what would be different if I was faced with the Address Class of B in this situation?

TOOGAM has an excellent answer for this one.

However, I'll throw in my two cents, this is how I used to simplify it to wrap my mind around subnetting:

Look at IP addresses in binary. Each segment of an IP address is made up of 8 bits, or an octet, which means you have a working range of 0-255 because that's the range of numbers 8 bits can represent. Here are a couple of examples:

``````0.0.0.0 is 0000 0000.0000 0000.0000 0000.0000 0000
``````

and

``````192.168.1.0 is 1100 0000.1010 1000.0000 0001.0000 0000
``````

You know that 192.168.1.0 is a class C address, right? In CIDR notation that means it's a /24 network and the mask is 255.255.255.0. What does this mean? Let's look at the binary again - the netmask in binary looks like this:

``````1111 1111.1111 1111.1111 1111.0000 0000
``````

All the 1s are the bits of the actual address that are used to identify the network, while all the 0s are used to identify a specific host on the network. The /24 means that 24 bits are used to identify the network, go ahead and count them.

Note that every network has a network name (which is the FIRST address of the network, this is also your subnet number), and a broadcast address (which is the LAST address of the network). These two addresses are reserved, you cannot use them for hosts.

So let's say we want to split 192.168.1.0 into three subnets. We can't! Why? Let's work it out. If we borrow one bit, we can only have two subnets because one bit can only represent numbers 0-1.

Here's what I mean - if you want to borrow one bit, then the subnet mask becomes

``````255.255.255.128
``````

which, in binary, is

``````1111 1111.1111 1111.1111 1111.1000 0000
^This is your borrowed bit right here
``````

So now you have a /25 network. You're using 25 bits to represent your networks, and the remaining 7 bits to identify your hosts. (Note: When doing subnet calculations, it helps to stop thinking about the dots in the IP address and just deal with the binary. You'll see what I mean later.)

This only gives you two subnets,

``````         This part tells you which network it is!
vvvv vvvv vvvv vvvv vvvv vvvv v
192.168.1.0/25    1100 0000.1010 1000.0000 0001.0000 0000
^^^ ^^^^
This part tells you which host it is!
``````

and

``````          This part tells you which network it is!
vvvv vvvv vvvv vvvv vvvv vvvv v
192.168.1.128/25  1100 0000.1010 1000.0000 0001.1000 0000
^^^ ^^^^
This part tells you which host it is!
``````

The remaining 7 bits are reserved for identifying your hosts, so you can't use those. You have to borrow two bits instead, which can represent number 0-3. Like it or not, if you want three subnets, you have to split the network into four subnets at minimum.

So now you have a /26 network with these subnets:

``````192.168.1.0/26      1100 0000.1010 1000.0000 0001.0000 0000
192.168.1.64/26     1100 0000.1010 1000.0000 0001.0100 0000
192.168.1.128/26    1100 0000.1010 1000.0000 0001.1000 0000
192.168.1.192/26    1100 0000.1010 1000.0000 0001.1100 0000
^^
Look at these two bits! Watch how they go from 0 to 3 in binary.
``````

To get the third network, all you have to do is look at your borrowed bits and make a 2, or "10" in binary. Why 2? Because we are counting from 0, not 1. In sequence, you have "0, 1, 2, 3", so the third network is "2".

You just slap this "10" into the borrowed bits and you can get the third network. For example, let's say I had an odd network like

`````` 10.10.254.0/23 0000 1010.0000 1010.1111 1110.0000 0000
``````

and I needed to split it into three subnets and find the third. In other words, I would need to make it into a /25 network because I need two borrowed bits at least. So now I have

``````10.10.254.0/25     0000 1010.0000 1010.1111 1110.0000 0000
10.10.254.128/25   0000 1010.0000 1010.1111 1110.1000 0000
10.10.255.0/25     0000 1010.0000 1010.1111 1111.0000 0000
10.10.255.128/25   0000 1010.0000 1010.1111 1111.1000 0000
Your borrowed bits are here ^ ^
``````

It's super confusing if you look at the decimal IP addresses, isn't it? This is what I meant earlier when I said to work in binary and ignore the dots in the IP address when doing subnet calculations.

``````   Remember, this is the "host" part of your address, the first
26 bits represent the network
vv vvvv
192.168.1.191/26   1100 0000.1010 1000.0000 0001.1011 1111
See how the host portion is filled with 1s? ^^ ^^^^
``````

Likewise, to get the usable range, just start by putting a 1 in the last place of the network name to get the first usable address, then fill the "host" part with 1s and put a 0 in the last place of the network name to get the last usable address.

``````   Remember, this is the "host" part of your address, the first
26 bits represent the network
vv vvvv
1100 0000.1010 1000.0000 0001.1000 0001      192.168.1.129/26
First address: put a 1 here ^
1100 0000.1010 1000.0000 0001.1011 1110      192.168.1.190/26
^
Last address: fill the host part with 1s but put a 0 here
``````

Of course, eventually you should learn how to do it like TOOGAM explained, but this might be helpful if you need to visualise the subnets.

• Missing a zero at end of an address, near where you first describe "borrowed bit". Mar 25, 2015 at 5:03

Answering this sort of question requires correct use of mathematical skills (in addition to an understanding of subnets). You said that 2^6 (8-2 = 6). It is true that 8-2 is 6, but 2 raised to the sixth power is 64, not 8. This is wrong, which may be why you are experiencing some problems.

A subnet mask of 255.255.255.192 has 64 addresses, of which you subtract 2 so you would have 62 addresses.

Subnetting a Class B address is exactly the same as subnetting a class C address, except for the one minor insignificant difference that classes B and C have different default subnet masks. But you can customize either subnet mask, which is why I'm calling this difference extremely minor.

Also, each time you move right on the standard/typical subnet chart, you double the subnets. So if you have 256 addresses (which is a common starting point for simple questions on class C networks), then a /24 has one subnet. A /25 has two subnets, a /26 has four subnets, and a /28 has sixteen subnets.

If you're supposed to be working around the range of 195.223.50.0 and need only two network addresses, you could do that with a subnet mask of 255.255.255.252. I don't think that's the answer you're really looking for, but you didn't articulate a clear question, so I don't know the answer to whatever your question is.

If you have 195.223.50.0 with a subnet mask of 255.255.255.192 (which is a /26... You really do want to be learning CIDR notation at the same time you're learning subnets), then the 256 addresses are split up into four subnets. So take the number 256, and split it into four: each subnet has 64 addresses. So the range of addresses in each subnet are 192.223.50.0 through 192.223.50.63, 192.223.50.64 through 192.223.50.127, 192.223.50.128 through 192.223.50.192, and 192.223.50.193 through 192.223.50.255. (Those include the "unusable" network addresses, the network ID and the broadcast address. This is why you subtract 2 addresses to calculate the number of "usable" addresses.) The network IDs are 192.223.50.0 and 192.223.50.64 and 192.223.50.128 and 192.223.50.192. (1/4 times 256 = 64, 2/4 times 256 = 128, 3/4 times 256 = 192.)

I've now given you all of the information you need to answer your questions. I'll give you the correct answers:

What is the 3rd subnet range?

192.223.50.128 through 192.223.50.192

What is the subnet number for the 2nd subnet?

The subnet's network ID is 192.223.50.64

192.223.50.63

What are the assignable addresses for the 3rd subnet?

also known as the "usable" addresses, 192.223.50.129 through 192.223.50.190. (That is the 192.223.50.128 - 192.223.50.191 subnet, not counting the network ID and the broadcast address).

• Okay, but let's say I have 190.35.0.0 - what would be the 15th subnet range in this case? Considering that it is a B Class, how would the third decimal be affected? Also, why does the "usable" address range increment 128 to 129 subtract 191 to 190? Mar 25, 2015 at 4:35
• The 15th subnet depends on how big each subnet is. That varies based on mask you use, so need more than just the starting address of 190.35.0.0 to answer that. The third octet won't be affected if you're using /24 or smaller subnets (bigger numbers, /25 or /26 etc.) A /16 uses 255.255.0.0, a /17 uses 255.255.128.0, a /18 uses 255.255.192.0, just like the /24, /25, /26 pattern affects last octet. Standard is that 1st and the last address of a subnet are not "usable"/"assignable"; when you subtract two, it is presumed that you remove 1st and last address. So a 128-191 has usable of 129-190. Mar 25, 2015 at 4:59

I hate to give you the "cheat" way if this is for school...but i haven't used "math" to sub-net a network in years because it just complicates everything... "and yours is kind of faulty :(. "

Its called CIDR (Classless Inter-Domain Routing);

has a short explanation and a JavaScript Utility to demonstrate how it works.

"Either you give it an IP Range (192.168.0.0 - 192.168.1.1) and it gives you the CIDR short hand (192.168.0.0/23), or you input the CIDR short hand (192.168.0.0/23) and it returns its IP range of (192.168.0.0 - 192.168.1.1)"

Another nice resource to sub-net something quickly are Sub-Net mask cheat sheets, commonly referred to as VLSM (Variable Length Sub-Net Mask) or CIDR cheat sheets (VLSM is a Whole-Nother ball game (The Sub-Netting of Sub-Nets)) ;

http://www.oav.net/mirrors/cidr.html

Has a very simple "Printer Friendly" CIDR cheat sheet.

I'm going to say teaching you to sub-net / CIDR outright would be out of scope for this (still going to answer your questions), but please refer to the two links posted and feel free to ask any questions you might have to clarify what they already explain.

So to start, I'm going to assume your originally asking for the "first two" sub-networks of 255.255.255.192 (known as /26 from here on out!) since you have indicated that there is a total of four Sub-Nets with a total of 64 IPs per Network (62 usable)...

## Now to the questions!

1. One Shot, One Kill...

When you "increment by 64", your just adding each Sub-Net to the last (0+64 to get .64, 64+64 to get .128, 128+64 to get .192. Basically taking the long way to get there is all.

Working with a "Class B" or (/16 through /23) works on the same principle as working with /24+. but on a larger scale.

With Class C, each CIDR notation is indicative of "Hosts or Nodes" (remember our 64 IP Addresses per Sub-Net).

Class B on the other hand is indicative of "Class C Networks".

To Compare;

Class C: /25 is equal to 128 IP Addresses.

Where...

Class B: /17 is equal to 128 CLASS C Networks (128 * 254) = 32,512 IP addresses.

Where...

Class A: /9 is equal to 128 Class B Networks (128 * 32512) = 4,161,536 IP addresses.

Let me know if I can clarify anything.

~Snow

P.S. /0 = 4,294,967,296 Total IP's, the larger you go, the less math your going to want to involve...

• Guess i should of refreshed when i came back to the desk...
– Snow
Mar 25, 2015 at 3:16
• This gives a broadcast address ending in .192, which is wrong. The broadcast address ends with .191, not .192 (and SuperUser doesn't seem to allow me to edit the post to change a single character, so I'm typing all of these characters in a massively over-worded comment). Mar 25, 2015 at 3:45