For example: given subnet 10.10.0.0/16 , if I have to find 1000th ip of given subnet range?
-
You can use 1 to 255, so 256+256+256+256 = 1024, we then need to subtract 24 - So 10.10.3.232 is the 1000th IP address.. (because 256+256+256+256 = 10.10.4.0 minus 24 = 10.10.3.232) – CustomX Aug 02 '18 at 09:52
3 Answers
So you can have total available IP address equal to 2^16 = 65536 (considering 16 bits available). Now, to find your 1000 IP address, you can use your 10 least significant bits. So it would be like 10.10.00000011.11101000/16 that would be equal to 10.10.3.232/16.
- 292
- 1
- 9
Convert the ip address to binary:
00001010.00001010.00000000.00000000
Convert the mask to binary:
11111111.11111111.00000000.00000000
(The first 16 bits are masked. This gives us the last 16 bits for addresses.)
The first address 10.10.0.0 will be the subnet address
The first 255 addresses will be 10.10.0.1 - 10.10.0.255
The second 256 addresses will be 10.0.1.0 - 10.10.1.255 etc.
So armed with this knowledge:
- 1000 divided by 256 (0 - 255 addresses) = 3 (number for third octlet so 10.10.3.XXX)
- 256 * 3 = 768 (we get 768 address from the first three iterations) subtract 1 = 767 (the first address 10.10.3.0 is used as the subnet address and cannot be assigned to a host)
- 1000 - 767 = 233 (so we need 233 from the last iteration) gives us 10.0.3.233
Answer in CIDR notation = 10.10.3.233/16 (the 1000th IP address that a host can be assigned)
- 71
- 5
by seeing subnet itself we can make out the first address of the subnet is 10.10.0.1 to 10.10.255.255.
since the mask is /16 last two octet can change and each octet can have value from 0-255 i.e., 256 possibility.
so if I want to find the 1000th ip ,then fourth octet = 1000%256(remainder)
third octet = 100/256(quotient)
in our case, fourth octet = 253
third octet = 3
so 100th will be "10.10.3.232".
correct me if i'm wrong.Thanks
- 21
- 1
- 8