cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1080
Views
15
Helpful
6
Replies

How to learn IP addresses in a LAN

dailymotionad
Level 1
Level 1

For communication with machines in the same LAN, hosts do ARP for translating the IP address to MAC address, which means, IP addresses are already known to each other. My question is, how does the host come to know about the IP addresses of each other in the first place?

 
6 Replies 6

balaji.bandi
Hall of Fame
Hall of Fame
My question is, how does the host come to know about the IP addresses of each other in the first place?

They dont , that where you requestion with broacast, who has X in the network.

 

You get to know only if you like to talk to other host, if not you do not need to know other host IP address.

 

 

BB

***** Rate All Helpful Responses *****

How to Ask The Cisco Community for Help

Joseph W. Doherty
Hall of Fame
Hall of Fame

As @balaji.bandi noted, they usually don't know.

More often they have the other host's "name", and if so, usually in IP, they use DNS to resolve that name to an IP.

Since you mentioned LANs, host names might also resolved by other than DNS, using proprietary LAN protocols too.

Whether using DNS or a proprietary host name to address resolution service, often host names are hard coded to an address or dynamically mapped to an allocated allocated address in conjunction with the DHCP process.

If I am understanding the discussion correctly the original poster is asking if a host needs to send an arp request for address a.b.c.d (which is in the same subnet as the host's interface) where did a.b.c.d come from. There are several potential answers:

- perhaps the host is running some application, and the application provided that address (or provided a name, which was resolved to an address).

- perhaps a user connected on this host supplied that address (or provided a name, which was resolved to an address).

HTH

Rick

Rick is correct, or to put it another way, something external to the host has to provide the destination hostname or IP.  Hosts aren't clairvoyant. 

Once "primed" with another hostname, it needs to be translated/mapped to an IP.  Generally, as noted in my earlier reply, this might be done with DNS, or other LAN specific technique.

It's also possible, host (some app) was provided a hostname, and it's translated/mapped to an IP on the host using a host table.  This table bypasses the need to tranlate/map an name using an external resource, but translation process, generally, looks first in host table and if entry not found there, it tries the external processes.  (Much like an IP to MAC can be within a table, or ARP cache, on the host.)

 

EdgarMurray8920
Level 1
Level 1

@dailymotionad wrote:

For communication with machines in the same LAN, hosts do ARP for translating the IP address to MAC address, which means, IP addresses are already known to each other. My question is, how does the host come to know about the IP addresses of each other in the first place?

 

The host only will have the IP of the hosts it has already communicated, so it does not know all the IP addresses in the LAN. A host will use ARP only if it needs to communicate with a certain host, but if it does not need anything from a particular host, it will not have that host in the ARP table. 

 

Also, keep in mind that many people don't know the existence of Proxy ARP which is used mostly when the machine is not configured with a default gateway. If the request from host A is for a host(B) in another subnet and the router has a route for that, it may respond to the host(A) with its own MAC Address and the communication will go thru. Host(A) will now have the router MAC Address mapped to the host(B) IP address on the arp table. 

pman
Spotlight
Spotlight

Hi,

I found an article that explains the subject in a very simple and easy way,
Hope this helps someone

https://www.geeksforgeeks.org/packet-flow-in-the-same-network/

When a source wants to send a packet to the destination device then, 

1. The source ARP cache is checked if the ARP is resolved or not. If the ARP is not resolved, it puts the packet on hold and generates an ARP request. 

dd-1.png

2. If the ARP is already resolved then the packet will be delivered to the destination host.

3. The ARP request is broadcast all over the network to find out the device has a destination IP address. 
Note – If the destination is present in the same network then ARP will find out destination MAC address but if it is present in a different network then ARP will find out default gateway MAC address. 

dd1.png

4. When the device having the destination IP address receives the ARP request, it updates its own ARP cache.

5. The destination host machine generates an ARP reply containing its own MAC address.

6. Now, the device having the source IP address receives the ARP reply and updates its ARP cache. 

dd2.png

 

7. Since, both source and destination IP address and MAC address are available now, therefore, the packet is delivered to the destination host.

Now, we have taken an idea about the ARP protocol.

 

Review Cisco Networking products for a $25 gift card