Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 192.168.3.0 with a subnet mask of 255.255.255.0. For example:

  • default gateway: 192.168.3.254
  • Mac1: 192.168.3.1
  • Windows1: 192.168.3.2
  • Windows2: 192.168.3.3
  • Linux1: 192.168.3.4
  • Linux2: 192.168.3.5

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
add comment

3 Answers 3

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
2  
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
add comment

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
add comment

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
add comment

Your Answer

 
discard

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.