cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2854
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.

20 Replies 20

David Lapointe,

111.111.177.11 - User IP.

                       |-Net ID-|   |---Subnet ID---|   |----User ID----|
Teacher Way   01101111 . 01101111 . 1011 + 0001 . 00001011   =   Binary
Subnet Mask   11111111 . 11111111 . 1111    0000 . 00000000   =   Binary
                       |-Octet1-| . |-Octet2-| . |-Octet3-- | . |-Octet4-|

Your teacher split the 3rd octet into two; one part belonging to the Subnet ID and the other is part of the host (user).
This method is not typically used. Also, lots of ones were used in the decimal numbers of the addresses given; they are
easily mistaken for binary numbers or a subnet Mask. Hopefully the visual representation above helps.

I agree with @Joseph W. Doherty. His explanation was very informative. Please mark his posts as helpful and as a Solution.

----------------------------------------------------------------------------------------------------

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

''This method is not typically used.''

What method would be typically used then? The Subnet ID would be simply written: 111.177, the Network ID 111, and the host # 11?

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.

What method would be typically used then?

Usually you would only see an IPv4 in its full dotted decimal notation, and with classless networking (technically there are no longer any subnets), with an appended /#, e.g. 111.111.177.11/20.  Of course as subnet mask might be provided, with an IP, which also tells us the division between networking numbering and host numbering (as does the /), but does not really tell us whether we're doing classful or classless addressing.

Besides presenting the actual network number, subnet number and/or host number, as individual values, when done, don't recall anyone use dotted decimal for them, decimal yes, dotted decimal no.

How you teacher was representing the subnet value, in particular, I still believe confusing, as, again, I believe debatable how the subnet number was represented in dotted decimal.

To clarify further, (much along the lines of what @NetworkDave shows in his posts.  Our 32 bit binary /20 is as follows:

nnnn nnnn | ssss ssss | ssss hhhh | hhhh hhhh n=network, s=subnet, h=host

Our subnet number is 12 bits, and spans the second and third octets (somewhat similar to the host number, also 12 bits which spans the third and fourth octets).

If you take the subnet's (or host's) 12 bits, as a single binary integer, you can convert it to a single decimal integer (basically you did the converse with the exercise you worked through with me).

The dotted decimal, used in IPv4 addresses, each decimal value represent an octet of 8 bits.

Given a host number of 1.11 I would convert that to: 0000 0001 | 0000 1011 blue bits exceed 12 bits for host number

Given a subnet (dotted decimal) number of 111.11 I would convert that to: 0110 1111 | 0000 1011 red bits not in the 12 bit range

But your teacher converts that to: 0110 1111 | 1011 because (?) we "know" subnet is using just the 4 high bits of the 3rd octet.

Cannot say, for sure, whether my approach or your teacher's is correct, as I don't recall anyone using dotted decimal this way.  IPv4 dotted decimal, in at least the Wiki article (https://en.wikipedia.org/wiki/Dot-decimal_notation), appears to conform with my expectations that each decimal value represents a value for an octet unless your doing octet.24bits or octet.octet.16bits.

What your teacher appears to have done is octet.4bit (okay [?] because we know subnet number uses just the next 4 bits).

Personally, for students trying to grasp the basics of how an IPv4 number is constructed, and its dotted decimal notation, whether octet.4bits is right or wrong, I think "over the top".

BTW, I'm retired with 40+ years of IT experience.  Actually a late comer to networking, as most of my professional career was in software development, including professional writing assembler level programs, where we often work with bits quite a lot.

BTW, wrote on this in an earlier post, but if I were to provide a network ID number in dotted decimal, rather than doing what appears to have be done by your teacher:

0110 1111 | 1011 = 111.11

I would have done:

0110 1111 | 1011 0000 = 111.176

Lastly, when working with computer, if a 8 bit byte/octet has a numeric value of 5 decimal/octal/hexadecimal, or 101 binary, in the machine it's 0000 0101.  I.e. bit alignment very much matters for number of bits being used to store the numeric value.

If a machine's byte/octet contained 0101 0000, its decimal numeric value would be 80 decimal (120 octal or 50 hexadecimal) but if we were only working with a nibble (4 bits) containing 0101 is decimal/octal/hexadecimal values would all be 5.

Hope the forgoing also helps understanding, somewhat better, when working with binary numeric containers, the importance of number of bits vs. a numeric value.

BTW, in a remotely similar way, in engineering, "2", vs. "2.0", vs. "2.0000" has much significance beyond, mathematically, they are all the number 2.

Joseph and Dave, you guys are real MVP. I appreciate the time and effort you took to help me.

 
The method you explained is the easiest one to understand, and more sound too. The one my teacher used is confusing, because it is asking the person to change 2 numbers (11 and 1 in that case) into a binary numbers, to merge then, and then to place them somewhere in the equation. This was super counter intuitive for me, especially the number 11 (1011 in binary), that had to be placed at the beginning of the 3rd octet, where the first values are 128-64-32-16, and not 8-4-2-1; let's say that for a beginner it is not the easiest thing to grasp...
Anyway, now I understand both your method and the logic behind it, AND the method of my teacher. I feel way more confident then
let's say 2 days ago. And I'll be able to help other students in my class!