9.5.1 Problem
You want to configure a resolver to sort addresses on certain networks to the front of responses that include multiple A records.
9.5.2 Solution
For a BIND 4.9 or later resolver, add a sortlist directive to resolv.conf, telling the resolver which networks to prefer. The arguments to the sortlist directive are either network numbers or network and netmask pairs, separated by a slash ("/"). If you specify just a network number, the resolver assumes you mean the whole class A, B, or C network, as determined by the first two bits of the network. For example, given this sortlist directive, the resolver will sort addresses on the network 128.32/16 to the beginning of the list of addresses that it passes back to applications:
sortlist 128.32.0.0
If you specify a network and a netmask, use dotted-octet quantities for both. For example:
sortlist 10.1.0.0/255.255.0.0
Some Windows operating systems, including Windows NT 4.0 after Service Pack 4 and Windows 2000, also include resolvers that sort addresses, though the function isn't particularly configurable. When these resolvers share a subnet with the name server they query, they sort addresses on that subnet to the front of responses they return to applications.
You can turn address sorting off with these resolvers by setting the value of the following Registry key to zero:
HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesTcpipParameters PrioritizeRecordData
9.5.3 Discussion
Since most applications simple-mindedly use the first address returned before the rest, this configuration induces many applications to prefer addresses in the sortlist. Note, however, that in some cases the sortlist can also prevent round robin from working, since the resolver may sort responses that include matching addresses.
9.5.4 See Also
"The sortlist directive" in Chapter 6 of DNS and BIND; "Subnet Prioritization" in Chapter 6 of DNS on Windows 2000.
Getting Started
Zone Data
BIND Name Server Configuration
Electronic Mail
BIND Name Server Operations
Delegation and Registration
Security
Interoperability and Upgrading
Resolvers and Programming
Logging and Troubleshooting
IPv6