Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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

1 Answer

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
add comment

Your Answer

 
discard

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.