Home

 › 

Vs.

 › 

Layer 2 vs. Layer 3 in Networking: What’s the Main Difference?

Data Structure

Layer 2 vs. Layer 3 in Networking: What’s the Main Difference?

Layer 2 and Layer 3 are essential layers of the 7-layer OSI stack. They perform a key role in the packaging and controlled transfer of data within and in between networks.

Understanding how these two computer networking layers work and the differences between them is essential for appreciating the architecture of networks including Ethernet, Wi-Fi, and the internet.

In this article, we’ll take a closer look at Layer 2 and Layer 3 in networking and determine their main differences. Let’s get started!

Layer 2 vs. Layer 3 in Networking: Side-by-Side Comparison

Layer 2Layer 3
NameData link layerNetwork layer
What is it?A layer of the 7-layer OSI model A layer of the 7-layer OSI model 
Primary UsePackaging and transfer of data between two physically connected nodes, error detectionMoving data between two or more networks with the management of the addressing, routing, and control of network traffic (switching)
Initial ReleaseNovember 1978 November 1978
Influential DevelopersJack Houldsworth, ICL, Hitachi, The Institute of Electrical and Electronic Engineers (IEEE)Jack Houldsworth, ICL, Hitachi, The Institute of Electrical and Electronic Engineers (IEEE)
Unit of Data FramePacket
Relationship to DoD ModelLocal network accessInternet protocol
Leading Protocols WLAN, Wi-Fi, EthernetInternet Protocol (IP), Internet Control Message Protocol (ICMP), Internet Group Management Protocol (IGMP)

Layer 2 vs. Layer 3 in Networking: What’s the Main Difference?

Both Layer 2 and Layer 3 are concerned with the packaging and transfer of data across a medium between nodes. The main difference between Layer 2 and Layer 3 is:

  • Layer 2, the Data Link Layer, is concerned with the packaging and transfer of data within a network.
  • Layer 3,  the Network Layer, is concerned with the packaging and transfer of data between different networks.

Layer 2 is subordinate to Layer 3. The data link layer responds to service requests from the network layer by packaging and transferring data locally that the network layer moves to another network. An example of their relationship would be the transfer of data generated within a home Wi-Fi network (Layer 2) to the internet via a router (Layer 3).

Other differences between the two OSI layers include the assembly of data as frames at the data link level, and packets at the network level. 

What is the OSI model?

The Open Systems Interconnection, or OSI, model is a widely adopted 7-layer architecture that can be used to describe any network model.

It was developed in the 1970s by Jack Houldsworth, a manager at the British computing company, ICL Letchworth Development Centre, who published the concept as part of the company’s work on the European Union’s Mainframe.

This conceptual model provides a framework for coordinating the various protocols and standards that relate to the various systems interconnections within a network.

The OSI model is made up of 7 distinct layers:

  1. The Physical Layer
  2. The Data Link Layer
  3. The Network Layer
  4. The Transport Layer
  5. The Session Layer 
  6. The Presentation Layer
  7. The Application Layer

The movement and exchange of data are represented within the 7-layer model both practically (e.g. the transfer of bits of data) and at higher levels (e.g. how a network application is meant to work overall).

The OSI 7-layer model is hierarchical. Each layer possesses distinctive functions. They only interact with the layers immediately above or below.  Every intermediate layer is served by the functionality layer below it and serves the layer above with its own functionality. 

What is Layer 2?

In the OSI model, Layer 2 is the Data Link Layer. The data link layer is concerned with data transfer between network nodes that are directly connected. Protocols and procedures that deal with this layer of a network specify how two physical devices (nodes) can be connected to or disconnected from one another and the control of the flow of data between them. 

Once connected, data moves between devices at the same network level in the form of data-link frames, which are units of digital transmission. Everything in this network is concerned with the local exchange of data within the boundaries of the local area network. Transfer of data between networks or global addressing is the concern of higher layers. 

This includes the local addressing, delivery, and any necessary arbitration between nodes that want to access the medium for data transfer. Data link protocols also specify how frame collisions are prevented or managed.

data structure network layers wifi internet protocol
Layers 2 and 3 are crucial aspects of the Internet Protocol.

Layer 2 Has Two Sublayers

  1. The Media Access Control or MAC layer: This is an important layer that specifies how devices in a network obtain network access and permission to exchange data.
    • Services provided by the MAC layer include multiple access methods to facilitate access of more than two devices to the medium for data transfer:
      • Collision detection and avoidance protocols such as CSMA/CD and  CSMA/CA
      • Physical addressing (MAC addressing)
      • Packet switching, packaging data for transmission
      • QoS or Quality of Service controls, that specify optimum network performance 
  1. The Logical Link Control or LLC layer: This layer provides the logic or protocol for the data linkages, managing error checks, and frame synchronization for correct data extraction. LLC layer services include:
    • Error control, with retransmission of data packets when errors are detected
    • Flow control, managing the rate of data transfer between nodes

IEEE 802 specifies MAC and LLC layers of well-known networking protocols including Wi-Fi (802.11) and Ethernet (802.3).

What is Layer 3?

Layer 3 of the 7-layer OSI model is the Network Layer. This layer is concerned with the procedures and functions required for the efficient forwarding of data packets between nodes in different networks, often via intermediate routers.

The network layer is a medium that consists of many nodes, each with an address. Connected nodes can transfer their data to other addressed nodes and the network will accomplish the delivery, either directly or via intermediate nodes. Where the transfer packet is too large for the data link layer to process, the network can split the packet into smaller fragments that are sent individually and reassembled at a destination node.

Functions of the Network Layer

Network layer functionality is concerned with transferring data packets of any length from source to destination across more than one network. This is inter-network data transfer, rather than local data transfer of the data link layer. Within the OSI hierarchy, the network layer:

  • Serves the transport layer by responding to its service requests
  • Is served by the data link layer, which responds to its network layer service requests

Properties of the Network Layer Include…

  1. Connectionless communication: Data packets can be transferred from a sender to a recipient without a handshake or acknowledgment. An example of this is the Internet Protocol.  
  2. Host addressing: Every host has its own, unique address. The address determines its location within the network (e.g. IP addresses on the internet).
  3. Message forwarding of data packets between networks: This is accomplished by gateways and routers that specialize in the bidirectional transfer of data between two different networks.

Layer 2 vs. Layer 3: 6 Must-Know Facts

  • Routers are the most common example of a Layer 3 device.
  • Ethernet switches are the most common Layer 2 device.
  • Layer 2 switches connect network components using the MAC sublayer. The use of MAC addresses makes device authentication quick for the efficient transfer of data between network nodes. 
  • Layer 3 switches (also called multilayer switches) act as routers and switches to increase the rate of data transfer between networks. They routinely deal with IP addresses. 
  • A Media Access Control, or MAC address, is a physical address for network hardware components. It consists of a unique 12-digit alphanumeric address that can be recognized by other nodes in the network.  
  • An Internet Protocol address (IP address) is an address that is designed for computer networks that transfer data using the Internet Protocol. The alphanumeric address serves as an identifier and locator.

Bottom Line

Layer 2 and Layer 3 work together to provide fast and efficient connectivity within and between networks. Despite the marked differences between these two layers, their relationship is very much an interdependent one that underpins the network applications that have become an essential part of modern life, like the internet, Ethernet, and Wi-Fi.

Frequently Asked Questions

What is Layer 1 of the OSI model?

Layer 1 in the OSI model is the Physical Layer, which is responsible for transmitting individual bits of data across a physical medium.

What is Layer 4 of the OSI model?

Layer 4 in the OSI model is the Transport Layer, which is responsible for transmitting data between network nodes as segments along with acknowledgment, segmentation, and multiplexing functions. The transport layer uses protocols like UDP or TCP.

What is Layer 5 of the OSI model?

Layer 5 in the OSI model is the Session Layer, which manages ports and sessions of data transfer between nodes. 

What is Layer 6 of the OSI model?

Layer 6 in the OSI model is the Presentation Layer, which translates the data into a format that can be used by an application. Encryption also takes place at this level.

What is Layer 7 of the OSI model?

Layer 7 in the OSI model is the Application Layer, which runs high-level protocols for human-device interactions like file sharing.

To top