I found the cause of why I am seeing these anomalies but it is indicative of another problem (bug?) Because I am doing some experimentation and running OpenSuSE in a couple of different configurations I had changed /etc/hosts so that it was a link to another file instead of just a straightforward file in /etc. My guess is that the libraries, which are designed to resolve host names and IP addresses, using the /etc/hosts file are not capable of following links? Once I removed the link and replaced it with the actual file things worked pretty much as expected (except for the lookup of localhost which is still returning an IPv6 address instead of an IPv4 address as I was expecting) So is this a bug? If not shouldn't there at least be a warning/error message that is helpful to unsuspecting users such as myself? This was really hard to track down! Marc. On 10/30/2018 02:32 PM, Marc Chamberlin wrote:
I am running OpenSuSE Leap 42.3 on a machine with 2 NICs. I am also running a Bind DNS server on the same system. I did an experiment in order to assign a unique hostname to each of the NIC interface cards by simply editing my /etc/hosts file as shown below: (sorry, I am not sure how to format this for a newsgroup.)
bigbang:/etc # cat /etc/hosts
127.0.0.1 localhost # added for each nic 192.168.10.100 bigbangInternal.mydomainname.com bigbangInternal 10.10.10.100 bigbangExternal.mydomainname.com bigbangExternal
::1 localhost ipv6-localhost ipv6-loopback fe00::0 ipv6-localnet ff00::0 ipv6-mcastprefix ff02::1 ipv6-allnodes ff02::2 ipv6-allrouters ff02::3 ipv6-allhosts
My host.conf file is configured to look at the hosts file first when resolving names:
bigbang:/etc # cat /etc/host.conf
## file comments deleted for brevity...
order hosts, bind multi on
My nsswitch.conf file is also configured to look at the hosts file first when resolving names:
bigbang:/etc # cat /etc/nsswitch.conf
## file comments deleted for brevity...
passwd: compat group: compat
hosts: files mdns_minimal [NOTFOUND=return] dns networks: files dns
services: files protocols: files rpc: files ethers: files netmasks: files netgroup: files nis publickey: files
bootparams: files automount: files nis aliases: files
After editing the /etc/hosts file I flushed the name service cache:
bigbang:/etc # systemctl restart nscd.service
and when I test things out I get the following "surprising" results which appear at first glance to show that the name resolving order specified in nsswitch.conf is not being honored. But something else even deeper is going on as well that really has me baffled:
bigbang:/etc # ping bigbangInternal ping: unknown host bigbangInternal
??? I didn't expect that!
bigbang:/etc # getent hosts 127.0.0.1 localhost 192.168.10.100 bigbangInternal.mydomainname.com bigbangInternal 10.10.10.100 bigbangExternal.mydomainname.com bigbangExternal
that looks good...
bigbang:/etc # getent hosts localhost ::1 localhost
??? I am a bit surprised by this as I did not enable IPv6 addresses in YaST
bigbang:/etc # getent hosts bigbangInternal bigbang:/etc # getent hosts bigbangInternal.mydomainname.com
??? no response! why not?
bigbang:/etc # getent hosts 10.10.10.100 10.10.10.100 mydomainname.com
??? huh? Why did I get my dns domain name?
bigbang:/etc # getent hosts 192.168.10.100
??? no response!
My guess is that these attempts to resolve these names and ip addresses is being done by my bind dns server and not by looking things up in the /etc/hosts file. But I don't understand why given that I am specifying that the order of lookup is to be done first via the /etc/hosts file and then by the bind dns server if the lookup in the hosts file fails. What am I missing and/or not understanding?
Thanks in advance for any guidance/clues as to why I am seeing these results.
Marc...
-- Linux Counter -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org