In my previous article, I have talked much about how data travels across the network. In this article, I want to talk more about MAC addresses and IP Addresses. Follow me as we will look at that in this article. There are two primary addresses assigned to a device on an Ethernet LAN:
- Physical address (the MAC address) – This is used for Ethernet NIC to Ethernet NIC communications on the same network.
- Logical address (the IP address) – This is used to send the packet from the original source to the final destination.
IP addresses are used to identify the address of the original source device and the final destination device. The destination IP address may be on the same IP network as the source or maybe on a remote network.
Note: Most applications use DNS (Domain Name System) to determine the IP address when given a domain name such as www.cisco.com. DNS is discussed in a later module.
Ethernet MAC addresses have a different purpose. These addresses are used to deliver the data link frame with the encapsulated IP packet from one NIC to another NIC on the same network. If the destination IP address is on the same network, the destination MAC address will be that of the destination device.
The figure shows the Ethernet MAC addresses and IP address for PC-A sending an IP packet to the file server on the same network.
The Layer 2 Ethernet frame contains:
- Destination MAC address – This is the MAC address of the file server’s Ethernet NIC.
- Source MAC address – This is the MAC address of PC-A’s Ethernet NIC.
The Layer 3 IP packet contains:
- Source IP address – This is the IP address of the original source, PC-A.
- Destination IP address – This is the IP address of the final destination, the file server.
The figure shows a P C connected to a server. The P C is sending data to the server. The P C puts the Layer 3 source and destination I P addresses in the packet header and then puts the Layer 2 source and destination MAC addresses in the frame header.
Communicating on a Local Network
Destination on Remote Network
When the destination IP address is on a remote network, the destination MAC address will be the address of the host’s default gateway. The default gateway address is the address of the router’s NIC, as shown in the figure. Using a postal analogy, this would be similar to a person taking a letter to their local post office. They only need to leave the letter at the post office. It then becomes the responsibility of the post office to forward the letter towards its final destination.
The figure shows the Ethernet MAC addresses and IPv4 addresses for PC-A. It is sending an IP packet to a file server on a remote network. Routers examine the destination IPv4 address to determine the best path to forward the IPv4 packet. This is similar to how the postal service forwards mail based on the address of the recipient.
When the router receives the Ethernet frame, it de-encapsulates the Layer 2 information. Using the destination IP address, it determines the next-hop device and then encapsulates the IP packet in a new data link frame for the outgoing interface. Along with each link in a path, an IP packet is encapsulated in a frame specific to the particular data link technology associated with that link, such as Ethernet. If the next-hop device is the final destination, the destination MAC address will be that of the device’s Ethernet NIC.
How are the IPv4 addresses of the IPv4 packets in a data flow associated with the MAC addresses on each link along the path to the destination? This is done through a process called Address Resolution Protocol (ARP).
The figure shows P C A connected to router r 1, which is connected to R 2. R 2 is connected to a file server. P C A is sending data to the file server. P C A builds a packet with its own I P address as the source and the destination I P address of the file server. P C A then builds a frame with its own MAC address as the source and the MAC address for R 1 as the destination.