Located at Layer 3 of the Open Systems Interconnection (OSI) communications model, the network layer's primary function is to move data into and through other networks. Network layer protocols accomplish this goal by packaging data with correct network address information, selecting the appropriate network routes and forwarding the packaged data up the stack to the transport layer (Layer 4). Existing protocols that generally map to the OSI network layer include the IP portion of the Transmission Control Protocol/Internet Protocol (TCP/IP) model -- both IPv4 and IPv6 -- as well as NetWare Internetwork Packet Exchange/Sequenced Packet Exchange (IPX/SPX).
The routing information contained within a packet includes the source of the sending host and the eventual destination of the remote host. This information is contained within the network layer header that encapsulates network frames at the data link layer (Layer 2). The key difference -- and importance -- between transport information contained at Layer 2 when compared to transport information contained at the network layer is that the information can move beyond the local network to reach hosts in remote network locations.
Functions of the network layer
The primary function of the network layer is to permit different networks to be interconnected. It does this by forwarding packets to network routers, which rely on algorithms to determine the best paths for the data to travel. These paths are known as virtual circuits. The network layer relies on the Internet Control Message Protocol (ICMP) for error handling and diagnostics to ensure packets are sent correctly. Quality of service (QoS) is also available to permit certain traffic to be prioritized over other traffic. The network layer can support either connection-oriented or connectionless networks, but such a network can only be of one type and not both.