I have been experimenting with the sortlist directive in /etc/resolv.conf,
something I have not dealt with before. It seems that ssh and telnet are not
affected by the sortlist directive. Do both of those programs use custom
resolver code rather than the system resolver library routines? If you think
you you might know why, any help would be greatly appreciated. What follows is
lots of information about the testing I've done so far. Thanks.
Understanding that /etc/resolv.conf only affects programs which use the
standard system resolver library I decided to write a perl program for testing.
#!/usr/bin/perl
($name,$aliases,$addrtype,$length,@addrs) =
gethostbyname('sortlist.private.ucs.louisiana.edu');
foreach $addr (@addrs) {
($a,$b,$c,$d) = unpack('W4',$addr);
print "$a.$b.$c.$d\n";
}
I also created a host with three addresses in DNS for testing and the DNS
servers are returning them in (seemingly) random order as expected.
$ host sortlist.louisiana.edu
sortlist.louisiana.edu has address 172.20.2.19
sortlist.louisiana.edu has address 172.20.3.18
sortlist.louisiana.edu has address 172.20.0.14
$ host sortlist.louisiana.edu
sortlist.louisiana.edu has address 172.20.3.18
sortlist.louisiana.edu has address 172.20.0.14
sortlist.louisiana.edu has address 172.20.2.19
If I add the following sortlist directive to /etc/resolv.conf
sortlist 172.20.0.0 /255.255.255.0 172.20.2.0 /255.255.255.0 172.20.3.0
/255.255.255.0
my perl program behaves as expected.
$ perl /tmp/sortlist.pl
172.20.0.14
172.20.2.19
172.20.3.18
$ perl /tmp/sortlist.pl
172.20.0.14
172.20.2.19
172.20.3.18
and changing it works
sortlist 172.20.2.0 /255.255.255.0 172.20.3.0 /255.255.255.0 172.20.0.0
/255.255.255.0
$ perl /tmp/sortlist.pl
172.20.2.19
172.20.3.18
172.20.0.14
$ perl /tmp/sortlist.pl
172.20.2.19
172.20.3.18
172.20.0.14
But telnet still behaves as if the sortlist is not there.
$ telnet sortlist.louisiana.edu
Trying 172.20.0.14...
telnet: connect to address 172.20.0.14 : Connection timed out
Trying 172.20.2.19...
telnet: connect to address 172.20.2.19 : Connection timed out
Trying 172.20.3.18...
telnet: connect to address 172.20.3.18 : Connection timed out
$ telnet sortlist.louisiana.edu
Trying 172.20.2.19...
telnet: connect to address 172.20.2.19 : Connection timed out
Trying 172.20.3.18...
telnet: connect to address 172.20.3.18 : Connection timed out
Trying 172.20.0.14...
telnet: connect to address 172.20.0.14 : Connection timed out
$ telnet sortlist.louisiana.edu
Trying 172.20.0.14...
telnet: connect to address 172.20.0.14 : Connection timed out
Trying 172.20.2.19...
telnet: connect to address 172.20.2.19 : Connection timed out
Trying 172.20.3.18...
telnet: connect to address 172.20.3.18 : Connection timed ou t
As does ssh.
$ ssh -v sortlist.louisiana.edu
debug1: Connecting to sortlist.louisiana.edu [ 172.20.3.18 ] port 22.
debug1: connect to address 172.20.3.18 port 22: Connection timed out
debug1: Connecting to sortlist.louisiana.edu [ 172.20.0.14 ] port 22.
debug1: connect to address 172.20.0.14 port 22: Connection timed out
debug1: Connecting to sortlist.louisiana.edu [ 172.20.2.19 ] port 22.
debug1: connect to address 172.20.2.19 port 22: Connection timed out
$ ssh -v sortlist.louisiana.edu
debug1: Connecting to sortlist.louisiana.edu [ 172.20.2.19 ] port 22.
debug1: connect to address 172.20.2.19 port 22: Connection timed out
debug1: Connecting to sortlist.louisiana.edu [ 172.20.3.18 ] port 22.
debug1: connect to address 172.20.3.18 port 22: Connection timed out
debug1: Connecting to sortlist.louisiana.edu [ 172.20.0.14 ] port 22.
debug1: connect to address 172.20.0.14 port 22: Connection timed out
Ping seems to do the right thing although it apparently only tries the first
address returned.
sortlist 172.20.0.0 /255.255.255.0 172.20.2.0 /255.255.255.0 172.20.3.0
/255.255.255.0
$ ping -c 1 -i 1 sortlist.louisiana.edu
PING sortlist.louisiana.edu ( 172.20.0.14 ) 56(84) bytes of data.
sortlist 172.20.2.0 /255.255.255.0 172.20.3.0 /255.255.255.0 172.20.0.0
/255.255.255.0
$ ping -c 1 -i 1 sortlist.louisiana.edu
PING sortlist.louisiana.edu ( 172.20.2.19 ) 56(84) bytes of data.
sortlist 172.20.3.0 /255.255.255.0 172.20.0.0 /255.255.255.0 172.20.2.0
/255.255.255.0
$ ping -c 1 -i 1 sortlist.louisiana.edu
PING sortlist.louisiana.edu ( 172.20.3.18 ) 56(84) bytes of data.
These tests were done on a Fedora 20 host but I have seen the same behavior on
RHEL 5 machines.
Thanks if you stuck with this posting for this long. I would like to explain
the behavior I am seeing. I'm stumped.
--
patrick
Patrick Landry
University of Louisiana at Lafayette
Director, University Computer Support Services
_______________________________________________
Tech mailing list
[email protected]
https://lists.lopsa.org/cgi-bin/mailman/listinfo/tech
This list provided by the League of Professional System Administrators
http://lopsa.org/