The OSI model describes the processes of encoding, formatting, segmenting, and encapsulating data for transmission over the network. The network layer and data link layer are responsible for delivering the data from the source device or sender, to the destination device or receiver. Protocols at both layers contain source and destination addresses, but their addresses have different purposes.
Network Address
The network layer, or Layer 3, logical address contains information required to deliver the IP packet from the source device to the destination device. A Layer 3 IP address has two parts, the network prefix and the host part. The network prefix is used by routers to forward the packet to the proper network. The host part is used by the last router in the path to deliver the packet to the destination device.
An IP packet contains two IP addresses:
- Source IP address - The IP address of the sending device.
- Destination IP address - The IP address of the receiving device. The destination IP address is used by routers to forward a packet to its destination.
Data Link Address
The data link, or Layer 2, physical address has a different role. The purpose of the data link address is to deliver the data link frame from one network interface to another network interface on the same network. Before an IP packet can be sent over a wired or wireless network it must be encapsulated in a data link frame so it can be transmitted over the physical medium, the actual network. Ethernet LANs and wireless LANs are two examples of networks that have different physical media each with its own type of data link protocol.
The IP packet is encapsulated into a data link frame to be delivered to the destination network. The source and destination data link addresses are added, as shown in the figure:
- Source data link address - The physical address of the device that is sending the packet. Initially this is the NIC that is the source of the IP packet.
- Destination data link address - The physical address of the network interface of either the next hop router or the network interface of the destination device.