There's no specific program that parses this file.
A number of standard files (e.g.
/etc/hosts) are parsed by standard library files (e.g.
gethostbyname(3)). However the story may be a lot more complicated.
Hostname resolution is typically controlled by an entry in
% grep hosts /etc/nsswitch.conf
hosts: files dns
This entry tells the resolver routines to use the "files" backend, and if the result isn't found there then to do a DNS lookup. Other values could be placed there (e.g.
nis) which can change the way that hostnames are looked up.
These routines are typically called "Naming Services". The same concepts are also used for username lookups (
passwd), group entries (
group) and so on.
So when you do
ping a.remote.host then the
ping program will call a glibc library function, and that will load the routines defined in
nsswitch.conf. The result is you won't see a specific program to do the lookup;
ping does the work itself, via the libary and NS routines.
There's a program called
getent that can be used to do the name searching; you specify a "database" (one of the entries in
nsswitch.conf) and the value you want to search for.
getent hosts a.remote.host
will do a name lookup following the rules defined in
nsswitch.conf. This is useful for testing purposes, and sometimes also in scripts.
--- addendum ----
This information is from Stephen's comment below, but very useful, so I am adding it to his answer.
strace getent hosts www.google.com 2>&1 | grep libnss_
will tell which library (or none) was used to resolve the name. If it says
/etc/hosts was used. If it says
libnss_dns, then DNS was used.
libnss_myhostname means that nothing worked, and a backup GNU system kicked it (and may have failed). If no library is listed, then you probably used a numerical address, like
127.0.0.1, so no resolver was necessary.