10.4 Name Server Address Sorting
When you are contacting a host that has multiple network interfaces, using a particular interface may give you better performance. If the multihomed host is local and shares a network (or subnet) with your host, one of the multihomed host's addresses is "closer."
Suppose you have an FTP server on two networks, cleverly called network A and network B, and hosts on both networks access the server often. Hosts on network A will experience better performance if they use the host's interface to network A. Likewise, hosts on network B would benefit from using the host's interface to network B as the address for their FTP client.
In Chapter 4, we mentioned that the Microsoft DNS Server returns all the addresses for a multihomed host. There was no guarantee of the order in which the DNS server would return the addresses, so we assigned aliases ( wh249 and wh253 for wormhole ) to the individual interfaces. If one interface is preferable, you (or more realistically , a DNS client) can use an appropriate alias to get the correct address. You can use aliases to choose the "closer" interface but, because of address sorting, they are not always necessary.
The Microsoft DNS Server sorts addresses by default. The server compares the IP address of the querier with the IP addresses of A records in a pending response. It moves those records with the same network as the querier to the top of the list in the response. This comparison is based on the class of network from which each IP address originates. For Class A networks, only the first octet is compared. For Class B networks, the first two octets are compared, and for Class C networks, the first three octets are significant in the comparison. (Nowadays the whole notion of IP network classes is mostly meaningless, having been made obsolete by Classless Inter-Domain Routing, or CIDR. For more information on IP addressing, see Appendix B of O'Reilly's Internet Core Protocols: The Definitive Guide by Eric Hall.)
In Figure 10-8, assume that a Microsoft DNS Server is running on notorious . When spellbound sends a query to notorious looking up the addresses of notorious , it gets back an answer with notorious 's network A address first. When charade looks up the addresses of notorious , it gets back an answer with notorious 's network B address first. In both cases, the name server sorts the addresses in the response based on its comparison of the querier's address with the addresses in the response.
Figure 10-8. Communicating with a local multihomed host
There's a small catch with the DNS server's address sorting: it disables round robin (see Section 10.8.3 later in this chapter). In the Microsoft DNS Server, address sorting is enabled by default and round robin is disabled. If you want round robin and can live without address sorting ( unfortunately , they're mutually exclusive), you can disable address sorting with the LocalNetPriority registry setting. Set it to zero to disable address sorting and enable round robin. Note, though, that this value doesn't exist in the Registry by default. You need to add it before you can change its value to zero.