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?
abs(ip2-ip1)+1