Subnetting aggregation

ipv4subnet

I saw this example online .

192.168.12.0/23
applies the network mask 255.255.254.0 to the 192.168 network, starting at 192.168.12.0. This notation represents the address range 192.168.12.0 – 192.168.13.255.

How do I obtain the applicable address range ?

Here's my understanding (most likely flawed) of the 192.168.12.0/23 CIDR IP address :

  1. /23 written in bits is 11111111.11111111.11111110.00000000 .
  2. Therefore, it "borrowed" 7 bits from the host field.
  3. 2^7 = 128 subnets being created.
  4. 2^1 = Each subnet has a maximum of 2 hosts.
  5. There are 128 possible network IDs, possible ones are 192.168.0.0, 192.168.170.0
    192.168.254.0.
  6. The range of ip addresses are from 192.168.0.0 to 192.168.254.0 ?

Best Answer

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).