Ip – How does a host know the ip addresses of other hosts on the same LAN

iplannetwork-discovery

So as the title say, how does a host know the ip addresses of other hosts on the same LAN? Is there a specific protocol for this? My first thought was that ARP could be used. But ARP seem to take an ip address as input and give the corresponding MAC address.

But say two hosts are connect in a LAN, how does host A know that B exist and that B has the ip address, say, 192.168.0.6?

Best Answer

But say two hosts are connect in a LAN, how does host A know that B exist and that B has the ip address, say, 192.168.0.6?

Simply put, the application tells it so, either by specifying the address or specifying the hostname and then issuing a DNS query.

You might ask, "why does A care if B exists?" The answer, again, is that some application wants to send a message to B. That application knows B's name or IP address.