Table of Contents Link to heading
- Logical versus Physical Addresses
- Getting Data to the End Device
- Getting Data Through the Internetwork
Logical versus Physical Addresses Link to heading
The data link and network layers are both responsible for delivering the data from the source host to the destination host.
Protocols at both layers contain a source and destination address, but their addresses have different purposes.
- Data link layer source and destination addresses
- Physical or MAC addresses
- Responsible for delivering the data link frame from one NIC to another NIC on the same network
- Physically embedded on the Ethernet NIC.
- Network layer source and destination addresses
- Logical or IP addresses
- Responsible for delivering the IP packet from the original source to the final destination, either on the same network or to a remote network
Getting Data to the End Device Link to heading
As the IP packet travels between two hosts on a Layer 2 data connection (e.g., host-to-router, router-to-router, router-to-host), at each point along the way the IP packet is encapsulated in a new data link frame.
A data link (Layer 2) frame contains two MAC addresses:
- Source MAC address - the physical address of the sender’s NIC.
- Destination MAC address - the physical address of the receiver’s NIC.
- This address is either of the next-hop router or of the final destination device.
When the sender and the receiver are on the same network, the data link frame is sent directly to the receiving device.
The router removes the Layer 2 information as it is received on one NIC and adds new data link information before forwarding out the exit NIC on its way towards the final destination.
When the sender and the receiver are on different networks, the data link frame cannot be sent directly to the destination host because the host is not directly reachable in the network of the sender. The data link frame must be sent to a intermediary device (default gateway) which will forward the packet to the destination. This may mean that the default gateway forwards the packet to the next-hop router or directly to destination host if the host is on a network connected to the default gateway.
It is important that the IP address of the default gateway be configured on each host on the local network. All packets to a destination on remote networks are sent to the default gateway.
Getting Data Through the Internetwork Link to heading
A network layer (Layer 3) packet contains two IP addresses:
- Source IP address - the IP address of the sending device. source of the packet.
- Destination IP address - the IP address of the receiving device.
An IP address contains two parts:
- Network prefix - the leftmost part of the address that indicates which
network the IP address is a member. All devices on the same network will have
the same network portion of the address.
- Used by routers to forward the packet to the proper network.
- Host part - the remaining part of the address that identifies a specific
device on the network. The host portion is unique for each device on the
network.
- Used by the last router in the path to deliver the packet to the destination device.
When the sender and receiver are on the same network, the network portion of both the source IP address and destination IP address are the same.
When the sender and the receiver are on different networks, the network portion of the source IP address will differ from that of the destination IP addresses. At the boundary of each local network, after the default gateway (routers or Layer 3 switches) has received the data link frame, it decapsulates the frame to read the destination host address contained in the header of the packet (the Layer 3 PDU). Routers use the network identifier portion of this address to determine which path to use to reach the destination host. When the path is determined, the router encapsulates the packet in a new frame and sends it on its way toward the destination end device. When the frame reaches its final destination, the frame and packet headers are removed and the data moved up to Layer 4.