5

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 :-)

2
  • 2
    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
8

Try sudo apt-get install winbind

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

2
  • 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
  • 1
    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
3

You can also sudo apt install samba

This has an auxillary result of making the hostname available across the LAN.

Instructions on ubuntu.com

2

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
#
127.0.0.1   localhost.localdomain   localhost
::1     localhost6.localdomain6 localhost6

192.168.1.1 router.example.com  router
192.168.1.201   machine1.example.com    machine1
192.168.1.202   machine2.example.com    machine2
192.168.1.203   machine3.example.com    machine3
3
  • 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
1

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).

1
  • resolv.conf points to the router – invert Jan 25 '11 at 7:24

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.