The Network Layer refers to Layer 3 of the seven-layer Open Systems Interconnection (OSI) Model for network architecture. Algorithms and protocols in the Network Layer are responsible for identifying the optimal path to route and reliably deliver data packets from their source networks to their destination networks. As a component of the OSI conceptual framework, the Network Layer responds to service requests from Layer 4, the Transport Layer, and issues service requests to Layer 2, the Data Link Layer. In practice, it is made up of equipment, primary routers, and mechanisms such as the Internet Protocol (IP), necessary to transmit digitally encoded signals from source hosts across digital networks — such as the Internet — to destination hosts. Key functions of the Network Layer include addressing, congestion control, error handling, internetworking, and packet sequencing, routing, and forwarding.
Addressing and routing so as to ensure a required level of Quality of Service (QoS) are the main functions of the Network Layer. Residing there are IP and routing algorithms, protocols, and the Address Resolution Protocol (ARP). Data is transported across digital networks via routers and switches that use protocols to encapsulate it in a packet and algorithms that identify the best transmission path. This is known as packet switching.
Layer 3, or Network Layer, switching takes place when a packet arrives on one router interface and is forwarded on to another. Protocols that may be present in the Network Layer include the Datagram Delivery Protocol (DDP), Internet Control Message Protocol (ICMP), Internet Group Message Protocol (IGMP), and Internet Protocol Security (IPsec). Commonly used protocols that route information across networks include Routing Information Protocol (RIP), Open Shortest Path First (OSPF), Interior Gateway Routing Protocol (IGRP), Border Gateway Protocol (BGP), and Distance Vector Multicast Routing Protocol (DVMRP).
For routing information over the Internet, IP addresses are included in Network Layer message headers, thus providing the routers the information they require to decide how to manage the flow of data packets. The packet's destination IP address is checked when it is received on a router interface. If the router is not the packet's destination, the router will look up the network address in its routing table. An exit interface is selected, and the packet is sent to the interface to be framed and forwarded over the local network. The router drops the packet if the destination network entry is not found in the routing table.