The following function determine all possibilities and return the values in a comma separated format (ip, ip, etc.).
It has also an optional validation function as (first parameter that disabled by default) to validate the IP address against (private range and reserved range).