7

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

  • 1
    jodies.de/ipcalc <- tool used for calculation/pretty-print - also in most linux distro repositories – mulaz Oct 7 '13 at 14:25
4

the 1 bits in the address are the network part of the address, this cannot be used for assigning hosts.

In this example, you can use 9 bits for the hosts (minus 2 hosts, reserved for the broadcast and network address).In the /23 you have, you can use:

  • 11000000.10101000.0000110 | 0.00000000 = 192.168.12.0
  • 11000000.10101000.0000110 | 1.11111111 = 192.168.13.255
  • 11111111.11111111.1111111 | 0.00000000 = 255.255.254.0

everything before the "|" is the network area, that cannot be changed in this subnet. Everything after, you can use for your hosts, except the all-0's and all-1's. This is clear if you put the subnetmask under it.

You can calculate everything here (and on other sites): http://www.adminsub.net/ipv4-subnet-calculator/192.168.12.0/23

  • Great link as well, thanks :) . Hmm for CIDR, there isn't such a thing as number of subnets created right ? Number of subnets created only applies for the traditional subnetting based on classes(A/B/C) ? – iridescent Oct 7 '13 at 15:56
  • Network calculators are handy things - it's easy to mess up when getting away from the "standard" numeric ranges. Running a /18 and a /22 here. – Ecnerwal Oct 7 '13 at 20:26
  • 1
    @Ecnerwal yeah idd, I always keep a cheatsheet laying around. Just to be quicker. (packetlife.net/media/library/15/IPv4_Subnetting.pdf) – Bulki Oct 8 '13 at 5:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.