What does Layer 2 and Layer 3 Networking Mean?

Network communication is not a single process - instead devices use a series of layers to connect and share information. The Open Systems Interconnection (OSI) 7 Layer model provides a framework to understand how this information is sent across the house, the building, or even the world.

The 7 layers are:

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

How is the OSI 7-Layer model used in the real world?

When we send information to someone else, the Layer 7 application, such as an email client, sends data down the layers adding presentation and session information, and then deciding on the Layer 4 transport protocol to use (usually TCP for connection-based communication like email, and UDP for real-time best effort communication like streaming video). Layer 4 also breaks the data into chunks called packets to make sending it more manageable.

Each data packet now gets sender and receiver addresses added at the network and data link layers, and is finally sent down the ‘wire’ (the physical layer) as a digital signal made up of a series of 1’s and 0’s. At the receiver’s end, the arriving string of 1’s and 0’s gets checked to be sure the receiver has the expected address, and then all packets are reassembled into that email by the layer 7 application so you can read it.

So, let’s look at how layers 2 and 3 use addressing for forwarding data.

Layer 2: The Data Link Layer – hardware addressing.

The Data Link Layer (Layer 2) plays a critical role in local area networks (LANs). Sometimes LANs are also broken up into smaller sub-networks known as Virtual LANs (VLANs) to make business networks more efficient and easier to keep secure.

Layer 2 is responsible for the following key tasks:

  1. Hardware addressing: Layer 2 uses unique device identifiers called MAC (Media Access Control) addresses. These are permanent hardware addresses added to devices by vendors when they are manufactured.
  2. Forwarding data: With source and destination MAC addresses added to each packet, the network knows the hardware address of the receiving device. If the receiver is within the same VLAN, a network switch can intelligently Layer-2 switch the data out the correct port on its way to the end device.
  3. Error Detection: To ensure the integrity of data transmission, Layer 2 employs error detection mechanisms, such as CRC (Cyclic Redundancy Check), which can identify and correct errors in the transmitted data.
  4. Flow Control: Layer 2 manages the flow of data between devices by controlling the rate at which frames are sent and received. This prevents slower devices from being overwhelmed by faster devices on the network.

Layer 3: The Network Layer – logical addressing.

The Network Layer (Layer 3) enables much larger scale communication, with data sent between VLANs inside a business network, and then right across the world using the Internet.

Layer 3 is responsible for the following essential tasks:

  1. Logical Addressing: Layer 3 uses IP (Internet Protocol) addresses to uniquely identify devices. These are logical addresses, and addressing schemes are set up to maximize the network topology and ensure secure and efficient data transfer.
  2. Forwarding data: IP addresses are used to determine the most efficient path for data to travel between source and destination devices. Network switches intelligently Layer-3 switch data (also known as routing) between VLANs, or to a router at the edge of the LAN to be sent out across the internet.
  3. Fragmentation and Reassembly: Layer 3 can fragment and reassemble packets when necessary to accommodate different network technologies with varying maximum transmission unit (MTU) sizes.

In conclusion

The seamless interaction between Layer 2 and Layer 3 is crucial for efficient and reliable data transmission.

Network switches use both Layer 2 MAC addresses and Layer 3 IP addresses to efficiently forward data depending on where the receiver device resides Layer 2 switching within a VLAN, and Layer 3 switching between VLANs.

Routers sit at the edge of the LAN and connect a home or business network to the Internet, so data can be routed using Layer 3 IP addresses to or from anywhere across the world.

Together, these layers create a robust and flexible networking infrastructure that can dynamically adapt to a wide range of scenarios, and to any changes made to networks both locally and globally.