Similar to using ping to query /etc/hosts for name resolution, is there another utility that uses /etc/nsswitch.conf?
Optionally, this works:
As best as I can tell, getent is only reading the file and matching. If it uses gethostbyname(3)() then that would be dandy, but I do not think that it does.
And whilst we are on the subject of /etc/hosts, does anyone know why the uncommented example has the alias *before* the FQDN:
whereas the "Imaginary network" format is FQDN followed by the alias?
Code:
$ ping john
PING john (10.10.10.10): 56 data bytes
^C
--- john ping statistics ---
3 packets transmitted, 0 packets received, 100.0% packet loss
Optionally, this works:
Code:
$ getent hosts john
10.10.10.10 john john.blue.com
As best as I can tell, getent is only reading the file and matching. If it uses gethostbyname(3)() then that would be dandy, but I do not think that it does.
And whilst we are on the subject of /etc/hosts, does anyone know why the uncommented example has the alias *before* the FQDN:
Code:
::1 localhost localhost.my.domain
127.0.0.1 localhost localhost.my.domain
Code:
# Imaginary network.
#10.0.0.2 myname.my.domain myname
#10.0.0.3 myfriend.my.domain myfriend