Subnetting Classless Addresses
xkaijinx
Member Posts: 90 ■■□□□□□□□□
in CCNA & CCENT
I'm solid on subnetting classful addresses. When I hit classless addresses I get screwed up pretty bad. Take the following question..
Question: What is the last valid host on the
subnetwork 172.22.16.0/20?
Answer: 172.22.31.254
We have 20 network bits and 12 host bits. 12^2 = 4096 -2.... We have 4094 hosts to use for this. That part is ok.
Since we have network hosts in the third octet I think we subnet starting in the 4th octet?
How would you solve this? Thanks
Question: What is the last valid host on the
subnetwork 172.22.16.0/20?
Answer: 172.22.31.254
We have 20 network bits and 12 host bits. 12^2 = 4096 -2.... We have 4094 hosts to use for this. That part is ok.
Since we have network hosts in the third octet I think we subnet starting in the 4th octet?
How would you solve this? Thanks
Comments
-
networker050184 Mod Posts: 11,962 ModThe third octet is shared between network and host bits so you start there.An expert is a man who has made all the mistakes which can be made.
-
xkaijinx Member Posts: 90 ■■□□□□□□□□So starting in the third octet we have 4 network bits to use so it would increment by 16. This would start as..
172.22.0.0
172.22.16.0
172.22.32.0
172.22.48.0
172.22.64.0
If that is correct, how do we than get to have 172.22.31.254 ? -
boredgamelad Member Posts: 365 ■■■■□□□□□□You subnet starting where the network bits end. I find it's easiest to break this down into binary so let's pretend we don't know that's a subnet ID and work through it:
10101100.00010110.00010000.00000000 <-- Given IP address
AND (binary AND)
11111111.11111111.11110000.00000000 <-- Mask
=
10101100.00010110.00010000.00000000 <-- Subnet ID.
So we have our subnet ID. The network portion isn't going to change for the rest of the exercise, so I'm putting it in bold to make sure it doesn't get modified. It's also easier to visualize the boundary between the network portion and host portion of the IP address.
10101100.00010110.00010000.00000000 (172.22.16.0)
The first usable host is the subnet address + 1:
10101100.00010110.00010000.00000001 (172.22.16.1 -first usable host)
The next usable hosts are:
10101100.00010110.00010000.00000010 (172.22.16.2)
10101100.00010110.00010000.00000011 (172.22.16.3)
etc.
This continues until all the numbers in the host portion are ones:
10101100.00010110.00011111.11111111 (172.22.31.255 --broadcast ID)
This is the highest we can go without changing the network ID. That makes this our broadcast ID (note: all 1s in the host portion).
And since we know our broadcast ID is 172.22.31.255, simply decrement the fourth octet by one to arrive at the last usable host:
10101100.00010110.00011111.11111110 (172.22.31.254 - last usable host)
To summarize:
Subnet ID: 172.22.16.0
First Usable: 172.22.16.1
Last Usable: 172.22.31.254
Broadcast: 172.22.31.255
Of course, once you understand the fundamentals this stuff can be done largely in your head. But when you're starting out, I'm a very strong advocate for writing out your binary step-by-step. -
networker050184 Mod Posts: 11,962 ModBecause 172.22.32.0 would be the next network so 172.22.31.254 would be the last usable host in this 172.22.16.0/20 network.An expert is a man who has made all the mistakes which can be made.
-
theodoxa Member Posts: 1,340 ■■■■□□□□□□I will frequently just use the nearest classfull and work back from there. In this case, I would use /16, then count out
1 (/16)
2 (/17)
4 (/1
8 (/19)
16 (/20)
A /20 would increment the 3rd octet by 16 for each subnet. 172.22.0.0, 172.22.16.0, 172.22.32.0, etc...You can also count backwards like so...
1 (/24)
2 (/23)
4 (/22)
8 (/21)
16 (/20)R&S: CCENT → CCNA → CCNP → CCIE [ ]
Security: CCNA [ ]
Virtualization: VCA-DCV [ ] -
theodoxa Member Posts: 1,340 ■■■■□□□□□□The first address in the range is the network/subnet ID and the last address in the range is the broadcast address. You can't assign either of these addresses to a host.R&S: CCENT → CCNA → CCNP → CCIE [ ]
Security: CCNA [ ]
Virtualization: VCA-DCV [ ]