IP addresses are used to see the address of the original source and the final destination of the packet. The destination IP address may be on the same IP network as the source or may be on a remote network.
Destination on the Same Network
There are two types of addresses assigned to a device on an Ethernet LAN:
- Physical address– Physical address also called the MAC address which is Used for Ethernet NIC to Ethernet NIC communications on the same network.
- Logical address– Logical Address((the IP address)which is used to send the packet from the original source to the final destination.
We earlier learn that physical addresses are working in layer 2 of the OSI Model. These addresses have a different purpose. For example, these addresses are used to transport 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.
Figure 4.7 shows the Ethernet MAC addresses and IP address for Host-A sending an IP packet to Host-C on the same network.
The Address for Layer 2 Ethernet frame:
- Destination MAC address– This is the MAC address of Host-C Ethernet NIC.
- Source MAC address– This is the MAC address of Host-A’s Ethernet NIC.
The Address for Layer 3 IP packet:
- Source IP address– This is the IP address of the source, Host-A.
- Destination IP address– This is the IP address of the final destination, Host-C.
Destination Remote Network
When the destination IP address is not on the same network; the destination MAC address will be the address of the sending host’s default gateway; the router’s NIC, as shown in figure 4.8. Host-A and Host-B are not on the same network. Host-A sending an IP packet to Host-B on a remote network. Destination MAC Address for Host-A is the MAC Address of Default Gateway(Router interface). Routers examine the destination IP address to determine the best path to forward the IP packet.
When the router receives the Ethernet frame, it de-encapsulates the Layer 2 information. Using the destination IP address; it checks for the next-hop device and then encapsulates the IP packet in a new data link frame for the outgoing interface.This time the source mac address will be the address of router leaving interface. Along 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 is the final destination, the destination MAC address will be that of the device’s Ethernet NIC.