Description of problem: I am running an ethernet eth0 configured with an aliase eth0:0, I have several subnets. I have my name server configured to return results in a particular order. Whenever I use telnet or ssh or anything else that used gethostbyname, it tries to use the wrong ip address first. It tries to use any ip address that may be associated with eth0:0 first. I tried to use sortlist to sort the results of the query but to no avail. If I reconfigure the box and remove alias eth0:0 then then telnet and ssh try the ip addresses in the order that is placed by my name server. Everything ran fine under Fedora Core 1. Version-Release number of selected component (if applicable): How reproducible: Very reproducable Steps to Reproduce: 1. Configure two boxes. configure each box with eth0 and eth0:0 2. Configure eth0 on both boxes with ip addresses on one subnet, and eth0:0 on both boxes with ip addresses on another subnet. 3. Configure a name server to deliver the addresses on box 2 eth0 first, and the address on box 2 eth0:0 second when say, example.redhat.com is looked up. 4. Telnet to box 2 from box 1 and it will try the address on eth0:0 on box 2 first instead of eth0 on box 2. Even if you use sortlist it will insist on using the address on eth0:0 first. Actual results: Expected results: Additional info:
AFAIK sortlist only affects res_gethostbyname* and telnet most likely uses getaddrinfo. Not sure if we want to use it for getaddrinfo and libc gethostby*.
It would be nice if there were an option to turn sorting off though. My queries always came through unsorted in Fedora core 1, but in fedora core 3 they are sorted, and this creates problems for me.
getaddrinfo sorts addresses according to RFC 3484. That's what is supposed to happen and we'll not grow a feature to disable this since any such option will have disastrous results in real world (if addresses outside the local network are used). If you want a specific order, create the subnet the way that it has this order according to RFC 3484.