cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2239
Views
5
Helpful
10
Replies

How can 172.16.0.0/16 subnetted as 172.16.0.0/23 = 512 subnets?

a1111
Level 1
Level 1

Hello,

 
Can someone please help me with these subnetting problems?
 
1)
 
Suppose you have the network 172.16.0.0/16. How many subnets do you get if you subnet it to a /23?
 
I'd say you get 2^7=128, because 23-16=7.
 
This calculator agrees with me, and it lists the 128 subnets:
molnarattila1221_1-1679241920800.png

 

 
However, this one says that the "Maximum Subnets" is 512:
molnarattila1221_0-1679241860874.png

 

 
Can someone please explain why it says 512?
 
2)
 
I don't understand why the first calculator says that if I subnet the original /16 network into a /25, I get a single network:
 
Why doesn't it list 2^9=512 subnets? Wouldn't I get 512 subnets if I subnetted 172.16.0.0/16 into 172.16.0.0/25?
 
Thanks.
Attila
1 Accepted Solution

Accepted Solutions

Joseph W. Doherty
Hall of Fame
Hall of Fame

I believe what's happening is for a /16 there can be 128 /23s, but the latter is providing how many subnets a /23 can provide, i.e. 512 /32s.

View solution in original post

10 Replies 10

balaji.bandi
Hall of Fame
Hall of Fame

That may be an issue with the sites.

That should be  - the total number is host 512 - and usable hosts - 510. (if you go with /23 prefix)

BB

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

How to Ask The Cisco Community for Help

Hello. Thank you.

Are you refering to question 1)?

So then it's just a terminological error by the subnet calculator: 2^9=512 IPs, but only 2^9-2=512-2=510 usable host addresses is what it should say, right?

Attila

Joseph W. Doherty
Hall of Fame
Hall of Fame

I believe what's happening is for a /16 there can be 128 /23s, but the latter is providing how many subnets a /23 can provide, i.e. 512 /32s.

Hi,

"the latter is providing how many subnets a /23 can provide" You mean, how many loopback addresses? I don't see how the math adds up to that.

"You mean, how many loopback addresses?"

Sort of.  A /32 can be both network/host address, it's routable.  A loopback in a great example.  You can see them, loopbacks, in the route tables, as /32s.

Hi again,

Thanks. Can a loopback ever be a network, but not a host? My understanding is that with a loopback IP, the only useable host address is also the network address of the /32 subnet. So my answer is no: a loopback is always a host (or more precisely, a host and a network). It's also something similar with a /31, where one of the useable host addresses is also the network address, and the other one is the broadcast address. I'm asking because you wrote "A /32 can be both network/host address," so the word "can" makes me think it's not always the case: it can be both a network/host address, but it can also be only a network, or a host address. Apologies if I'm splitting hairs, I just try to pay attention to every detail not to miss anything. Have a nice evening.

Ha, I had considered bringing up /31s and /32s in my prior posting, but it opens a big "can of worms".  I.e. to well explain the answers to your questions requires a deeper and broader understanding of IP addresses and "networks" than is often taught, or even needed most of the time.

Let's start first with what's an IP network?  Take for example the "networks" 192.168.1.1/24, 192.168.1.1/27, 192.168.1.1/30 and 192.168.1.1/32 vs. the host IP address of 192.168.1.1.  So, again, what's an IP network?

Of course, of these four "networks", the first three would be "interpreted" as 192.168.1.0/24, 192.168.1.0/27, 192.168.1.0/30 as each encompasses more than one IP address, and for them, first encompassed IP address would be zero, for all of them.

One way to consider an IP "network" it's a number that encompasses a range of consecutive IP addresses, on a binary boundary.  All the four forging networks encompass the IP address of 192.168.1.1, agree?

So, any of those four "networks" can be used, in routing tables, to lead to wherever 192.168.1.1 is, also agree?

Yet, 192.168.1.1 is a specific host address, yet that "address" can be encompassed by the "network" 192.168.1.1/32.

We could route just using all /32s, for all specific host IPs, but this doesn't scale, as in theory, every IP router might have to carry a route table with up to 4 billion entries.

The why of "networks" is, we can summarize a block of hosts.  Consider a single /8 "network" can aggregate 24 million hosts IPs.  Actually since a "network" basically summarizes or aggregates a range of IP addresses, we can mix and match.  For example, a /24 could summarize/aggregate 256 IPs or two /25s or a /25 and 128 IPs or . . .  Consider a default route, /0, summarizes/aggregates the whole IP address space. When/where possible, it's "nicer" to handle one /0 "network" rather than 4 billion /32 "networks", agree?

If this is making any sense, perhaps you can now see that a /24 provides 256 IPs (NB: all not usable as host IPs, as I suspect you know) or 256 "networks".  Same for any other prefix size.

Back to /30 vs. /31 vs. /32, there a difference in how we manage these address blocks.  With /1../30, we set aside the first IP to avoid confusion with the "network" (but in theory, with implementations that would support it, it should be able to use that IP for a host IP) and we set aside the last IP for a "broadcast" IP; for /31 we now allow the first IP to be both the network and host IP (an example of using first IP for a host IP is possible), and the last IP to be a host IP (I believe [?] broadcast isn't supported), lastly for a /32, there's no host number, so we use the "network" number for both the network and the host IP.

I hope the above helps.  Again, basic networking often doesn't get into many of the "why" something is done some way.  For example, I wondered why the first IP address in /30 or larger address block, is not usable as a host IP, and one explanation I came across is, way back when, the first IP address was set aside to be used "special", in fact, I recall (???), it might even be uses as a broadcast address.  However, currently, I don't think there's anything really dependent on setting aside the first IP address in a block, beyond we never got around to "releasing" it for host IP usage, except in the case of /31s and/or /32s.

BTW, don't forget, standards groups members are human too.  Consider if you were going to define a standard for what IP should be the first gateway IP for a network address block, to be used, possibly, "forever".  I.e. when you stumble across standards and you wonder WTF, there may be reason you'll never learn, or you'll find it made sense then, but not now, etc.

I.e. that's just the way it is, deal/live with it.  ; )

Hi,

Thanks for the thorough response.

"I wondered why the first IP address in /30 or larger address block, is not usable as a host IP, and one explanation I came across is, way back when, the first IP address was set aside to be used "special", in fact, I recall (???), it might even be uses as a broadcast address.  However, currently, I don't think there's anything really dependent on setting aside the first IP address in a block, beyond we never got around to "releasing" it for host IP usage, except in the case of /31s and/or /32s."

I also wondered about that. Why can't the answer be that if we used the first IP address of a given range, we couldn't distinguish the range itself from the host whose IP address that first address is?

"Why can't the answer be that if we used the first IP address of a given range, we couldn't distinguish the range itself from the host whose IP address that first address is?"

I've seen that answer, but it doesn't usually go further to explain exactly why you cannot distinguish between the two, and /31s and /32s show that IP networking can work using an overlapping first address in the network address block.

Just did a quick Internet search for "why cannot use first network IP address", and see many of the expected, it's not allowed, or will cause routing issues.  Other responses, do go into more detail, such a BSD Unix used it for broadcasts, and even:

I know this is an old thread but I was researching this myself and I didn't stop at "host zero isn't used because it is the network number" because I couldn't see why that mattered. Even if it is the network number it shouldn't stop it being used as a valid address as the mechanism to determine network number (ANDing the netmask) will still work with it to determine the network number.

Not using the all ones host address because it coincides with the broadcast address I was comfortable with, as it is a valid destination address already so when used it would be impossible to distinguish between those.

The more fully explained reason we can't use host zero is that it is also a broadcast address - although RFC1812 section 4.2.3.1 states that a router receiving packets addressed to it "SHOULD silently discard" them (their emphasis - not mine). However the same paragraph does allow those packets to be treated as a broadcast.

Here is the full sub-section

   (2) SHOULD silently discard on receipt (i.e., do not even deliver to
    applications in the router) any packet addressed to 0.0.0.0 or {
    <Network-prefix>, 0 }.  If these packets are not silently
    discarded, they MUST be treated as IP broadcasts (see Section
    [5.3.5]).  There MAY be a configuration option to allow receipt
    of these packets.  This option SHOULD default to discarding
    them.

So, again, technically, believe it could be used, but as other responses also note, some "software" might be confused, or more correctly, enforcing the RFC recommended usage, i.e. discard such IPs (which would preclude having a host using that IP).

I recall (?) /31s have their RFC 3021 overriding expected behavior for using the first host IP within an address block.

IMO, you could update IP RFCs, making using the first host IP okay to use, technically, but for practical reasons, I'm sure it was considered not worthwhile to do so (to reclaim just one host IP).  /31s have a good reason, they double possible p2p networks vs. /30s, and they otherwise couldn't have been used without making an exception for them.  Technically, a /32 doesn't have a host value, another reason why it's a special case.

So to recap, there doesn't appear to be a real need to set aside the first IP in an address block beyond, way back when (when dinosaurs and punched cards existed), broadcasts might have used a host number of zero or all ones for broadcasts, and there was no pressing need to propose a revised standard changing this.

BTW, a similar question, that you can bump into is the question of using subnet zero.  It too has historical causes, which no longer may be important, but as it eliminates whole subnets, vendors, like Cisco, can work with or without it.  Interesting Cisco TechNote.

KJK99
Level 3
Level 3

@a1111 

I think both calculators give correct answers, but they are about different kinds of subnets. The first calculator deals with classful subnets, while the second one with classless ones. The classless subnets are new to me so I can’t explain them. Note that the second calculator is actually called CIDR Calculator. If you look closely at its page, you will find a link to their classful IP Subnet Calculator which will give you the same number of Class B subnets as the first calculator.

I also think that the main purpose of the first calculator is to provide information about the subnet a given IP address is in when it is used with the provided subnet mask. If not specified, this calculator picks up a certain subnet class for you based on the provided subnet mask. The list of possible subnets is just a bonus. If the subnet mask defines a subnet smaller than the class size, the calculator list all possible subnets of that class. If the subnet mask defines a subnet equal to the class size, the calculator does not list any additional subnets.

Kris K
Review Cisco Networking for a $25 gift card