If u have IP in the form 123.456.789 u can parse it into 3 parts and compare each of those ranges.
For example if the first range '123' is not within ur list then the other 2 will be invalid.
If the first is in the range but the 2nd one isn't, then the last range is invalid to check...