[CentOS] How to make nodes in my local LAN see each other's names

Wed Nov 30 13:54:04 UTC 2011
Timothy Madden <terminatorul at gmail.com>

On 29.11.2011 20:00, Craig White wrote:
> On Nov 29, 2011, at 9:14 AM, Timothy Madden wrote:
>> Hello
>> Sorry for the (I guess) simple question, but:
>> I have 7 computers under one 8-port router (D-Link DIR-100, firmware
>> v1.13EU) in my network (actually in a sub-network) and they do not see
>> each other's host names.
>> The router has the 'DNS relay' option enabled, and all 7 computers use
>> the router as the DNS server, which in turn will forward DNS requests to
>> the ISP DNS server. That way I can understand that simple, plain,
>> default DNS is not enough for my boxes to see each-other's names.
>> Windows has a nice (or not) way to resolve the problem: CIFS (Samba)
>> server names are automatically included in the name resolving procedure.
>> I know I can do the same with my CentOS boxes if I install samba on each
>> of them and add 'wins' to the 'hosts: ' line in /etc/nsswitch.conf, but
>> somehow I think installing cifs on every node just to get my local
>> machine names to resolve properly to the IP addresses is not the right
>> way to solve my problem ...
>> What is the way to have all computers in my simple network know each
>> other by name ?
>> Is it possible to have the name resolving procedure used by the system
>> automatically recognize a new machine added to my network, when I try to
>> access it with right host name, like WINS can ?
>> Also, I hear Linux does not have, by default, a cache of resolved names
>> (like Windows does), and I find that to be a sad thing. Why should the
>> default be set so that I contact the ISP DNS server for each and every
>> web page I hit ?
>> Is there an easy way to install a caching name server on my each
>> machine, and make sure my system is using /that server/ to resolve names ?
> ----
> just to clarify some things...
> NETBIOS is a rather chatty (ie, noisy/traffic generating) for a local subnet. Yes, this can be a convenient way of being able to refer to a computer by its name and the price you pay for that convenience is a fair amount of broadcast traffic by all computers that support this protocol (Windows, Macintosh or Linux using NMBD).
> NETBIOS does not in any way provide DNS services. It is relegated to the local subnet only and almost always what is designated as non-routed IP space (10.x.x.x, 172.16.x.x, 192.168.x.x)
> UNIX/Linux has a reasonably simple method for maintaining DNS names in /etc/hosts where you can simply set them, ie
> srv1 srv1.mydomain
> srv2 srv2.mydomain
> etc.
> You can also do this on Windows systems - edit C:\Windows\System32\drivers\etc\hosts
> If you want Dynamic DNS on your LAN, you are going to find that the typical home/SOHO routers are insufficient with short lease times, no memory storage for previously registered DHCP addresses and no ability to actually provide real DNS (other than forwarding to some other DNS server) and thus, no DDNS. Thus if you really want to have dynamic DNS on your local LAN, you would want to install bind and dhcp packages and configure them (not the easiest thing to do but not entirely difficult either).

Thank you all for your answers.

Indeed, my router (D-Link DIR-100) only does DNS relay and nothing more.

It looks like I have to stick to CIFS for now. Editing hosts file 
manually looks too outdated for me, and I have to edit each hosts file 
on all my computers when a new computer is added (which just happened a 
few days ago). A dnsmasq server looks like a better way to handle my 
problem, but it already requires one of the machines to assume a server 
role: it needs a static IP and can not benefit from (its own) 
configuration services, and it must be running for all other machines to 
be running and see each other.

My subnet is Gigabit anyway, so I guess I think I will live with the 
extra traffic from NetBIOS.

I still have one problem, though: somehow my trick to include 'wins' in 
the 'hosts: ' line in /etc/nsswitch.conf only works when my box uses a 
static IP ! :( I guess `dhclient´ updates the DNS server lists and the 
'resolver' in a way that interferes with the name service switch 
mechanism (configured from /etc/nsswitch.conf).

Is there a way to get the name service switch to use wins, while the DNS 
configuration is handled by DHCP client ?

Thank you,
Timothy Madden