How can you calculate IP address subnet ranges?

23,412

Solution 1

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.

To get the broadcast address, simply fill the "host" part of your address with 1s. For example, the broadcast address of 192.168.1.128/26 is

   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.

Solution 2

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.

The "network address" of 192.168.50.0 is a "network ID" for any subnet that has a mask that starts with "255.255.255.". If you use a subnet mask of 255.255.255.128 then you will have two subnets. How you do know this: look at a VLSM subnetting chart that shows the /24 through /30 IPv4 subnet sizes. You'll find that /25 has two subnets. The /24 subnet mask is 255.255.255.0, the /25 subnet mask is 255.255.255.128 (which is 128 more than the /24), the /26 subnet mask is 255.255.255.192 (which is 64 more than the /25). Follow that pattern if needed: As you move down the VLSM subnetting chart, the amount you add to the subnet mask is half of the amount added for the last subnet size added. So, a /27 subnet mask is 255.255.255.224 (because .192 + 32 = 224).

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

What is the subnet broadcast address for the 1st subnet?

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).

Share:
23,412

Related videos on Youtube

user431229
Author by

user431229

Updated on September 18, 2022

Comments

  • user431229
    user431229 over 1 year

    If you're given:

    Number of needed subnets: 2   
    Network Address: 195.223.50.0 
    

    I can answer the following:

    Address Class: C 
    Default Subnet Mask: 255.255.255.0 
    Custom Subnet Mask: 255.255.255.192 
    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 
    

    BUT.... if I'm asked....

    What is the 3rd subnet range? 
    What is the subnet number for the 2nd subnet? 
    What is the subnet broadcast address for the 1st 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?

  • Snow
    Snow about 9 years
    Guess i should of refreshed when i came back to the desk...
  • TOOGAM
    TOOGAM about 9 years
    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).
  • TOOGAM
    TOOGAM about 9 years
    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.
  • TOOGAM
    TOOGAM about 9 years
    Missing a zero at end of an address, near where you first describe "borrowed bit".