The Wayback Machine - https://web.archive.org/web/20240906211026/https://www.geeksforgeeks.org/working-of-different-layers-in-computer-network/
Open In App

Working Of Different layers in Computer Network

Last Updated : 29 Jun, 2022
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

Ever wondered how different layers of network work together to send a message. Lets understand some basic terms before getting into details. 
 

  • A Default Gateway serves as an access point or IP router that a networked computer uses to send information to a computer in another network or the internet. 
     
  • Address Resolution Protocol (ARP) request is a protocol which converts IP address into MAC address. 
     
  • A Routing tables is a set of rules, often viewed in table format, that is used to determine where data packets traveling over an Internet Protocol (IP) network will be directed. 
     

Generally a host or a computer has all layers (from application layer to physical layer ) and a router has network, data link layer and a physical layer. 

Now lets understand the working of different layers with the help of an example. 

 

Suppose you want to send a message to an application on host2 (assume it is present in different network). 
Let the IP and MAC address of host1 be I1 , M1 and IP and MAC address of host2 be I2 , M2. Suppose the default gateway of host1 be router1(IP address be IR1, Mac address be MR1) and the default gateway of host2 be router2 (IP address be IR2, Mac address be MR2). 

At Host1: 
Suppose the application layer wants to send a message M to host2. The application layer of host1 gives it to transport layer of host1. Transport layer will add header to the message M which contains the port number of host1, host2(x,y). Therefore now the message will be (M,x,y) and this will be given to network layer of host1. Network layer also adds an header to the message which contains the Ip address of host1 and host2. 

Now the message will be (M,x,y,I1,I2) and it will be given to DataLink layer. Data link layer also adds an header for the message before giving it to the physical layer. Since the host2 is not present in the same network it will put the mac address of host1 and mac address of default gateway (it will know the mac address by sending an ARP request). Now the message will be (M,x,y,I1,I2,M1,MR1) and this will be given to physical layer. Physical layer converts the given message to bits and sends it the router1. 

 

At Router1: 
The physical layer will convert the bits into message and will inform the datalink layer that this packet should be processed after seeing the Mac address of router1. After seeing the packet the datalink layer of router1 will send an acknowledgement to datalink layer host1 and will remove the header information added at DLL of host1 before giving it to Network layer of router1. The message that network layer gets is (M,x,y,I1,I2). 

Network layer sees the destination Ip address and since the destination is not present in its network it will decide it forward it router2. Network layer of router1 decides it after seeing the routing tables at router1 and will decide it.Now the DLL of router adds header to the message. This time the source mac address will be MR1 and destination MAC address will be MR2 (using Arp it finds out). In this way the receiver only knows the Ip address of source and it will never know the mac address of the source. Now the message will be (M,x,y,I1,I2,MR1,MR2) and it will be given to physical layer. The physical layer converts it to bits and sends it router2. 

 

At Router2: 
The physical layer will convert the bits into message and will inform the DLL of router2.Now the DLL of router2 will send an acknowledgement to DLL of router1 after seeing the message. DLL of router2 will remove the MAC address and give it to network layer. 

Now the network layer finds out that the host2 is in the network to which the router2 is connected so it will send the message to host2. Network layer finds out that host2 is in the same network after seeing the routing tables present at the router2.N ow the DLL will add the header information with mac address of router2 (sender) and M2(destination) (it finds out using ARP request). Now the message will be (M,x,y,I1,I2,MR2,M2) and will be given to physical layer which converts it to bits and sends it host2. 

 

At Host2: 
The physical layer will convert it into bits and will give the message to DLL. DLL sends an acknowledgment to DLL of router2 and removes the MAC address on the message, which will be given to NL. Now the network layer will remove the IP address and gives it Transport layer. 

Now the transport layer will send an acknowledgment to Transport Layer of host1 (in case of TCP since it has the IP address of host1. The message will be (M,y,x,I2,I1)) and removes the port number and gives the message to the process(or application) present at y. 

 

Note: 
 

  1. Since Transport layer is responsible for end to end connectivity , transport layer of host2 sends an acknowledgment to transport layer of host1. 
     
  2. DataLink layer is responsible for hop to hop connectivity , each time a router/host receives a packet acknowledgment is sent to respective data link layers. 
     
  3. Network layer takes care of bit level error and transport layer takes care of packet errors. 
     
  4. Routers MAC address is temporary because ISP generally changes the NIC (Network Interface Card) which contains the MAC address. So default gateway IP address is shared to hosts and other routers and not MAC address. 
     

This is how the message from one host is delivered to another host on different network.
 



Similar Reads

Why Star network is More Efficient in Network Fault Tolerance in Place of Bus Network?
Answer: Star networks offer better fault tolerance than bus networks because a single point of failure in a star network (the central hub) affects only the connected device, while a fault in a bus network can disrupt communication for all devices on the bus.Advantages of Star Topology Over Bus Topology Individual Connection Points: In a star networ
2 min read
Basic Network Attacks in Computer Network
Many people rely on the Internet for many of their professional, social and personal activities. But there are also people who attempt to damage our Internet-connected computers, violate our privacy and render inoperable the Internet services. Given the frequency and variety of existing attacks as well as the threat of new and more destructive futu
7 min read
How to Find Network IP Address of Computer Using Computer Name?
Answer: By using the command "ping" followed by the computer name in the command prompt or terminal.To find the network IP address of a computer using its computer name: Open Command Prompt or Terminal Begin by opening the Command Prompt (Windows) or Terminal (macOS/Linux) on your computer. Use the Ping Command Type "ping" followed by the computer
1 min read
Difference between Storage Area Network (SAN) and Network Attached Storage (NAS)
Storage Area Network (SAN) is used for transferring the data between the servers and the storage devices' fiber channels and switches. In SAN (Storage Area Network), data is identified by disk block. Protocols that are used in SAN are SCSI (Small Computer System Interface), SATA (Serial Advanced Technology Attachment), etc. Components of Storage Ar
2 min read
Differences between Wireless Adhoc Network and Wireless Sensor Network
1. Wireless Adhoc Network: A wireless ad-hoc network is a wireless network deployed without any framework or infrastructure. This incorporates wireless mesh networks, mobile ad-hoc networks, and vehicular ad-hoc networks. Its history could be traced back to the Defense Advanced Research Project Agency (DARPA) and Packet Radio Networks (PRNET) which
3 min read
Difference between Next Generation Network and Traditional Network
1. Next Generation Network : In short Next Generation Network is termed as NGN which is packet based network used for both telephony and data. It uses multiple broadband and Quality of Services (QoS) enabled transport technologies to establish advance communication system. NGN can handle multiple type of services/traffic such as voice, audio, video
5 min read
Difference between Network Administrator and Network Engineer
1. Network Administrator :A network administrator is a someone in an organization whose job is to manage organization's computer network. They also do jobs like on-site server organization , software networking and also placing the network in there correct position which is also called as Network Integrity. Those are the main thing in their job to
3 min read
Difference Between Network Security and Network Administration
In the world of information technology, there are two important and distinct roles that are often confused: network security and network administration. While these two jobs may be closely related, they require different sets of skills and responsibilities. It’s significant to understand the differences between network security and network administ
5 min read
Difference Between Network Management and Network Monitoring
Pre-requisites: Areas of Network Management Network management and Network monitoring are two important functions in maintaining the performance and security of a network. While they are often used interchangeably, they are distinct concepts with different goals and methods. Network management refers to the process of controlling, configuring, and
3 min read
Difference Between Network Congestion and Network Latency
Network congestion refers to a situation in which a network experiences an excessive amount of traffic, resulting in a reduction of available bandwidth and increased delays for network users. This can occur in both wired and wireless networks and can have a significant impact on the performance and reliability of the network. Congestion can occur d
9 min read
How Does a Network Topology Affect Your Decision in Setting up a Network?
Answer: Different Network Topology offer different costs, security, reliability, etc. So we choose one of the network topology as a blueprint for setting up our network according to the features that we required.By Network Topology we get to know how different nodes are connected in the network. There are different types of network topology like Bu
2 min read
How does a Network Interface Card (NIC) Facilitate Connectivity in a Wired Network?
Answer: A network interface card (NIC) facilitates connectivity in a wired network by providing an interface between the physical layer which provides the physical connection with the cables and the data link layer which provides reliable communication channel. The NIC converts the digital data into electrical data so that it can be transferred usi
2 min read
Difference Between Network Topology and Network Protocols
Network Topology and Network Protocols are closely related but distinct concepts in the field of computer networking. Network Topology refers to the physical and logical arrangement of devices on a network, while Network Protocols refer to the rules and standards that govern the communication between devices on a network. Understanding the differen
5 min read
Difference between Software Defined Network and Traditional Network
Whenever it comes to networks, new trends keep on adding up and thus it becomes essential to know about the dissimilarities that SDN Networks and Traditional Networks possess. Given the ever-increasing need for the expansion, fault tolerance, and resource optimization of the networks that connect today’s business environments, organizations, and IT
7 min read
Packet flow in different Network
Prerequisite - How ARP works, Packet flow in the same network To deliver the packet to the destination host, the source IP, destination IP, source MAC address and destination MAC address should be known. Some basic rules for the packet flow: If the destination host is present in the same network, then the packet is delivered directly to the destina
4 min read
Different Ways to Prepare an IT Network for IoT
Several complexities are arising when new devices and appliances are embedded into the existing IT infrastructure. It may lead to loss of data and stalled supply chains if the network is failed in a commercial context. Now the internet users are using effective network monitoring tools for handling the IT environment in a secure Internet of Things
3 min read
MAC Filtering in Computer Network
There are two kinds of network Adapters. A wired adapter allows us to set up a connection to a modem or router via Ethernet in a computer whereas a wireless adapter identifies and connects to remote hot spots. Each adapter has a distinct label known as a MAC address which recognizes and authenticates the computer. Mac address is shown in the format
10 min read
DHCP Relay Agent in Computer Network
Prerequisite - Dynamic Host Configuration Protocol (DHCP), How DHCP server dynamically assigns IP address to a host? To assign an IP address to the host dynamically, the DHCP client exchanges DHCP messages with the DHCP server in the DORA process. In the DORA process, the discover and request message is broadcast, the offer and the acknowledgement
6 min read
Redundant Link problems in Computer Network
Basically, redundant links are used to prevent nasty network failure. These are used to provide redundancy, i.e back up when a link fails, i.e a frame can be forwarded out through another path but it can cause problems also. Here are some of these problems: Broadcast Storm - A switch forwards out the broadcast frame, generated by another device, to
4 min read
Port Security in Computer Network
Attackers' task is comparatively very easy when they can enter the network they want to attack. Ethernet LANs are very much vulnerable to attack as the switch ports are open to use by default. Various attacks such as Dos attack at layer 2, address spoofing can take place. If the administrator has control over the network then obviously the network
3 min read
EtherChannel in Computer Network
EtherChannel is a port link aggregation technology in which multiple physical port links are grouped into one logical link. It is used to provide high-speed links and redundancy. A maximum of 8 links can be aggregated to form a single logical link. EtherChannel, also known as Link Aggregation Control Protocol (LACP), is a technique used in computer
5 min read
Bit Stuffing in Computer Network
The data link layer is responsible for something called Framing, which is the division of stream of bits from network layer into manageable units (called frames). Frames could be of fixed size or variable size. In variable-size framing, we need a way to define the end of the frame and the beginning of the next frame. Bit stuffing is the insertion o
2 min read
Computer Network | AAA (Authentication, Authorization and Accounting)
The administrator can take access to a router or a device through a console but it is very inconvenient if he is sitting far from the place of that device. So, eventually, he has to take remote access to that device. But as remote access will be available by using an IP address, therefore, it is possible that an unauthorized user can take access us
4 min read
Types of MANET in Computer Network
Prerequisite - MANET: Mobile Ad hoc Network MANET stands for Mobile ad hoc Network also called as wireless ad hoc network or ad hoc wireless network. They consist of a set of mobile nodes connected wirelessly in a self-configured, self-healing network without having a fixed infrastructure. MANET nodes are free to move randomly as the network topolo
12 min read
Redistribution in Computer Network
Often, using a single routing protocol in an organisation is preferred but there are some conditions in which we have to use multi protocol routing. These conditions include multiple administrator running multiple protocols, company mergers or usage of multi-vendors devices. Therefore, we have to advertise a route learned through a routing protocol
5 min read
Type-C Port in Computer Network
Type-C (or USB-C) is a 24-pin USB connector system. This is distinguished by its two-fold rotationally symmetrical connector. The USB Type-C Specification 1.0 was published by the USB Implementers Forum (USB-IF). It was finalized in August 2014. A device that implements USB-C does not necessarily implement USB Power Delivery, USB 3.1, or Alternate
4 min read
Asynchronous Transfer Mode (ATM) in Computer Network
Why ATM networks? Driven by the integration of services and performance requirements of both telephony and data networking: "broadband integrated service vision" (B-ISON). Telephone networks support a single quality of service and are expensive to boot. Internet supports no quality of service but is flexible and cheap. ATM networks were meant to su
5 min read
Puzzle | Eliminating Virus from a Computer Network
In a network of infinitely many computers, 650 computers got infected with certain virus. The IT support team has access to five different types of antivirus software packages (let us call them A, B, C, D and E) that can work on eliminating this virus. Each of the antivirus software packages 'X' can eliminate virus from Xr infected computers if the
3 min read
Elements of Computer Network
Computer Network is a system in which multiple nodes are connected to each other to share information and resources. A computer network allows sharing of resources between different nodes connected within it. Computer Network Elements: The objects basically used in a computer network are known as Computer Network Elements (CNEs). There are basicall
3 min read
Functionality of Computer Network
Prerequisite - Basics of Computer Networking, Network goals, Layers of OSI Model, Transport Layer responsibilities When a client is present on one machine and server is present on another machine, then making a connection between them, is called computer network.Computer networks share common devices, functions, and the features of computer network
4 min read
Article Tags :