Layer 2 vs Layer 3-Difference between Layer 2 and Layer 3
This page compares OSI Layer 2 Vs Layer 3 and mentions difference between Layer 2 and Layer 3. Layer 2 is known as Data link layer and Layer 3 is known as Network Layer in OSI Stack.
OSI stands for Open Systems Interconnection. This model has been developed to define modes of interconnection between different components in networking domain. Due to evolution of OSI stack, physical method of transport of data/information can be designed and developed independent of protocols as well as applications which are running above it.

As shown in the Figure-1 above there are 7 layers in OSI stack.
The layers are described below.
• Application Layer (layer 7):Message format, human-machine interfaces
• Presentation Layer (layer 6):Coding into 1s and 0s, encryption, compression
• Session Layer (layer 5): Authentication, permissions, session restoration
• Transport Layer (layer 4): End to end error control and reliable transfer of data,
does multiplexing and demultiplexing of applications in TCP/IP model.
In TCP/IP, layer 5 and layer 6 do not exist.
• Network Layer (layer 3): network addressing, switching or routing
• Data Link Layer (layer 2):Error detection, flow control
• Physical Layer (layer 1):Bit stream, physical medium, method to
represent bits
Refer Article on basics of OSI and TCPIP layers.
As mentioned each has their own functionalities. Moreover each of the layers support layer above it. For example, layer-1 supports layer-2, layer-2 supports layer-3 and so on. Here each layer adds header to the previous or layer above it except layer 2 which adds header as well as trailer.
Layer-3 Network Layer
Following are the functions of data link layer:
• It adds IP header to the transport layer data. IP header consists of useful
information such as source ip address, destination ip address, hops etc. IP addresses are used for IP packet routing till
it reaches destination.
• It also provides information on which transport layer protocol is used i.e. TCP or UDP based on Protocol field of
1 byte in size.
• It uses checksum in the IP header for data integrity purpose.
• Examples: IP, IPX
•
Layer 3 devices (e.g. routers, switches) works irrespective of contents of the packets (e.g. FTP, HTTP, SMTP).
It simply takes care of fromwhere the packet is originating and where it need to be forwarded.
Layer-2 Data Link Layer
Following are the functions of data link layer:
• It adds Ethernet header (consisting of source MAC address, destination MAC address, type fields) and
trailer (i.e. CRC of 4 bytes) to the layer 3 packet.
• The Layer 2 does not worry what the packet carries (i.e. IP, IPX, Appletalk) it just
uses MAC address to deliver the frame and CRC for error checking.
It uses type field which differentiate between IP packet (0x800) and ARP packet (0x806).
• Examples: Token Ring, Ethernet, Frame Relay
Features | OSI Layer 2 | OSI Layer 3 |
---|---|---|
Major Function | Error Detection, Flow control on physical link | Network addressing, routing or switching |
DoD model | Network Acces | Internet |
Protocols | ARP, RARP | IP, ICMP, IGMP |
Devices/Apps. | Bridge, Layer 2 Switch | Router, Firewall, Layer 3 Switch |
Unit of Data | Frame | Packet |
Header | Ethernet Header | IP Header |
LAN switching | Layer 2 switch does switching and filtering based on MAC address. | Layer 3 switch uses IP address. |
Networking related links
Basics of OSI and TCPIP layers
Networking Gateway
What is Router
What is an IP address
network switch
network bridge
Hub and Types of Hub
What is MAC address
What is Difference between
hub Vs switch circuit switching Vs packet switching firewall Vs router HDLC Vs PPP IGRP Vs EIGRP router Vs bridge switch Vs router WLAN Vs Ethernet LAN LAN vs WAN vs MAN