Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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 media/file server running Ubuntu 10.10 Maverick Meerkat, connected via cable directly to a DSL router, which also acts as a network switch.

The router uses DHCP to dynamically assign IP addresses. I'd like to keep it as such, if possible. I have friends come in and it's easier for them to connect.

From my desktop (Ubuntu 10.04 Lucid Lynx) I connect via wireless to the router. I can ping the media server and ssh into it using it's IP, but it fails when I use the hostname.

When I ping and ssh wirelessly from my Netbook (Crunchbang Linux), it strangely enough works using the media server's hostname.

That said, I believe it may not be a router configuration issue, but something on my desktop I have to configure.

I tried turning off the firewall, on both sides (sudo ufw enable/disable).

What else can I check or try? Thanks :-)

share|improve this question
Try ssh user@HOSTNAME.local or ping HOSTNAME.local. – Dayjay Jan 24 '11 at 10:09
the hostname does end with .local, as I can ping it from the netbook as HOSTNAME.local – invert Jan 25 '11 at 5:22
up vote 6 down vote accepted

Try sudo apt-get install winbind

You probably want to add 'wins' where it says "hosts:" in /etc/nsswitch.conf

share|improve this answer
I added 'wins' to nsswitch.conf, the change has not picked up yet but I will retry again tonight! – invert Jan 25 '11 at 5:33
It turns out 'wins' needs to be placed before dns in nsswitch.conf. It then worked, but only for a while, after I reconfigure the network for port forwarding :/ So even though I am going the static IP router later, you were correct suggesting to add 'wins' into nsswitch.conf :) – invert Feb 7 '11 at 6:56

Using hostnames requires the name service resolution to be properly setup, since you are using DHCP that should be automatically managed by your router. Check /etc/resolv.conf (it contains the DNS configuration).

share|improve this answer
resolv.conf points to the router – invert Jan 25 '11 at 7:24

If you can set up the machines to receive the same IP address every time, for example by using the MAC address in the router, or if you can set up static addressing on each machine, then you can create a hosts file that will enable the functionality.

# sample /etc/hosts
#   localhost.localdomain   localhost
::1     localhost6.localdomain6 localhost6  router    machine1    machine2    machine3
share|improve this answer
How does his affect when other people want to use the wireless network? Would I need to configure their machines too? Some might be once-off connects, others not. – invert Jan 25 '11 at 5:26
Yes - you would. Can you post your /etc/samaba/smb.conf and /etc/nsswitch.conf? – user8290 Jan 25 '11 at 14:50
I think I will setup static IP's when I get some time, if it means I can use machine names properly. Thanks! – invert Feb 7 '11 at 6:54

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.