Network Layer (Layer 3)

Network Layer (Layer 3)

The Network Layer is the third layer of the TCP/IP protocol stack from the bottom. The TCP/IP model network layer’s (layer 3) functions are similar to the network layer (layer 3) of the OSI model.

network-layer.jpg

The major protocols included in the Network layer (Layer 3) are Internet Protocol (IPv4 or IPv6), Internet Control Message Protocol (ICMP), Address Resolution Protocol (ARP), Reverse Address Resolution Protocol (RARP) and Internet Group Management Protocol (IGMP).

The real data for network communication is normally generated by the Application layer protocols (HTTP, HTTPS, FTP, SMTP etc.). The data from the Application layer protocols are encapsulated using a Transport layer protocol header (TCP or UDP). The name of the data packet generated by TCP is called as TCP Segment and the name of data packet generated by UDP is called as UDP datagram. At the Network Layer, the data received from its upper layer (Transport layer) is again encapsulated in Network Layer header (usually with IPv4 header or IPv6 header) and then passed to down to its bottom layer (Datalink layer).

Network Layer (Layer 3) again encapsulates the data packets generated by the Transport layer protocols (Transmission Control Protocol (TCP)/User Datagram Protocol (UDP)), while moving down the TCP/IP protocol stack during an outgoing transmission.

A graphical representation of Network layer encapsulation is shown below.

network-layer-encapsulation.jpg

One of the most important functions of computer networking, “Routing” is associated with Network Layer (Layer 3). Routing is a function of computer networking where IP datagrams from a computer residing on one network are forwarded to another computer on a remote network. Normally Routing is done by network Routers. The function of routing can also be done by a routing capable firewall device or even by a routing capable computer with two network ports / NICs installed.

Please refer below image to understand what is Routing.

network-layer-lan-to-lan-routing.jpg

As we learned in previous lessons, two different Local Area Networks (LANs) are connected together by a network infrastructure device called “Router”. Refer above image. If “Computer A” from one LAN wants to send data to “Computer B” of another LAN, “Computer A” will place the data as bit stream over the network media. Following describes the data flow path.

1 – Computer A to Network Switch of LAN 1

2 – Network Switch of LAN 1 to Router of LAN 1

3 – Router of LAN 1 to Router of LAN 2 via Internet Cloud

4 – Router of LAN 2 to Network Switch of LAN 2

5 – Network Switch of LAN 2 to Computer B

From the above picture we can understand that the main function of a Router is to forward IP datagrams from one network to another remote network. The router also receives IP datagrams forwarded from another network and pass it to a computer residing in its own network

We had learned from the Datalink layer lesson that the switches operate at layer 2 (datalink layer) of the TCP/IP model. Another important fact about networking is that the Routers operate at network layer (layer 3) of the TCP/IP model.

The simple meaning of the phrase “routers operates at layer 3 (network layer)” is that the router opens network layer header (layer 3 header) and use the address information in the IP datagram header to deliver the IP datagram to the router at the destination LAN and finally to the exact computer (in above case, “Computer B”) at the destination LAN.

A router finds the destination network address where the data to be delivered by using the addresses at network layer header (IPv4 header or IPv6 header). As you can see from the network layer IP datagram header format, the addresses inserted at the IP datagram header are IP addresses (IPv4 or IPv6). IP addresses are also called as layer 3 addresses, or logical addresses.

network-layer-routing.jpg

IP datagram packets (name of the data packet generated by the Internet Protocol at layer 3 network layer) from the source network must be delivered to the exact intended device (computer) located at the remote destination network. The main function of the network layer (layer 3) is routing IP datagram packets from the source network to the correct destination network. Routing is the process of selecting best path / paths in a network along which to send the IP Datagrams (name of the data packet generated by the Internet Protocol at layer 3 network layer) efficiently.

Other related functions of network layer (layer 3) are Fragmentation and Reassembly of IP datagrams and IP addressing. Fragmentation is the process of splitting IP datagrams into smaller units so that they can traverse low MTU (Maximum Transmission unit) network segments. Maximum Transmission unit (MTU) is limit imposed on the maximum size of the IP datagram by datalink layer (layer 2) protocol.

To get more wider view about different layers of TCP/IP protocol stack and how they operate together, please visit and learn below lessons in order.

You have learned about network layer (layer 3) of TCP/IP model, functions of network layer, the need for routing in networking, the meaning of phrase “routers operate at layer 3 (network layer)”. Click next link to continue.