cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2316
Views
5
Helpful
14
Replies

Understanding subneting

golasinjo
Level 1
Level 1

Greetings 

I have problem understanding bits corresponding to subnet decimal numbers

So in cisco documents it's written following  on the natural mask section 

Once you have the address and the mask represented in binary, then identification of the network and host ID is easier. Any address bits which have corresponding mask bits set to 1 represent the network ID. Any address bits that have corresponding mask bits set to 0 represent the node ID.

I get that part but here comes the confusion from subnet mask section(By extending the mask to be 255.255.255.224, you have taken three bits (indicated by "sub") from the original host portion of the address and used them to make subnets. With these three bits, it is possible to create eight subnets. With the remaining five host ID bits, each subnet can have up to 32 host addresses, 30 of which can actually be assigned to a device since host ids of all zeros or all ones are not allowed (it is very important to remember this). So, with this in mind, these subnets have been created.

So it says host id bits of all zeros and all ones are not allowed.but I'm first article on natural mask section it is stated that all 11111111 represent network portion and the all 00000000 represent the host portion or host id.So if 255.255.255.0 is all 1 for network portion and the 0 is for host portion I wonder how is it that all 0 are not allowed for host portion of id bits when the last bits represent host id portion and it's .0.It says host id bits not decimal.Is it written wrong or what's up I'm confused.Please help me to get this.

 

 

 

 

 

 

 

 

 

 

 

 

1 Accepted Solution

Accepted Solutions

Thank you for the additional information. I now have a better understanding of your confusion. The explanation is that the restriction about not permitting all zero or all one applies to the address and does not apply to the mask. In a mask (both the natural mask and a subnet mask) we would expect all 1s in the network part of the mask and expect all 0s in the host part of the mask. In the IP address a network part of all 0s or all 1s can not be used and in the host part of the address all 0s can not be used and all 1s can not be used.

HTH

Rick

View solution in original post

14 Replies 14

balaji.bandi
Hall of Fame
Hall of Fame

i will advise start with Keith Video :

 

https://www.youtube.com/watch?v=Y8ZwmAxnOL0

BB

***** Rate All Helpful Responses *****

How to Ask The Cisco Community for Help

Thank you for your input.I will watch the Video but I dont see how can Video have more Information that cisco detailed description.And I just want to know is there a mistake in the Article or is it my misunderstanding.

 

Here is the link on the matter :

https://www.cisco.com/c/en/us/support/docs/ip/routing-information-protocol-rip/13788-3.html

Cisco documentation have some mistakes and mislead you - i can understand your views. nothing much we can do about it, rather we do due deligency if we think wrong or report to digital team to correct it, where we can.

 

Note : i can not validate that document URL, since not fully reviewed, my comment in general

 

BB

***** Rate All Helpful Responses *****

How to Ask The Cisco Community for Help

So it's a mistake or is it the difference maybe between natural mask and subneted mask somewhere in between but thank you for clearing that I've been cooking my brain for 3 days to find out where's the bunny hiding in wich hole.Thank you for this so maybe somebody will correct it but I doubt cisco would make such an error if they did than they should correct it.

Hi after looking carefully I found some clarification that may help .After looking at the number now I'm getting close to the answer  if 5 bits are in binary 11111 equals to decimal 31 but in cisco article says 32 and when I searched on google how many is 5 bits to computer format it's 32.2 to the power of 5 is 32 right so 1 to the power of 5 is 1 and 0 the power of 5 is 0 so 0 or only one user per network isnt really good thats way it isnt allowed so that may be it what dou think?This is a blast searching after two days now I can sleep in peace.What do you think about my theory on this matter?

 

I remember that when I was just getting started in networking that the concepts of subnetting can be a bit confusing. But if you think about it carefully (and especially when you think about the parts of the address in binary) then it begins to make sense.

So perhaps we can start with this "So if 255.255.255.0 is all 1 for network portion and the 0 is for host portion I wonder how is it that all 0 are not allowed for host portion of id bits" So 255.255.255 says that all of first 3 octets are the network part of the address and 0 says the fourth octet is the host address. So let us focus on the fourth octet in binary and think about some of the values that we might find

0 0 0 0 0 0 0 0 This is the first address. Note that it is all zero and this is not allowed.

0 0 0 0 0 0 0 1 This is the value for decimal 1 and is a valid host address.

0 0 0 0 0 0 1 0 This is the value for decimal 2 and is a valid host address

0 0 0 0 0 0 1 1 This is the value for decimal 3 and is a valid host address

the pattern goes on like that until we get to these addresses

1 1 1 1 1 1 1 0 This is the value for decimal 254 and is a valid host address

1 1 1 1 1 1 1 1 This is the value for decimal 255. Note that it is all 1s and this is not allowed.

You also asked about a mask of 255.255.255.224. You are correct that this takes 3 bits of the fourth octet for subnet address and leaves 5 bits for host address. With 3 bits you are correct that it provides 8 subnets and with 5 bits for host address it provides 32 addresses (only 30 are usable). So let us think about the 5 bits in binary

0 0 0 0 0 is the first address. It is all zero and is not a valid host address. (It is frequently called the subnet address)

0 0 0 0 1 is the next address. It is a valid host address.

0 0 0 1 0 is the next address. It is a valid host address.

and it goes like that up to

1 1 1 1 0 is a valid host address.

1 1 1 1 1 is the last address. It is all 1s and is not a valid host address. (It is frequently called the  broadcast address)

So if you think of the host part of the address, as long as it has some zeros and some 1s it is a valid host address. But if the address is all binary 0 or all binary 1 then it is not a valid host address.

 

HTH

Rick

Richard we meet again.

 

Thank you for the input,maybe my mistake is not being clear enough I know how it works what is bothering me in cisco article description is following.If the 255.255.255.0 represent in binary 24 bits of all binary digits 1 for the network portion and 0 for the host bits portion.But in subnetmask description on cisco article it's stated that all 0 or 1  cannot be used for subnet mask host id bits.If you use default or natural mask it's in binary 11111111.11111111.11111111.00000000 

Table of 128 64 32 16 8 4 2 1 multiplied by 0 is 0 but in subnet mask it cannot be all 0 on natural mask it is 0s.You get my confusion there must be reason why  is it changed or why is it like that I'm trying to find it.Either cisco didn't specify it or I'm not seeing it or there is a mistake.Wich is it? I want to know the difference between natural mask bits can be all 0 but subnetmask cannot.Why?

Thank you for the additional information. I now have a better understanding of your confusion. The explanation is that the restriction about not permitting all zero or all one applies to the address and does not apply to the mask. In a mask (both the natural mask and a subnet mask) we would expect all 1s in the network part of the mask and expect all 0s in the host part of the mask. In the IP address a network part of all 0s or all 1s can not be used and in the host part of the address all 0s can not be used and all 1s can not be used.

HTH

Rick

Richie Im seeing what you are saying.But look it's says clearly in my description of the problem on cisco article.I even linked the article.It says 5 bits from the subnet mask not the ip address part of bits of subnet mask bits.So Richard my question is did cisco made a mistake?Is it maybe the difference between classless and clasfull addresses is it maybe a change in networking that impacted this .So I'm gonna copy and paste the part 

 

In order to see how the mask helps you identify the network and node parts of the address, convert the address and mask to binary numbers.

8.20.15.1 = 00001000.00010100.00001111.00000001
255.0.0.0 = 11111111.00000000.00000000.00000000

Once you have the address and the mask represented in binary, then identification of the network and host ID is easier. Any address bits which have corresponding mask bits set to 1 represent the network ID. Any address bits that have corresponding mask bits set to 0 represent the node ID.

8.20.15.1 = 00001000.00010100.00001111.00000001
255.0.0.0 = 11111111.00000000.00000000.00000000
            -----------------------------------
             net id |      host id             

netid =  00001000 = 8
hostid = 00010100.00001111.00000001 = 20.15.1

 

Understand Subnetting

Subnetting allows you to create multiple logical networks that exist within a single Class A, B, or C network. If you do not subnet, you are only able to use one network from your Class A, B, or C network, which is unrealistic.

Each data link on a network must have a unique network ID, with every node on that link being a member of the same network. If you break a major network (Class A, B, or C) into smaller subnetworks, it allows you to create a network of interconnecting subnetworks. Each data link on this network would then have a unique network/subnetwork ID. Any device, or gateway, that connects n networks/subnetworks has n distinct IP addresses, one for each network / subnetwork that it interconnects.

In order to subnet a network, extend the natural mask with some of the bits from the host ID portion of the address in order to create a subnetwork ID. For example, given a Class C network of 204.17.5.0 which has a natural mask of 255.255.255.0, you can create subnets in this manner:

204.17.5.0 -      11001100.00010001.00000101.00000000
255.255.255.224 - 11111111.11111111.11111111.11100000
                  --------------------------|sub|----

By extending the mask to be 255.255.255.224, you have taken three bits (indicated by "sub") from the original host portion of the address and used them to make subnets. With these three bits, it is possible to create eight subnets. With the remaining five host ID bits, each subnet can have up to 32 host addresses, 30 of which can actually be assigned to a device since host ids of all zeros or all ones are not allowed (it is very important to remember this). So, with this in mind, these subnets have been created.

 

"If you do not subnet, you are only able to use one network from your Class A, B, or C network, which is unrealistic."

BTW, although it's true, with classful addressing, any specific Class A, B or C network is just a single network, but Class C network were often used naturally, i.e. w/o subnetting.

A couple of reasons why Class C networks were used w/o subnetting were such as avoiding discontinuous subnet routing issues or often running into growth/expansion issues when using networks supporting 62 host or less.  Perhaps the biggest reason to subnet a class C were to support a series of p2p links.

Richard thank you now I get it what's happening but to clarify my confusion and your answer that lead me to see the problem it was binary math problem not cisco article.I was wrong.

 

So if natural mask is 255.255.255.0

 

It is in binary following:

11111111.11111111.11111111.00000000

 

Right let's see in subnetmask of 

 

255.255.255.224

I'm binary 11111111.11111111.11111111.11100000

 

So the 3 bits are borowed and know identify the subnet .rest of 5 bits are possible to 32 solutions.0 falls out because its network adress and 1s fall out cause it's gonna be 31 wich should be broadcast adress if I'm not mistaking.So my mistake was thinking that cisco written last 5 host id bits the 5 (00000) in subnetmask binary  can lead to 30 available host addresses in ip address section  but all 11111 and 00000 cannot be implanted. So to clarify this even further.

255.255.255.0

Binary : 

128.64.32.16.8.4.2.1

1. 1.1 1.1.1.1.1

128+64+32+16+8+4+2=255

So oke 255.255.255.0

 

So I know it's 1.1.1.0 So those 1 are network portion and those 0 represent  a host portion in subnetmask.

 

 

So where are the 0 in 255.255.255.224

 

They are there but not shown instead  224 is shown like this 

 

255.255.224

So we know the 1s are 255 what about .224 

 

Binary it's this 

128 64 32 16 8 4 2 1 

1.     1.  1.  0. 0. 0. 0. 0 

 

This 5 zeros make 32 possibilities but 30 can be used for host adress.these 3 bits of 1s they are 224 in decimal but those 5 zero beats still represent host adress.I thought they are washed away.So I misread it says clearly  <With the remaining five host ID bits, each subnet can have up to 32 host addresses, 30 of which can actually be assigned to a device since host ids of all zeros or all ones are not allowed (it is very important to remember this). So, with this in mind, these subnets have been created.>So easy and self explanatory but binary got me confused.

 

 

 

 

 

 

 

Richard You are the man.You solved this one.Gave a good one 

 

 

Thank you for the kind words. I am glad that my explanations have been helpful and glad that now you have a better understanding. 

And thank you for including part of the text of the article. I believe that technically the article is correct (not a mistake) but perhaps the explanation could have been more clear. I have some comments about this:

- Part of what makes this difficult is that it is based on binary math and most of us do not easily think in binary. But understanding this topic does require that we pay careful attention to the binary.

- At one point you seem to be concerned that the 3 subnet bits/5 host bits should provide 32 addresses. But the highest address was 31 and not 32. Most of us humans tend to think if 31 is the highest number that there would be 31 entries (we tend to think of starting at 1 as the lowest number). But in network addressing we start from zero, and so 31 is the highest number but there are 32 entries.

- It is important to keep in mind the differences between mask bits and network/subnet/host bits. Mask bits have one set of rules and network/subnet/host bits have different rules.

- I wonder if part of the confusion of this article was in describing "host ID bits" and I wonder if it would have been easier to understand if they had been called host address bits?

HTH

Rick

Richard I get it the part of 32 because 0 is also included I think that I writen that.Maybe not clearly again.Confusing part was if 0s on the binary of 255.255.255.0 see that decimal 0 on the end I thought when you add all the number in binary like that last 5 bits of 0s in 224 if it's 0+0+0+0+0=0 right binary is different from decimal.And I never used binary before like this.I learned but not used it and forget it.I admit my mistake But get this from my perspective if you just started learning any input from other people will have an impact on how you see the matter, but you are right so is the last part host adrress bits.If I would skip the binary and go straight to o yeah this is easy I'm gonna use calculator subnet to ip.But I don't want to know just how it works I want to understand it all.And if I can't do that then I should quit because it's gonna get harder than that.Im a stubborn man.Richard because people like you who put their time to help people educate people when they need it,world is a better place.

Joseph W. Doherty
Hall of Fame
Hall of Fame

Perhaps first thing to consider, when we talk about borrowing bits, natural masks and or subnets, we may be discussing classful addressing, which can be a bit confusing, especially as most modern networks have moved to classless addressing.

Basically, in binary, as you've already noted, left side bits, all set to 1, indicate the network number or network number and subnet number, while those all set to zero, right side bits, represent the host number (with zero and max host number use for network and network broadcast addresses).

As just noted, when looking at left most set bits, those bits always represent network number, when doing classless addressing, but when doing classful addressing, some of the left most bits will represent the class's network number and, optionally, some may also represent a subnet number.

With a personal background in programming, first time I saw IPv4's dotted decimal, I thought what-the-heck!  Traditionally when working with binary numbers, usually octal or hexadecimal are used (as now does IPv6 with the latter).

Personally, I either convert a dotted decimal to binary, to insure it's what I want, or, overtime, you just learn to memorize common dotted decimal values, e.g. x.x.x.252 for /30 value.

Again, why dotted decimal for IPv4 addresses, that I don't know, but to understand IPv4 addressing, you need to understand the two different ways of using the IPv4 32bit value, i.e. either classful or classless.  Technically, the former has networks with optional subnets (and supernets) and the latter has neither, although in the latter classless networks are often still call subnets.

Review Cisco Networking for a $25 gift card