Look up master node IP address in a loop