A quick and dirty guide as to how addresses are resolved using Address Resolution Protocol
I will explain using the powerful art of example. In this example I am using a Class C network with a network address of 192.168.46.0. There are a four hosts, numbered 1 through 4. To keep things standard I will refer to hosts by their full IP address.
If 192.168.46.1 wanted to contact 192.168.46.4 it needs 192.168.46.1's MAC Address. Simply put, it needs to resolve a MAC Address from an IP address. So first off it sends a packet with a MAC broadcast address on the network interface layer and 192.168.46.4 on the internet layer. This means that all network cards read the packet to the next layer, comparing the IP address with its own. When 192.168.46.4 receives the packet, it replies with its MAC address and a unicast communication is now possible.
But wait! What if the two hosts are on different networks? The router will stop the broadcast from going any further. Well, not quite, if this happened the internet wouldn't work. Routers have another job, and it is for this job they are named.
192.168.46.1 192.168.46.3 220.127.116.11
| | |----| |
|--------|---------|-----------|-----|-----------| R |----------|
| | |____|
If 192.168.46.1 wants a unicast
communication with 18.104.22.168, how does this happen? First off 192.168.46.1 would employ its subnet mask
and would discover that the network address 22.214.171.124 was different from its own network address of 192.168.48.0 (126.96.36.199 is not the correct network address of that network since it is not a class C network, but 192.168.46.1 doesn't know this. For the record, the correct network address is 188.8.131.52). Since it is not on the same network, 192.168.46.1 sends an ARP broadcast to get the MAC address of its own router. Once a unicast communication with the router is established
192.168.46.1 can send the router the IP address of 184.108.40.206.
The router then sends an ARP broadcast to 220.127.116.11, gets the relevant MAC address as described in the original example, and establishes the communication this way.
To avoid the constant ARP broadcasts, each computer can cache MAC addresses, the default time for which is 10 minutes.