Access server by host name?

25,167

Solution 1

This has to do with Avahi, a Zeroconf implementation which advertises hostnames on the local network.

You can get started with Avahi on your server by installing the daemon:

sudo apt-get install avahi-daemon

From that point, you should be ready to go. Check out the docs in /usr/share/doc/avahi-daemon/ if you have additional trouble.

Solution 2

You have to have a DNS (Domain Name System) server somewhere to handle that name resolution. Some routers have a DNS server coupled with their DHCP server. Check your router and see if it has one and it's disabled. Ubuntu automatically sends the configured host name out to the DHCP server when it requests an IP address, and if the router has an enabled DNS server, it should report that name/IP to the DNS server, also.

Short of that, you can put the name and IP address of your Ubuntu box in the hosts file on the windows machine in c:\WINDOWS\system32\drivers\etc\hosts. Provided your Ubuntu machine's IP address doesn't change (or change often), that might be a simple, long term solution.

Solution 3

You configure nmbd with a netbios name and then you can use that netbios name on the local network without knowing the IP address.

One time, whilst talking to a Windows SysAdmin that I know, I was surprised to be told that when you plug a Windows PC into the network, even if you don't know the new IP of that machine, you can still find it on the network by using it's Windows name.

I thought that this was some kind of crazy magic but it turns out you can achieve the same thing on Linux by installing, configuring and running nmbd. This is part of Samba.

To find out more, check out this link.

It sounds that this is what you are asking about.

Share:
25,167

Related videos on Youtube

Warren Pena
Author by

Warren Pena

Updated on September 17, 2022

Comments

  • Warren Pena
    Warren Pena over 1 year

    I have a mixed network with mostly Windows machines, a Mac, and a few Linux boxes. There is no DNS or WINS server, and adding one is outside of my control. If I put a clean install of 10.04 desktop on a computer, then all other machines on the network can get to that machine by hostname just fine.

    However, if I put 10.04 server on the same computer, then the other machines can only get to it by IP address. The hostname does not resolve. What do I need to do on the server so that all the other machines on the network can get to it?

  • Warren Pena
    Warren Pena over 13 years
    Just to add a little more info, this fixed the reverse direction too (the server accessing other machines by hostname, which was also not working before).
  • Radu Cotescu
    Radu Cotescu over 13 years
    @ELadner: Windows does that by using WINS. For Ubuntu Server it's sufficient to install the Samba client.
  • Evan Plaice
    Evan Plaice over 13 years
    If you're only looking to direct one computer to the *nix machine using name resolution (or you're willing to modify the hosts file on all the machines that will) then just change the hosts file on the windows machine. The hosts file is basically a short-circuit redirect for convenient local namespace resolution (and for spyware to plant rogue redirects and screw up your internet experience).
  • Evan Plaice
    Evan Plaice over 13 years
    If the router doesn't have dns support built in, and you're looking for a full blown DNS server implementation install bind (a dns server) on the *nix box, configure in the dns redirect, and forward dns port requests from the router to the *nix computer. For a detailed explanation of how this is done (and dns in general) see zytrax.com/books/dns.
  • matt wilkie
    matt wilkie over 13 years
    At first I thought this wasn't working for my network, but learned you need to append .local to the hostname, e.g. ping basement-server.local
  • TO83
    TO83 about 12 years
    Followed the directions directly and got lost a bit trying to find, open, and understand the documentation because I figured I had to do some configuration. I then realized that it was already working ;) I guess they don't call it zeroconf for nothing.
  • cmcginty
    cmcginty about 11 years
    can you configure avahi to work with bare hostnames?
  • Cerin
    Cerin over 9 years
    @mattwilkie, That still doesn't get it to work for me...