Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a relatively small LAN containing a mixture of Mac, Windows and Linux devices. They currently all receive their IP address (fixed against MAC addresses) through DHCP and the DHCP server is also the router and default gateway. The subnet is with a subnet mask of For example:

  • default gateway:
  • Mac1:
  • Windows1:
  • Windows2:
  • Linux1:
  • Linux2:

I would like to be able to refer to different machines using a name rather than an IP address. For example, when ssh'ing from one Linux machine to another. If it's relevant, I don't have a company domain, etc.

What approaches can I take to achieve this?

share|improve this question
up vote 10 down vote accepted

For a network this small I'd just use

  • /etc/hosts (on Linux and OSX), or
  • c:\windows\system32\drivers\etc\hosts (on Windows).

If the network were to get much bigger I'd deploy dhcpd and named on one of the Linux boxes and stop using the router as the DHCP and DNS server.

share|improve this answer
I think that dnsmasq would serve fine for a small network and it is easier to configure than dhcpd and named. – sybreon Aug 14 '09 at 13:05
quite possibly, but it's not a standard package on all Linux distros. Nor would it support DNSSEC. – Alnitak Aug 14 '09 at 13:08
/etc/hosts doesn't work on OS X(at least on 10.3. Maybe it's updated since?): # Note that this file is consulted when the system is running in single-user # mode. At other times this information is handled by lookupd. By default, # lookupd gets information from NetInfo, so this file will not be consulted # unless you have changed lookupd's configuration – Kevin M Aug 14 '09 at 15:09
it works fine on my 10.5 systems – Alnitak Aug 14 '09 at 15:57

Hmm, you should be able to have your dhcp clients to send a 'hostname' along with their dhcp request. If your dhcp server is configured correctly, or if it is the same as your dns server (ala dnsmasq), you will be able to refer to your machine using the 'hostname' that they sent along with their request.

Alternately, you could always assign some static IP addresses to be dished out by the DHCP server and configure these things in your DNS server as well. If you are using dnsmasq this is trivial.

share|improve this answer

I'm assuming this is a consumer router? You could think about installing OpenWRT or DD-WRT on your router if it is supported and running dnsmasq or a more complicated named/dhcpd setup.

You can do other cools things like run an OpenVPN server/Bit torrent/etc/ on your router as well.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.