Automatically determine which ip version to use