Validates if a value is an IP address.