"Nesting" (overlapping networks) requires proxy-arp and therefore SHOULD be avoided at all costs. No enterprise router will allow such a broken configuration -- each interface/subnet must be completely independent, which means out in the real world, where real IP addresses are routed, this method of "conservation" cannot be used. (aka: nonsense) [*]
It SHOULD not be attempted by anyone not thoroughly versed in networking. (i.e. if you haven't been designing, setting up, and maintaining large, complex networks for a decade or more, you shouldn't even be talking about this type of damage.)
(Full disclosure)
I'm doing this exact thing in an OpenStack development environment right now. 192.168.xx.0/24 has a /29 behind one of the machines in the larger /24. That machine has to have a number of specific, non-default setting changed to pretend to be hosts within the /29 slice. (aka proxy-arp) Yes, I can add a route for the /29 on the router, but the machines in the /24 still won't be able to talk to the /29 because their larger netmask means they're link-local; I'd have to add that /29 route to all the machines in the /24 for them to work.
All-0 and All-1
Those concepts haven't had any tangible meaning in modern networking for decades. Nothing you're likely to run into on the internet makes any assumptions about network size -- everything is classless now. Yes, there used to be issues using an all-0 (or 1) subnet -- say 199.72.0.0/24 (the first subnet from 199.72.0.0/16) (true story) -- because some random system on the internet (AIX) applied class logic to the range. Nothing does that today. So, with 199.72.0.0/16, the address range is 0.0 to 255.255 -- with the those too addresses being the /16's network and broadcast addresses. Those are always the /16's network and broadcast, even if a /24 were nested with it somewhere.
The active netmask ALWAYS defines the network and broadcast. Yes, that means a nested construct has multiple broadcast addresses, but due to different netmasks, nodes within different zones (sub-network, parent-network, ...) listen to different addresses. At layer-2 (ethernet), all hosts in the same domain (eg. vlan) see the same broadcasts but the host will filter out, at layer-3, the "foreign" broadcasts, unless they're sent to the "all nodes" broadcast address of 255.255.255.255.
[*] ISPs wanting to conserve space like this do it via bridging, but that has it's own problems.
[*] I warned my idiot ("we know more than you") coworkers not to use 199.72.0.0/24, but they did it anyway -- putting the webdev desktops in 0.0/25. A day later came the "What. Did. I. Tell. You." after complaints from every single person about random places on the internet they simply couldn't get. That was in 1997.
First, network classes are dead, killed in 1993 by RFCs 1517, 1518, and 1519, which defined CIDR (Classless Inter-Domain Routing). Later RFCs have further deprecated network classes. Modern networking doesn't use network classes, and you should only worry about them from a historical perspective.
IPv4 network classes were defined by the first few bits of the address, and IPv6 never had network classes. The latest RFC of which I know that defines network classes is RFC 1166, Internet Numbers*, which obsoleted the previous RFCs for network classes.
Class | Address starts with | Mask length
A | First bit is `0` | 8 bits
B | First two bits are `10` | 16 bits
C | First three bits are `110` | 24 bits
D | First four bits are `1110` | N/A
E | First four bits are `1111` | N/A
The network classes had specific mask lengths, but could be subnetted to longer mask lengths within a specific classful network. Unfortunately, many people confuse the network mask with the network class, and many of them will argue to the death that any /24
network is a Class C network, but that is not the definition of a network class.
So is IP address of 172.168.10/28 a Class B or Class C?
Actually, neither. The address 172.168.10/28
is actually an invalid IPv4 address. I will assume you meant 172.168.10.0/28
, which used to be a subnet of the 172.168.0.0/16
Class B network.
Today, trying to classify an address by network class is a pointless exercise because there is no longer any such thing.
*Copied from the RFC.
The first type of address, or class A, has a 7-bit network number and
a 24-bit local address. The highest-order bit is set to 0. This allows
128 class A networks.
1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|0| NETWORK | Local Address |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Class A Address
The second type of address, class B, has a 14-bit network number and a
16-bit local address. The two highest-order bits are set to 1-0. This
allows 16,384 class B networks.
1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|1 0| NETWORK | Local Address |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Class B Address
The third type of address, class C, has a 21-bit network number and a
8-bit local address. The three highest-order bits are set to 1-1-0.
This allows 2,097,152 class C networks.
1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|1 1 0| NETWORK | Local Address |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Class C Address
The fourth type of address, class D, is used as a multicast address
[13]. The four highest-order bits are set to 1-1-1-0.
1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|1 1 1 0| multicast address |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Class D Address
Note: No addresses are allowed with the four highest-order bits set to
1-1-1-1. These addresses, called "class E", are reserved.
Best Answer
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:
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).