Description of problem: search order defined in /etc/hosts.conf not respected. default /etc/hosts.conf: order hosts,bind this should look in /etc/hosts file to resolve before going against bind, but this is not the case. It searches dns server first. Version-Release number of selected component (if applicable): How reproducible: always reproducible Steps to Reproduce: 1. add entry in /etc/hosts like: 192.168.1.1 foo.openbx.net foo 2. run `host foo' Actual results: [root@gateway etc]# host foo Host foo not found: 3(NXDOMAIN) Expected results: the ip address (192.168.1.1) of foo as defined in /etc/host Additional info:
The file is : /etc/host.conf ^ not /etc/hosts.conf ^ Actually, contrary to the resolver(3) man-page, host.conf is defunct - its contents have no effect . (This may or may not be a glibc bug). Only /etc/nsswitch.conf sets the search order - see nsswitch.conf(5). However, the BIND host utility ONLY queries the DNS; it does, unlike dig, use the 'search' list from /etc/resolv.conf, but DOES NOT use /etc/host.conf nor /etc/nsswitch.conf . It appears there is NO command-line utility to query a host using gethostbyname(3). So I've appended the test utility I use to this bug: $ gcc -o lookup lookup.c $ lookup localhost # uses 'gethostbyname' $ lookup -d localhost # uses 'getaddrinfo' - includes all RRs
Created attachment 109350 [details] lookup.c