Re: How does host lookup work



On Monday 23 Mar 2009, Alex Samad wrote:
On Mon, Mar 23, 2009 at 09:28:27PM +0000, Alan Chandler wrote:
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.

its part of libnss-mdns
/usr/share/doc/libnss-mdns/README.Debian
https://bugs.launchpad.net/ubuntu/+source/avahi/+bug/94940 (of
interest)

But neither of these two links explain what mdnd4_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)

I still do not understand [NOTFOUND=return].

My reading of the manual is that it stops a failed lookup moving on to
the subsequent entries. How do the dns entry and the mdns4 entry ever
get used?

[I know the DO get used, so my understanding is obviously WRONG. I want
to find out what the correct interpretation of that is]

...
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?)

sounds good, although there are problems when you use 127.0.0.1

You say problems, what problems?


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)

do the names need to be dynamic, why not make then static such that
when you are not there the web page times out!

I need them to refer to a valid ip address of the laptop - but one that
is also valid when the laptop is disconnected from the network.

So I "think" a plan like this might work

I set up my dbcp server at home to recognise the MAC address(es) of my
laptop and to allocate a fixed ip address [say 192.168.0.26] to the
laptop (this allows me also to connect the laptop to other networks
away from home and obtain an ip address)

My home network is in the .home domain. I then add green.home and
blue.home to my dns server, so any reference by a computer on the home
network to green.home or blue.home get the ipaddress 192.168.0.26

I then add the following lines to /etc/hosts (over and above what debian
adds)

127.0.2.1 green.home green
127.0.3.1 blue.home blue

This ensures that any references in the software internal sees addresses
for green.home and blue.home as the local machine regardless of whether
its connected to the network or not.

In apache, I set up named virtual hosts like this

<virtualhost *:80 >
ServerName green.home
DocumentRoot /home/alan/web-dev/green
</virtualhost>
<virtualhost *:80 >
ServerName blue.home
DocumentRoot /home/alan/wev-dev/blue
</virtualhost>

Tnen when I am not on my home network I can still point my browser at
http://green.home, or http://blue.home to test out my applications

BUT when I am at home and not travelling, I can also point my desktop's
brower at http://green.home or http://blue.home and get it to also see
the web sites.

--
Alan Chandler
http://www.chandlerfamily.org.uk


--
To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx
with a subject of "unsubscribe". Trouble? Contact listmaster@xxxxxxxxxxxxxxxx



Relevant Pages

  • Re: Connecting to two different domains
    ... "Marian Gutu" wrote: ... Plug your laptop on the network. ... I have Active Directory Set-up on my Windows 2003 home server. ...
    (microsoft.public.windowsxp.general)
  • Re: Networking:
    ... Windows XP - Shell/User ... Wireless network with a cheap linksys router giving DHCP ... NO wins server involved. ... | hooking up the next box I am told the laptop will not print. ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: Networking:
    ... Windows XP - Shell/User ... Wireless network with a cheap linksys router giving DHCP ... NO wins server involved. ... | hooking up the next box I am told the laptop will not print. ...
    (microsoft.public.windowsxp.setup_deployment)
  • Re: Networking:
    ... Windows XP - Shell/User ... Wireless network with a cheap linksys router giving DHCP ... NO wins server involved. ... | hooking up the next box I am told the laptop will not print. ...
    (microsoft.public.windowsxp.general)
  • Re: Networking:
    ... Windows XP - Shell/User ... Wireless network with a cheap linksys router giving DHCP ... NO wins server involved. ... | hooking up the next box I am told the laptop will not print. ...
    (microsoft.public.windowsxp.security_admin)