Using public_ips and private_ips, Find and use the first valid IP.