Was reading man page of resolv.conf and meet sortlist.

What is the use of it?

Man page shows only list of network\IP addresses after sortlist keyword, not the sorting criterion. How that addresses map to sorting?

Searched material about this question, did not found answer, though.


sortlist is used to move matching IP addresses in DNS responses to the front of the result list with the intention that applications will use them preferentially. It's a bit obsolete though. Nowadays we have better a standard for that, in the form of RFC 3484 (see section 6).

RFC 3484 is much better than the sortlist hack better because:

  • It supports IPv6 [better].
  • It takes source address selection into account.
  • It's not specific to DNS (it's hooked into the libc name service, a layer above).
  • It's a standard.

RFC 3484 style destination address selection is configured in /etc/gai.conf.

  • I read sixth section but still have only vague idea about addresses reordering. General idea is understood but practical examples would be very appreciated. Could you show few example cases of using sortlist option in /etc/resolv.conf? – Bulat M. Dec 25 '16 at 4:49
  • 2
    @BulatM. I wouldn't recommend using sortlist at all today. Back before /etc/gai.conf existed, yes, but not anymore. So any example I could show would be better accomplished using /etc/gai.conf. – Celada Dec 25 '16 at 12:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.