7

In my home network, I would like to be able to set up hostnames on my network, rather than accessing computers by IP:

e.g.

webserver.mynetwork = a Linux VM running on my computer
mylaptop.mynetwork = My laptop (Linux)
mylaptopwin.mynetwork = My laptop while booted into Windows (Vista)
nas.mynetwork = My NAS drive
laptop2.mynetwork = A second laptop on my network (Windows XP used for gaming etc.)
brotherlaptop.mynetwork = My brother's laptop. (Vista)

How would I go about doing this? All of these have a static IP address.

I know I would be able to do this by editing the hosts file on all these computers, but is their a neater solution? I've looked through my router's control panel, and it doesn't seem to have anything relevant. (Netgear WPN111). I can't rely on any of these to be on at any given time.

3
  • I don't understand. I haven't done anything special and I can access all of my machines on my network using their name. Most are windows, but also a mac, or does enabling windows file sharing there has something to do with it? And if so, isn't that also possible in Linux? I know I never fiddled with any hosts file, and I definitely don't have a DNS server.
    – fretje
    Sep 28, 2009 at 17:56
  • fretje: He said he can't rely on any of those computers to be on at any given time. That's why the "built in" hostname resolution you're referring to will not work for him. Sep 28, 2009 at 18:32
  • 1
    @OverloadUT: I still don't understand. When the computer to reach isn't on, any hostname resolution, built-in or not, won't work then, isn't it?
    – fretje
    Sep 30, 2009 at 10:04

3 Answers 3

9

Hosts file would be the easiest solution.

The only other way would be if you control your own DNS server, in which case you will just need to insert a few entries. You may be able to set up a DNS server if you have another pc on 24/7, but if not, I would say hosts file is the way to go.

3
  • That's what I was gonna say, the hosts solution is pretty easy.....
    – Ian G
    Sep 28, 2009 at 17:27
  • +1 - For ~5 hosts, a personal DNS server is some serious overkill.
    – romandas
    Sep 28, 2009 at 17:42
  • 5
    the hosts file "solution" is everything but easy. Maintaining multiples files accross machines is a PITA, and very error-prone.
    – yPhil
    Sep 17, 2013 at 10:28
5

If the machines on you LAN run a modern operating system, then you can access them with

machine_name.local

Don't forget the .local suffix.

To get the name from the IP, use

avahi-resolve-address IP
2

According to the manual on Wikibooks, you can accomplish this using the Tomato firmware. Knowing Tomato, it should be very easy to set up.

The Tomato firmware is a third-party open source firmware replacement for certain types of routers. It's very powerful, fairly user friendly, and has a lot of great little features. It's very easy to install.

All you need is one of the supported routers, which will set you back no more than $60.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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