Azitech

Azimout's Linux weblog

host name resolution

leave a comment »

I have 5-6 machines in my LAN, all running Linux (except for my iPhone). All have DHCP reservations on my router, so they always get the same IP.

I have edited the /etc/hosts file in all Linux machines to include the dictionary of all machines on the LAN (matching IPs to hostnames). However, if anything changes, I’d have to go an edit /etc/hosts on each single machine. So I thought there must be a better way to do this, and starting studying. Here’s what I’ve come up with:

  • in /etc/hosts you can add any IP-hostname pair you like (the Windows equivalent is LMHOSTS)
  • in /etc/resolv.conf there’s the nameserver (set by NetworkManager), which is the router. The router is not an actual nameserver, it just relays DNS requests to the ISP’s DNS server
  • in /etc/nsswitch.conf, under the entry “hosts:”, there’s the order according to which name resolution requests are resolved. By default it’s files mdns4_minimal [NOTFOUND=return] dns mdns4
  • Windows used to use WINS (a client-server architecture) for this sort of thing (NetBIOS name service, or NBNS). Names are not defined by the server, but instead clients register themselves and declare their names.
  • Samba can act (among other things) as an NBNS server
Advertisements

Written by azimout

27/05/2010 at 12:29

Posted in Reference

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: