Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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 two machines connected in link local IPv4 over a CAT6 cable. Is there a way from host1 that I can determine host2's IPv4 address?

I'm on an Debian-derivative running kernel 3.2.0-34-generic.

share|improve this question
What OS are you on? Make sure you've installed zero-conf tools (e.g. Avahi) to use link-local name resolving. – gertvdijk Dec 4 '12 at 16:43
Sorry, I'm on an Debian derivative. – Naftuli Tzvi Kay Dec 4 '12 at 16:52
Most GUI-enabled Debian/Ubuntu derivates have this enabled by default in the .local scope. Try using ping host2.local. – gertvdijk Dec 4 '12 at 16:54
Make the 'install avahi' line an answer and I'll give it to you. – Naftuli Tzvi Kay Dec 4 '12 at 17:00
I was able to then simply access the computer with host2.local via Avahi. – Naftuli Tzvi Kay Dec 4 '12 at 17:51
up vote 5 down vote accepted

Yes, already posted in the comments as a verified solution, but posting as an answer anyway.

Try using mDNS.

One should install avahi-daemon on the machine you want to resolve (e.g. host2), and at least some Avahi client libraries appropriate for your client system (e.g. host1). These client libraries are usually installed by default on most desktop distributions. Provided your Linux distribution then automatically installs hooks to actually use the Avahi client (mDNS) for lookups, you should then be able to resolve the name host2.local on the client machine.

The Avahi set of tools is an mDNS implementation. Summarized, it provides name services via multicast, for both regular host resolving and service discovery. Mac OS X users might recognize this as "Bonjour" and this is how for example iTunes applications find each other (service discovery). However, plain address lookup should work just out of the box.

Avahi is triggered in host name lookups because of the settings in /etc/nsswitch.conf (for me at least on Debian/Ubuntu), like this:

hosts:          files mdns4_minimal [NOTFOUND=return] dns mdns4

The .local suffix is exported by the Avahi daemon and configurable. host2 is just the base hostname of the machine.

share|improve this answer

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.