Check if the argument is a valid IP or network