As we know, at the Network layer of the OSI model, we commonly use conventional types of addresses such as IP, IPX, etc. These addresses are divided into two distinct parts: the network address (NetID) and the host address (HostID). This method of numbering addresses helps facilitate the discovery of connection paths from one network system to another. These addresses can be modified at the user’s discretion.
In practice, network interface cards (NICs) can only connect with each other using MAC addresses, which are fixed and unique hardware identifiers. Therefore, we need a mechanism to convert between these types of addresses. This brings us to the Address Resolution Protocol (ARP).
How ARP Works in a LAN When a network device wants to know the MAC address of another network device for which it knows the address at the network layer (IP, IPX, etc.), it sends an ARP request that includes its own MAC address and the IP address of the device whose MAC address it needs, broadcasting this request across the entire domain. Each device that receives this request will compare the IP address in the request with its own network layer address. If the addresses match, that device must send back a packet to the sender of the ARP request, which contains its MAC address. In a simple network system, for example, when PC A wants to send a packet to PC B and only knows the IP address of PC B, PC A will send an ARP broadcast to the entire network to ask, “What is the MAC address of the PC with this IP address?” When PC B receives this broadcast, it will compare the IP address in the packet with its own. Recognizing that the address belongs to it, PC B will send a packet back to PC A containing its MAC address. PC A will then begin to transmit the packet to B.
How ARP Functions in a Network System Environment:
In a more complex environment where two networks are connected through a Router C, machine A from network A wants to send a packet to machine B from network B. Since broadcasts cannot pass through routers, machine A will regard Router C as a bridge or intermediary (Agent) for data transmission. Prior to that, machine A will know the IP address of Router C (the Gateway address) and will understand that to transmit a packet to B, it must go through C. All such information will be stored in a table called the routing table. This routing table is maintained on each machine and contains information about the Gateways to access a particular network system. For instance, in the above case, the table will indicate that to reach LAN B, it must go through port X of Router C. The routing table will include the IP address of port X. The data transmission process follows these steps:
- Machine A sends an ARP request (broadcast) to find the MAC address of port X.
- Router C responds, providing machine A with the MAC address of port X.
- Machine A transmits the packet to port X of the Router.
- The Router receives the packet from machine A and forwards it out through port Y of the Router. The packet contains the IP address of machine B, and the Router will send an ARP request to find the MAC address of machine B.
- Machine B replies to the Router with its MAC address. After receiving the MAC address of machine B, Router C sends the packet from A to B.
In practice, besides this routing table format, there is also a method known as proxy ARP, where a device assumes the responsibility of resolving addresses for all other devices. Accordingly, the workstations no longer need to maintain their own routing tables; Router C will carry out this task, responding to all ARP requests from all machines.