Ankur Chauhan
Ankur Chauhan

Reputation: 1390

How do browsers handle a multiple IP response for a single hostname from DNS?

I want to know how this is handles or if there is a standard?

Upvotes: 6

Views: 5869

Answers (2)

Daniel Vassallo
Daniel Vassallo

Reputation: 344311

Browsers cache DNS Responses for a few minutes and typically attempt a connection with the first IP address returned in the DNS response. The same IP is used until the cache expires.

Internet Explorer caches DNS lookups for 30 minutes by default, as specified by the DnsCacheTimeout registry setting. Firefox caches DNS lookups for 1 minute, controlled by the network.dnsCacheExpiration configuration setting.

From: Yahoo Dev Network: Best Practices for Speeding Up Your Web Site

Therefore for multiple IP addresses to be used for load-balancing purposes, the DNS server must change the order of the addresses supplied in the response, choosing the order randomly or in a sequential "round robin" fashion. In fact, this is usually the default behaviour of DNS servers when they respond to hostnames with multiple A records.

There is no standard procedure for deciding which address will be used by the requesting application - a few resolvers attempt to re-order the list to give priority to numerically "closer" networks. Some desktop clients do try alternate addresses after a connection timeout of 30-45 seconds.

From: Wikipedia: Round robin DNS

Upvotes: 5

nos
nos

Reputation: 229108

Generally they iterate through the responses and use the first one they can connect to.

Upvotes: 0

Related Questions