Order the IPs and names return from dns.

This patch will fix unnecessary restart of the service because configuration
getting invalid because of the order of IPs configured.