Expressvpn Glossary

Network layer

Network layer

What is the network layer?

The network layer is the third layer (Layer 3) of the Open Systems Interconnection (OSI) model, a seven-layer framework for understanding how data moves through networks. It’s responsible for logical addressing, routing data between networks, and forwarding data packets toward their destinations.

How does the network layer work?

The network layer uses logical addressing (such as IP addresses) to identify the source and destination of data as it moves across interconnected networks. It encapsulates data into packets and prepares them for routing through multiple networks. Before forwarding these packets, the network layer examines their destination addresses and chooses the best path using routing tables and knowledge of current network conditions.A flow diagram showing the five steps of how the network layer routes data.

If a packet is too large for a network’s maximum transmission unit (MTU), the network layer may fragment it into smaller units. Once these units reach the destination, they’re reassembled into the original packet. If issues occur during transmission (for example, an unreachable destination), the network layer uses protocols like Internet Control Message Protocol (ICMP) to send diagnostic or error messages back to the source.

The network layer sits above the data link layer (which handles local, link-level delivery) and below the transport layer, which manages reliable end-to-end communication. This positioning enables data to move smoothly across multiple, diverse networks.

Key functions of the network layer

  • Routing: The network layer determines the best route for data to travel from the source to the destination across multiple networks.
  • Logical addressing: The network layer uses unique logical addresses to identify the source and destination of packets. The network layer itself doesn’t assign these addresses, but they operate at this layer.
  • Packet forwarding: Once the network layer determines a route, it forwards each data packet through the network until it reaches its destination.
  • Fragmentation (and reassembly): If a packet is too large for a particular network link, the network layer splits it into smaller packets. At the destination, it reassembles them.
  • Error reporting: The network layer reports IP-level and routing problems via mechanisms like ICMP. The transport layer then handles these reports by reacting appropriately.

Why is the network layer important?

  • Interconnected device communication: The network layer enables communication across multiple networks by using logical addressing to identify the source and destination of data.
  • Efficient data delivery: It wraps data into packets and sends them through optimal paths across networks. That way, even distant devices can exchange data reliably.
  • Scalability for global connectivity: By using logical addressing to uniquely identify devices worldwide, the network layer allows large networks to be broken into sub-networks (subnets), enabling the internet to scale to billions of devices while keeping routing efficient.
  • Protocol foundation: The network layer is home to essential protocols like IP and ICMP, which handle tasks like addressing, routing, diagnostics, and error reporting.

Security and privacy considerations

Attackers can exploit the network layer through IP spoofing, which forges source addresses to hide the origin of traffic or impersonate trusted devices (a technique often seen in distributed denial-of-service (DDoS) attacks).

To reduce these risks, firewalls can block suspicious packets using rules like ingress and egress filtering and packet inspection. Pairing a firewall with a virtual private network (VPN) adds encryption and hides a user’s public IP address from external networks, protecting traffic from interception or tampering.

Further safeguards include using authenticated routing protocols and applying network segmentation to contain potential attacks.

Common network layer protocols

  • Internet Protocol (IP): Defines logical addressing (IP addresses) and places these addresses in every packet. It handles packet delivery across networks by determining how packets move from the source to the destination.
  • Internet Control Message Protocol (ICMP): Sends error messages and diagnostic information when a destination is unreachable or when network issues occur.
  • Internet Group Management Protocol (IGMP): Lets multiple devices subscribe to a group address so that one packet sent to that address reaches all members.
  • Address Resolution Protocol (ARP): Maps a device’s logical (IP) address to its physical Media Access Control (MAC) address so devices can communicate on the same local network. Note that ARP operates at the boundary of the network layer and the data link layer.

Further reading

FAQ

What is the main function of the network layer

The main function of the network layer is to route data packets from a source device to the correct destination, even if the devices sit on different networks.

How does the network layer differ from the data link layer?

The data link layer handles data transfer between devices on the same local network using physical Media Access Control (MAC) addresses and frames. In contrast, the network layer sends data across different networks using logical addresses.

What are examples of network layer protocols?

Common protocols at the network layer include the Internet Protocol (IP) for addressing and routing and the Internet Control Message Protocol (ICMP) for error messaging and diagnostics.

How does a VPN protect data at the network layer?

A VPN creates a secure, encrypted tunnel for network-layer packets. It encrypts data and masks the user’s public IP address, preventing outsiders from reading or tracing the traffic while it travels across the internet.

Get Started