6

I have a LAN at home with my desktop and my laptop. IP addresses are allocated dynamically to both, so the IP number keep changing.

I try to connect from one to the other using places->Server, and in there if I put the correct IP address I connect without any issues. But if I put the hostname, it doesn't recognize. Same thing if I try to ping the hostname v/s the IP address.

The funny thing is that I can see the hostnames if I go to places->network. So basically ubuntu has got a way of telling what are the machines connected to the network and what are their names, I wonder how can I exploit this to keep an up-to-date routing table that map the hostname to the correct IP address.

PS, both desktop and laptop are running Ubuntu. I'm using version 10.04 and 10.10

Thanks

7

Ubuntu comes with the Avahi implementation of mDNS service discovery (also known under Apple's trademarked name Bonjour), which advertises your hostname over the local network under the .local domain. The standard hostname resolver will also do mDNS lookups.

So if you set the hostname of one of your computers to foo, you should be able to ping it from another machine on the local network with:

ping foo.local

You should be able to use these .local names with most software on Ubuntu.

| improve this answer | |
  • ah, this might be the answer, I'll check it! thanks – Charbel May 9 '11 at 18:14
  • Hello i'm also in this situation where my laptop is running ubuntu 11.04 and my desktop running windows 7.trying to connect to the windows 7 both apache or iis.accessible via ips but not hostname.i'm not sure whether the ".local" would work for other OSes.if you know other way, please let us know.thanks – black sensei Sep 16 '11 at 9:48
  • Windows does not come with an mDNS stack, so doesn't advertise its hostname or provide .local name lookup. There are some third party stacks available, but I don't have any experience with them. – James Henstridge Sep 16 '11 at 12:41
  • To enable hostname.local functionality on Windows simply install Bonjour – Cas Nov 15 '11 at 0:53
0

Depending on your LAN setup, many routers have the ability to rember and reserve ip addresses for specific machines, this would keep their names and ips the same.

Alternatively you could set up static ip's for each machine. The network manager tool can do this,

I tend to go both routes, my router gives dynamic ip's in the 192.168.1.200+ range and i set up static ips on most of my machines in the 192.168.1.100-199 range.

| improve this answer | |
  • so there is no way to get the routing table updated automatically? – Charbel May 9 '11 at 13:28

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