[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

How does host lookup work

I am extremely confused about host lookup works now that avahi daemon 
has been added into the equation.

my /etc/nsswitch.conf file has this in it for the host entry

hosts:          files mdns4_minimal [NOTFOUND=return] dns mdns4

But as much as I google, I can find absolutely no explanation of what 
mdns4_minimal does.

In particular - if one does a host lookup and its not found in files 
(presumably /etc/hosts) and not found by mdns4_minimal, does 
the "[NOTFOUND=return]" stop the lookup process from using the dns. (It 
clearly doesn't - so presumably mdns4_minimal does something else)

Coupled with that - I am not sure if there is a command line command 
which uses this mechanism of host lookup.  The man page for "host" 
command and the one for the "dig" command effectily say they are only 
doing a dns lookup.

Why am I asking;

I am doing some planning on how to change my home network when I (very 
shortly now) acquire a linux laptop.

I will want to use it to develop some simple javascript/php/html/css web 
applications - and therefore will want to run apache web server.  
Ideally I would like a number of separate virtual hosts, for each 
separate application but

a) When I am disconnected from the network I still need to see the host 
names (so I assume I use /etc/hosts to give aliases to localhost?)
b) When I am connected to the local home network I want to have other 
people see these virtual hosts so that I can test some multiuser 
aspects of the applications.  In this case, I could either use avahi to 
publish these names (although at the moment I can't quite work out 
how - it seems only to publish a single host name derived from 
the /etc/hostname), or make sure the names are properly identified in 
my local dns (I can allocate the IP address based on the mac address of 
the laptop thereby ensuring it always has the same one)

But without understanding the basics, I can't really proceed to plan.

Can someone explain.
Alan Chandler

Reply to: