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.

  • 1
    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 Kay Dec 4 '12 at 16:52
  • 1
    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 Kay Dec 4 '12 at 17:00
  • 1
    I was able to then simply access the computer with host2.local via Avahi. – Naftuli Kay Dec 4 '12 at 17:51

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.

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.