Validate IP address first