How can I work out how many IP addresses there are in a given range?
Posted
by
Jarede
on Programmers
See other posts from Programmers
or by Jarede
Published on 2014-05-29T11:54:07Z
Indexed on
2014/05/29
15:52 UTC
Read the original article
Hit count: 257
networking
|networks
I'm wondering if there is a formula to work out the amount of IP addresses in a given range.
I have a system that takes either a single IP address or a start and and end IP address:
- A single one might be:
145.16.23.241
- A range might be:
145.16.23.122 - 145.16.23.144
The people inputting these aren't technical, nor are they receiving these details from technical people, so suggesting using CIDR notation isn't an answer for me.
I want to be able to highlight that when entering a range such as: 122.100.10.12 - 128.10.200.140
it might not actually be a range and rather 2 singular IP addresses since such a range would comprise of x
(large number of) IP addresses.
Is there a basic formula to help me highlight this?
© Programmers or respective owner