Address: 192.168.12.0 11000000.10101000.0000110 0.00000000
Netmask: 255.255.254.0 = 23 11111111.11111111.1111111 0.00000000
Network: 192.168.12.0/23 11000000.10101000.0000110 0.00000000
HostMin: 192.168.12.1 11000000.10101000.0000110 0.00000001
HostMax: 192.168.13.254 11000000.10101000.0000110 1.11111110
Broadcast: 192.168.13.255 11000000.10101000.0000110 1.11111111
Hosts/Net: 510 Class C, Private Internet
Here you go. First you take the network id (192.168.12.0), and the mask (23) says the first 23 bits are static, and the remaining 9 bits are used in your network.
So in your case:
11000000.10101000.0000110 0.00000000
First 23 bits are to here^
Remaining 9 bits go from all zeros to all ones
If you write the IP back to decimal form, you get IPs from 192.168.12.0 (last 9 bits are zeros), to 192.168.13.255 (last 9 bits are all ones). First 23 bits are unchanged.
Since 9 bits are used for host IPs, thats 2^9 = 512 IPs (minus one for network ID and minus one for the broadcast address = 510 usable IPs).
Subnetting will always be a "2n" bit-wise operation. Subnets fall on specific bit boundaries, no matter what. You can't subnet on arbitrary boundaries or addresses. Just think, "always equal proportions." Not any different than cutting a pie into equal proportions.
I always use a /24 as a "base" to start from. Again, this is a 2n (ie multiply or divide by 2) operation, so you go from a single subnet, to two halves, or four quarters, or eighths, sixteenths, etc.
If you split a /24 into two halves, each one of those halves will be a /25 subnet.
If you split a /24 into four quarters, each one of those quarters is a /26 subnet.
If you split a /24 into eighths, each eighth is a /27 subnet.
The converse is true when going in the opposite direction.
If you combine two /24's into a single subnet, you end up with a /23.
If you combine four /24's into a single subnet, you end up with a /22.
If you combine eight /24's into a single subnet, you end up with a /21.
To answer your question, if you split 10.10.16.0/24 into two equal-sized subnets, you end up with:
1. 10.10.16.0/25
2. 10.10.16.128/25
The first and last usable from each subnet would be:
1. 10.10.16.1/25 and 10.10.16.126/25
2. 10.10.16.129/25 and 10.10.16.254/25
Hope this helps.
Best Answer
Your "question" is actually a series of questions. For future reference, try to avoid this. :-) However, this question is a good one, and I think is an easy enough mistake to make by newcomers to the field, so I'll do my best to answer. Truth be told, your source of confusion has nothing to do with subnetting and everything to do with the
show ip route
output itself (and understandably so).First things first - classful addressing and routing has been dead a long time. I understand that it's still part of networking curriculums though, so do yourself a favor and forget everything classful as soon as you're done with your coursework. IMO, still forcing people to learn about these topics only serves to confuse.
Secondly, the prefix length (subnet mask) has nothing to do with the class of the address. See this answer for more information on how classful addressing actually works (and for a hint at the answer to your very last question).
Like I said before, this has nothing to do with subnetting and everything to do with the structure of the output of
show ip route
.Way back when, when IOS first came around, there was classful addressing and routing, as you're being taught currently. The structure of the routing table back then was designed with classful routing in mind, and was hierarchical and had (and still has) many levels. When classless addressing and routing came around, the hierarchical structure of the routing table still worked, so it really hasn't changed much.
Ultimately the real answer lies in a textbook (one of my favorites) called Cisco IP Routing by Alex Zinin. Quote below, emphasis mine:
So in other words,
show ip route
output can be somewhat misleading given the right circumstances. Relating back to your output, the major network boundary or classful boundary for the 172.16.1.0/24 subnet is 172.16.0.0. Since all of your subnets of 172.16.0.0 have a /24 length, theshow ip route
output is really just telling you that it knows about the 172.16.0.0 classful network, and all of the subnetworks that it knows about for this major network have the same length, and that is /24.Try adding a network to the routing table that's part of 172.16.0.0 and which has a "non-classful" length, such as a /27 or /25. What happens?
Again, I'll urge you to read the previous answer which I'd linked, if this isn't already clear at this point. :-)
EDIT: To answer some further questions OP has in comments:
It basically is an old way to look at subnetting. Determining the class of address is not needed to determine the number of subnets and hosts per subnet available. The question is worded poorly, and in the real world no one is going to be "assigned" an arbitrary prefix without a length attached to it, ie 4.0.0.0. You could easily find a different answer given the parameters of a /24 prefix length to be used for subnetting if they had given you any prefix length that was shorter than a /24, it doesn't necessarily have to be /8. It's likely that the exercise was worded in such a way to force the reader to remember the classes of addresses in order to answer it correctly.
Yes. Again, the internal structure of the routing table really hasn't changed since the days of classful routing. Anything that's viewed as a subnet of a classful network is going to be viewed as a subnet by the router.
No, it isn't. Determining your major network or classful network boundary has nothing to do with subnetting or supernetting. It really isn't complicated.
Here's three examples of IP addresses with varying mask lengths:
For #1:
The address is Class A because the first octet is 115, and this falls within the range of numbers that have a leading bit of
0
(0 to 127). The natural mask for Class A networks is 255.0.0.0. So the classful network boundary is 115.0.0.0/8.For #2:
The address is Class C because the first octet is 200, and this falls within the range of numbers that have leading bits of
110
(192 to 223). The natural mask for Class C networks is 255.255.255.0. So the classful network boundary is 200.200.200.0/24.For #3:
The address is Class B because the first octet is 188, and this falls within the range of numbers that have leading bits of
10
(128 to 191). The natural mask for Class B networks is 255.255.0.0. So the classful network boundary is 188.154.0.0/16.This is how the router is able to determine the classful network boundary of any subnet.