cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1837
Views
20
Helpful
20
Replies

Help understanding the basis of subnetting

David Lapointe
Level 1
Level 1

Cisco Community

I'm sorry to ask this question here, but after searching for many hours on the Net, and asking my teacher twice for more information, I'm still completely lost, and need some help.

I'm studying at university and I have a class about all thing Internet. Sub-netting is just one of the many subjects, but is the one that gives me the most difficulty. I understand the basic stuff (IP addresses, different classes, mask, etc...). The teacher gave us an homework a couple weeks ago, and even he explained the answers in detail, but I did not get his method (to be honest, I think 95% of the class did not get it neither...).

Here is an example of a question he asked:

Mask: 255.255.240.0

Network Id: 111

Sub-network Id: 111.11

User Id: 1.11

Now, find the IP address of the Network.

Can someone provide a simple method to get the IP address in that specific case? Thank you in advance.

2 Accepted Solutions

Accepted Solutions

Joseph W. Doherty
Hall of Fame
Hall of Fame

This is for classful addressing?

The values provided are dotted decimal?

A network ID of 111.x.x.x would be a Class A, and from the mask, /20, uses the next 12 bits as a subnet ID (leaving 12 bits for a host ID).  BTW, 111.0.0.0 would the IP address of the network (for a Class A, the first octet is the network address).

I converted 111.11 to (binary) 0110 1111 0000 1011, removed the last 4 bits (/20, mask), providing (a 12 bit number) 0110 1111 0000, which is 1,776 decimal or, in dotted decimal, 111.0.  I.e. the .11 (within 0..15 decimal) is excluded by the /20 (as those bits are part of the host ID).

BTW, network, host and/or subnet ranges not aligned with the decimal octets are often confusing until you look at them as what they are in binary.

The subnet ID should be 111.0 while the user ID should be 11.11, again because the /20 split the 3rd octet in half.

View solution in original post

David Lapointe,

The IP address 111.111.177.11 by itself is ambiguous; meaning that we do not know what subnet it belongs to.
A subnet mask (such as 255.255.240.0) is used with an IP address to determine what subnet it is a part of.
The subnet ID is referred to as 111.111.176.0 (111.11 in binary is different than 111.176)
The user IP address is 111.111.177.11 (1.11 in binary is different than 177.11).
This IP address 111.111.177.11 is actually the 266th user address on this network, not the 11th.

Using the IP Address and Subnet Mask, here is a fundamental method to find the Subnet ID, user range, and broadcast ID:

User IP address - 111.111.177.11, Subnet Mask - 255.255.240.0
Step 1: Convert user IP address to binary
            (111.111.177.11 = 01101111.01101111.10110001.00001011)
Step 2: Convert subnet Mask to binary
            (255.255.240.0 = 11111111.11111111.11110000.00000000)

                       |-------Subnet bits--------| |---User bits---|
User IP ADD    01101111 . 01101111 . 1011  0001 . 00001011 = Binary
Subnet Mask   11111111 . 11111111 . 1111  0000 . 00000000 = Binary
                       | Octet 1 | . | Octet 2 | . |  Octet 3   | . | Octet 4 |
------------------------------------------
Subnet ID       01101111 . 01101111 . 1011  0000 . 00000000 = Binary

Step 3: Use Logical bitwise ANDing to compare IP address and Subnet Mask bit.
            (1 and 1 = 1, all other combinations = 0) - Result is the Subnet ID.
Step 4: Convert binary Subnet ID to Decimal
            (01101111 . 01101111 . 1011 0000 . 00000000 = 111.111.176.0
Step 5: First valid user is 1 more than the subnet ID
            111.111.176.0 + 1 = 111.111.176.1
Step 7: Last valid user is one less than the broadcast ID
            111.111.191.255 - 1 = 111.111.191.254
Step 6: Set all user bits to 1's and convert IP address to decimal
            01101111 . 01101111 . 1011 1111 . 11111111 = 111.111.191.255

    Subnet ID        1st Valid User       Last Valid User        Broadcast ID
-------------   ------------    ---------------   ---------------
111.111.176.0   111.111.176.1   111.111.191.254   111.111.191.255
                        |<------ Valid User Range ------>|

HTH...Please provide some feedback with your thoughts on this explanation.

----------------------------------------------------------------------------------------------------Remember to mark helpful posts and mark the correct answer as a solution; It helps other users with similar questions.

View solution in original post

20 Replies 20

David Lapointe
Level 1
Level 1

There is a mistake. It should read ''Now, find the IP address of the user.''

111.111.11.11 - User IP.

Joseph W. Doherty
Hall of Fame
Hall of Fame

This is for classful addressing?

The values provided are dotted decimal?

A network ID of 111.x.x.x would be a Class A, and from the mask, /20, uses the next 12 bits as a subnet ID (leaving 12 bits for a host ID).  BTW, 111.0.0.0 would the IP address of the network (for a Class A, the first octet is the network address).

I converted 111.11 to (binary) 0110 1111 0000 1011, removed the last 4 bits (/20, mask), providing (a 12 bit number) 0110 1111 0000, which is 1,776 decimal or, in dotted decimal, 111.0.  I.e. the .11 (within 0..15 decimal) is excluded by the /20 (as those bits are part of the host ID).

BTW, network, host and/or subnet ranges not aligned with the decimal octets are often confusing until you look at them as what they are in binary.

The subnet ID should be 111.0 while the user ID should be 11.11, again because the /20 split the 3rd octet in half.

David Lapointe
Level 1
Level 1

Actually the answer we got for this exercice is: 111.111.177.11

The teacher told me that I had to put the 11 (from 111.11) in binary, and the 1 (from 1.11) in binary, which gives 1011 for 11, and 0001 for 1, and to put them in the 3rd Byte, now we got 10110001 = 177...

Ah, I understand exactly what your teacher did but would argue whether subnet ID should be presented as 111.11 or 111.176.

IPv4 dotted decimal is an octet or byte, not a nibble or half byte.

Again, I believe I understand your teacher's logic path but using dotted decimal the way your teacher did can lead to different ways to "compute" the 3rd octet.

Better I think would have been to start with an IP address and break out the network, subnet and host values.

 

Thank you Joseph for your help. I really appreciate it. I'll have a conversation with my teacher, and tell him what you just wrote to me.

We had other exercises with IP addresses, network masks to break down into nework, subnet and host values. These were easier than the exercise I sent you.

Oh, thinking some more about this, I believe the exercise of taking a network ID, subnetwork ID, host ID, with mask, and converting into an IPv4 dotted decimal number very good, but the confusing thing, I believe, was providing subnetwork ID and host ID as dotted decimals.  Better, I believe, would be to provide network ID, subnetwork ID, and host ID as just "regular" decimal values (where you would need to convert their combination into the correct IPv4 dotted decimal).

BTW, if you were to write the network prefix (i.e. host ID masked out) as dotted decimal, it would be: 111.111.176.0

David Lapointe
Level 1
Level 1

The main problem with the exercise, was that the teacher gave us no information and no detail to how achieve the whole process. Basically, we were told about what is an IP address, how to transform it into binary, and what is the mask for. That's it, nothing else.

Thank you once again Joseph for taking the time to answer my question.

Hmm, if given:

Network #: 111
Subnet #: 1,787
Host #: 267

Mask: 255.255.240.0

Can you provide the IP address?

If you can, what did you do?

(If you need further help, let me know. BTW, I've taught networking at the college level.)

I don't think I can. But I'll tell you my reasoning.

Network 111 = class A. So this first number is not gonna changes.

Mask 255.255.240.0 = 20 bits

So far, we have the first 8 bits for the network, and the next 12 bits for subnet; leaving the last 12 bits for the host #.

I probably have to change 1,787 to a binary number, which gives me: 11011111011. That's 11 bits. I probably have to put those binary bits starting after the first byte (111). From this I get 223.96. So far we have 111.223.96.host#.

267 = 100001011

I'm stuck here. I don't know how to include this number.

 

"Network 111 = class A."

Correct, but, BTW, why is it a Class A?

"So far, we have the first 8 bits for the network, and the next 12 bits for subnet; leaving the last 12 bits for the host #."

Correct, correct and correct.  BTW how do we know the first 20 bits should be split 8|12?

"I probably have to change 1,787 to a binary number"

Correct.

"which gives me: 11011111011"

Yes and no, remember you wrote "the next 12 bits for subnet", so 0110 1111 1011, is our 12 bits.  (Possibly a key thing to remember, a IPv4 address is 32 bits, we need to account for all of them [bits]; don't forget we don't want to suppress leading zeros.)

"267 = 100001011"

How many bits do we need for host #?  You wrote " leaving the last 12 bits for the host #."  So, 0001 0000 1011, is our 12 bits.

Can you continue from here?

''Correct, but, BTW, why is it a Class A?''

Because 111 fits in between 1 and 128. Class A IP addresses start with a number ranging from 1 to 128.

''BTW how do we know the first 20 bits should be split 8|12?''

Because the Network part of an IP address is static, and in a class A the Network are the 8 first bits starting from the left.

I see what you did there. If I understand correctly, now I just need to put that long sequence of binary numbers starting from the left side, just after the Network Id.

01101111 10110001 00001011 = 111.177.11 in decimal. To which we add the first 111, for a final result of : 111.111.177.11

 

"Because 111 fits in between 1 and 128. Class A IP addresses start with a number ranging from 1 to 128."

Correct, because in binary, the first bit is zero.  On very old/early computers, this was an efficient way to determine whether the network was a Class A.  Also, if the first bit is 1 and the second bit is a zero, it's a Class B.

"Because the Network part of an IP address is static, and in a class A the Network are the 8 first bits starting from the left."

Correct.

"I see what you did there. If I understand correctly, now I just need to put that long sequence of binary numbers starting from the left side, just after the Network Id.

01101111 10110001 00001011 = 111.177.11 in decimal. To which we add the first 111, for a final result of : 111.111.177.11"

Correct!!!  Final result look familiar?  Did working through this help in your understanding?

David Lapointe
Level 1
Level 1

Yes! Yes indeed, it was very helpful. My teacher did not teach clearly about the relationship between the Mask # and the subsequent byte from the IP address. Now I get i, thanks to your clear and helpful explanations.

Thank you for taking the time to assist me through the whole thing, and getting me to grasp the missing pieces in the puzzle.

Review Cisco Networking for a $25 gift card