When troubleshooting IP networks over Ethernet it helps to understand how packets travel across the network. Packets use two different mechanisms to get from point A to Point B, or from the source to the destination. IP addresses and MAC addresses.
The MAC address is the layer 2 address that represents the specific hardware that is connected to the wire. The IP address is the layer 3 address that represents the logical identity of the device on the network.
Most every computer today has some sort of network interface card (NIC) either built-in or installed on the computer. Every NIC is created with a hardware number permanently “burned” into it. This permanent hardware number is known as the MAC (Media Access Control). MAC addresses are 48 bits in length and are usually displayed as a 12 digit hexadecimal number.
The first 24 bits (or 6 digits) represent the manufacturer of the NIC. The last 24 bits (6 digits) are a unique identifier that represents the Host or the card itself. No two MAC identifiers are alike.
The IP address is the logical address that is associated with the MAC for a particular device. IP addresses (IPv4) are a 32 bit (12 digit) number representing 4 binary octets.
Both an IP and a MAC are needed for data to travel across an Ethernet network.
The ARP Protocol
When a computer sends data over the network, it first needs to find which route it must take. Will the packet stay on the network or does it need to leave the network. The computer first determines this by comparing the subnet mask to the destination ip address.
Once this destination is known, Address Resolution Protocol (ARP) is used to find the next hop on the network. ARP’s job is to basically discover and associate IP addresses to the physical MAC.
For a packet that has a destination on another network, ARP is used to find the MAC of the gateway router. An ARP packet is sent to the gateway router asking for it’s MAC. The router reply’s back to the computer with it’s mac address. The computer will then forward the packet directly to the mac address of the gateway router.
When the gateway router receives the packet it will remove it’s mac address as the destination and replace it with the mac address of the next hop router. It will also replace the source computer’s mac address with it’s own mac address. This happens at each route along the way until the packet reaches it’s destination.
Going Postal – An Example
Let’s use the postal service to help explain this. Think of this process like taking a letter and stuffing it in an envelope. Then take that envelope and stuff it in another envelope addressed to the local post office. The post office then takes out the inner envelope, to determine the next stop on the way, puts it in another envelope with the new destination.