How many IPs are there in /24 CIDR? Read about it here.
To calculate it you need to have information about the address and host address in IP.
www.letusdevops.com
2. Different variations of this questions?
1. How many IPs can be there is /24 CIDR?
2. How many machines can you launch in /24 CIDR?
3. What is a CIDR?
CIDR stands for classless interdomain routing, it is a set of protocols to divide
the ip address in more granular way which helps in overcoming the ip size
limitation by class defined.
4. Any IP has two components
1. Network Address: Defines the network details.
2. Host Address: Define each host details.
IP: network_address+host_address
5. Let's look at /24 CIDR
This mean the first 24 bit of your IP address is the network address bits and these will be fixed. The
remaining bits will tell about the number of different host IPs.
Total network address bit = 24
Total host address bit = 32-24 = 8
Total IPs = 2^8 , Since each bit can have value 0 or 1.
6. Lets formulaize it
If you are given /x CIDR. First x bits are fixed and it defines the network address.
Host address bits = 32 - x
Total hosts address that can be generated = 2^(32-x)
7. Reserved IPs
There are two reserved IPs for any CIDR.
1. Broadcast IP which is the last IP
2. First IP which actually is network address.
These two IPs cannot be assigned to any machines and are reserved for special purpose.
So you answer now becomes 2^(32-x) -2 for /x cidr