Computer Networks Complete Notes | BCA/BSc CS | Khalsa College Mohali, Lecture notes of Computer Networks

Comprehensive notes on Computer Networks for BCA/BSc CS students at Khalsa College Mohali. Covers OSI model, TCP/IP, topologies, protocols, subnetting, and more. Ideal for semester exam preparation.

Typology: Lecture notes

2025/2026

Available from 04/06/2026

sukhmeen-dhiman
sukhmeen-dhiman 🇮🇳

15 documents

1 / 41

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
COMPUTER NETWORK
The TCP/IP model (Transmission Control
Protocol/Internet Protocol) is a four-layer networking
framework that enables reliable communication between devices
over interconnected networks.
It provides a standardized set of protocols for transmitting data
across interconnected networks, ensuring efficient and error-free
delivery.
Each layer has specific functions that help manage different aspects
of network communication, making it essential for understanding
and working with modern networks.
TCP/IP was designed and developed by the Department of Defense
(DoD) in the 1970s and is based on standard protocols.
The TCP/IP model is a concise version of the OSI model.
It contains four layers, unlike the seven layers in the OSI model.
Role of TCP/IP
TCP/IP enables interoperability between diverse systems over
various network types (e.g., copper, fiber, wireless).
It ensures seamless communication across LANs, WANs, and the
internet.
Without TCP/IP, large-scale global networking would not be possible.
The main condition of this process is to make data reliable and
accurate so that the receiver will receive the same information
which is sent by the sender.
To ensure that, each message reaches its final destination
accurately, the TCP/IP model divides its data into packets and
combines them at the other end, which helps in maintaining the
accuracy of the data while transferring from one end to another end.
Layers of TCP/IP Model
It’s composed of four interconnected layers compared to the seven
layers in the OSI model.
Each layer performs a specific task on the data that is being
transmitted over the network channel, and data moves from one
layer to another.
Application Layer
Transport Layer(TCP/UDP)
Network/Internet Layer(IP)
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29

Partial preview of the text

Download Computer Networks Complete Notes | BCA/BSc CS | Khalsa College Mohali and more Lecture notes Computer Networks in PDF only on Docsity!

COMPUTER NETWORK

 The TCP/IP model (Transmission Control

Protocol/Internet Protocol) is a four-layer networking

framework that enables reliable communication between devices over interconnected networks.  It provides a standardized set of protocols for transmitting data across interconnected networks, ensuring efficient and error-free delivery.  Each layer has specific functions that help manage different aspects of network communication, making it essential for understanding and working with modern networks.  TCP/IP was designed and developed by the Department of Defense (DoD) in the 1970s and is based on standard protocols.  The TCP/IP model is a concise version of the OSI model.  It contains four layers, unlike the seven layers in the OSI model.

 Role of TCP/IP

 TCP/IP enables interoperability between diverse systems over various network types (e.g., copper, fiber, wireless).  It ensures seamless communication across LANs, WANs, and the internet.  Without TCP/IP, large-scale global networking would not be possible.  The main condition of this process is to make data reliable and accurate so that the receiver will receive the same information which is sent by the sender.  To ensure that, each message reaches its final destination accurately, the TCP/IP model divides its data into packets and combines them at the other end, which helps in maintaining the accuracy of the data while transferring from one end to another end.

 Layers of TCP/IP Model

 It’s composed of four interconnected layers compared to the seven layers in the OSI model.  Each layer performs a specific task on the data that is being transmitted over the network channel, and data moves from one layer to another.  Application Layer  Transport Layer(TCP/UDP)  Network/Internet Layer(IP)

 Network Access Layer

 Application Layer

 The Application Layer is the closest to the end user and is where applications and user interfaces reside. It serves as the bridge between user programs and the lower layers responsible for data transmission.

 Function : Provides services and interfaces for end-user

applications to access network resources.

 Key responsibilities:

 Supports application protocols like HTTP, FTP, SMTP, DNS, etc.  Enables communication between software applications across networks.  Handles data formatting, encryption, and session management.

 Transport Layer

 This layer ensures data is delivered reliably and in the correct order between devices.  The two main protocols in this layer are TCP (Transmission Control Protocol) and UDP (User Datagram Protocol).

 Function : Ensures reliable or unreliable delivery of data between

hosts.

 Key responsibilities:

 TCP (Transmission Control Protocol): Provides reliable, connection- oriented delivery with error checking, retransmission, and flow control.  UDP (User Datagram Protocol): Provides faster, connectionless transmission without guarantees.  Manages flow control and segmentation/reassembly of data.

 Internet Layer

 It handles the routing of data packets across networks.  It uses the Internet Protocol (IP) to assign unique  IP addresses to devices and decide the most efficient path for data to reach its destination.

 Ensures reliable delivery (TCP) or fast, connectionless delivery (UDP).

 Internet Layer (IP)

 Adds IP addresses to each packet (source and destination).  Determines the route the packet should take to reach the destination.

 Link Layer (Network Access Layer)

 Converts packets into frames, adds MAC (physical) addresses.  Sends data as binary bits (0s and 1s) over the physical medium (e.g., Ethernet, Wi-Fi).

 Why TCP/IP is Used Over the OSI Model

 Reason - Explanation  Simpler Structure - TCP/IP has only 4 layers, making it easier to implement.  Protocol-Driven Design - TCP/IP was designed based on working protocols, while the OSI model is more of a theoretical framework.  Flexibility and Robustness - TCP/IP adapts well to different hardware and networks and includes error handling, routing, and congestion control.  Open Standard - TCP/IP is open, free to use, and not controlled by any single organization, helping it gain universal acceptance.  Actual Use vs Conceptual Model - The OSI model is great for education and design principles, but TCP/IP is the one actually used in real-world networking.

 Advantages of TCP/IP Model

 Interoperability : The TCP/IP model allows different types of

computers and networks to communicate with each other, promoting compatibility and cooperation among diverse systems.

 Scalability : TCP/IP is highly scalable, making it suitable for both

small and large networks, from local area networks (LANs) to wide area networks (WANs) like the internet.

 Standardization : It is based on open standards and protocols,

ensuring that different devices and software can work together without compatibility issues.

 Flexibility : The model supports various routing protocols, data

types, and communication methods, making it adaptable to different networking needs.

 Reliability : TCP/IP includes error-checking and retransmission

features that ensure reliable data transfer, even over long distances and through various network conditions.

 Disadvantages of TCP/IP Model

 Security Concerns : TCP/IP was not originally designed with

security in mind. While there are now many security protocols available (such as SSL/TLS), they have been added on top of the basic TCP/IP model, which can lead to vulnerabilities.

 Inefficiency for Small Networks : For very small networks, the

overhead and complexity of the TCP/IP model may be unnecessary and inefficient compared to simpler networking protocols.

 Limited by Address Space : Although IPv6 addresses this issue,

the older IPv4 system has a limited address space, which can lead to issues with address exhaustion in larger networks.

 Data Overhead : TCP the transport protocol, includes a significant

amount of overhead to ensure reliable transmission. This can reduce efficiency, especially for small data packets or in networks where speed is crucial.  Protocols in the data link layer are designed so that this layer can perform its basic functions: framing, error control and flow control.  Framing is the process of dividing bit - streams from physical layer into data frames whose size ranges from a few hundred to a few thousand bytes.  Error control mechanisms deals with transmission errors and retransmission of corrupted and lost frames.  Flow control regulates speed of delivery and so that a fast sender does not drown a slow receiver.

 Types of Data Link Protocols

 Data link protocols can be broadly divided into two categories, depending on whether the transmission channel is noiseless or noisy.

 Simplex Protocol

 The Simplex protocol is hypothetical protocol designed for unidirectional data transmission over an ideal channel, i.e. a channel through which transmission can never go wrong. It has distinct procedures for sender and receiver. The sender simply sends all its data available onto the channel as soon as they are available its

 Protocol 1 − Unrestricted simplex protocol  Protocol 2 − Simplex stop and wait protocol  Protocol 3 − Simplex protocol for noisy channels  Let us discuss each protocol one by one.

 Unrestricted Simplex Protocol

 Data transmitting is carried out in one direction only. The transmission (Tx) and receiving (Rx) are always ready and the processing time can be ignored. In this protocol, infinite buffer space is available, and no errors are occurring that is no damage frames and no lost frames.

 Simplex Stop and Wait protocol

 In this protocol we assume that data is transmitted in one direction only. No error occurs; the receiver can only process the received information at finite rate. These assumptions imply that the transmitter cannot send frames at rate faster than the receiver can process them.  The main problem here is how to prevent the sender from flooding the receiver. The general solution for this problem is to have the receiver send some sort of feedback to sender, the process is as follows −  Step1 − The receiver send the acknowledgement frame back to the sender telling the sender that the last received frame has been processed and passed to the host.  Step 2 − Permission to send the next frame is granted.  Step 3 − The sender after sending the sent frame has to wait for an acknowledge frame from the receiver before sending another frame.  This protocol is called Simplex Stop and wait protocol, the sender sends one frame and waits for feedback from the receiver. When the ACK arrives, the sender sends the next frame.

 Simplex Protocol for Noisy Channel

 Data transfer is only in one direction, consider separate sender and receiver, finite processing capacity and speed at the receiver, since it is a noisy channel, errors in data frames or acknowledgement frames are expected. Every frame has a unique sequence number.

 After a frame has been transmitted, the timer is started for a finite time. Before the timer expires, if the acknowledgement is not received , the frame gets retransmitted, when the acknowledgement gets corrupted or sent data frames gets damaged, how long the sender should wait to transmit the next frame is infinite.

 Difference Between TCP and UDP at Transport Layer

- TCP

UDP

 TCP is a connection-oriented protocol UDP is the connection-less protocol  TCP is reliable. UDP is not reliable.  TCP supports error-checking mechanisms. UDP has only the basic error-checking mechanism using checksums..  No acknowledgment is present. Acknowledgement is present.  TCP is slower than UDP UDP is faster, simpler, and more efficient than TCP.  Retransmission of lost packets is possible There is no retransmission.  TCP has a (20-60) bytes variable length header. The header length is fixed of 8 bytes.

 Transport Layer: Design issues

 The Transport Layer in networking plays a critical role in ensuring reliable end-to-end communication between applications running on different hosts across a network. Its design involves addressing several key issues to achieve efficient and effective data transmission. Here are the design issues in detail:  Reliability:  Objective: Ensure that data delivered from the sender to the receiver is accurate and in the correct order, without errors or duplication.  Techniques:  Acknowledgment and Retransmission: Use of acknowledgments (ACKs) from the receiver to confirm receipt of data segments. If ACK

 Techniques:  Selective Repeat and Go-Back-N: Two types of ARQ (Automatic Repeat reQuest) protocols used in sliding window mechanisms to handle lost or corrupted data segments.  Timeouts: Set timers to wait for acknowledgments (ACKs). If an ACK is not received within the timeout period, the sender assumes the segment is lost and retransmits it.  Quality of Service (QoS):  Objective: Prioritize traffic and allocate network resources based on application requirements (e.g., latency-sensitive applications like VoIP or video streaming).  Techniques:  Traffic Prioritization: Assign different priorities to data packets based on QoS parameters (e.g., delay, throughput, jitter).  Congestion Control: Adjust transmission rates dynamically to avoid network congestion and ensure fair resource allocation among competing flows.  Segmentation and Reassembly:  Objective: Divide large data units received from the upper layers into smaller segments for efficient transmission over the network.  Techniques:  Maximum Segment Size (MSS): Largest amount of data that TCP can send in one segment.  Fragmentation: Splitting of data packets into smaller units to fit within the maximum transmission unit (MTU) size of the underlying network.  Security:  Objective: Ensure data confidentiality, integrity, and availability during transmission.  Techniques:  Encryption: Use of cryptographic techniques (e.g., SSL/TLS for TCP) to encrypt data to protect against eavesdropping and unauthorized access.  Authentication: Verification of identities using digital certificates or passwords to prevent unauthorized access or data tampering.  The design issues in the Transport Layer are crucial for ensuring reliable, efficient, and secure communication across networks. By addressing these issues effectively through protocols like TCP and UDP, the Transport Layer facilitates seamless data transmission,

error recovery, flow control, and multiplexing, supporting a wide range of applications and services in modern networking environments. These design considerations play a vital role in optimizing network performance, enhancing user experience, and ensuring the integrity of transmitted data.  Elements of transport protocols encompass several crucial aspects that ensure efficient and reliable communication between devices over a network. Here’s a detailed explanation of the key elements: addressing, connection establishment and release, flow control, and buffering.  Addressing:  Purpose: Addressing in transport protocols identifies specific communication endpoints (hosts and applications) within a network. It allows data to be directed to the correct destination.  Key Points:  Port Numbers:  Definition: Port numbers are used to distinguish different services or applications running on a single host.  Range: TCP and UDP each have a range of 0 to 65,535 available for port numbers, with well-known ports (0-1023) reserved for standard services (e.g., HTTP, FTP).  Socket Addressing:  Definition: Combines IP address and port number to uniquely identify a communication endpoint (socket) in a network.  Format: For TCP/IP, a socket is represented as a combination of IP address and port number (e.g., 192.168.1.1:80).  Header Fields:  TCP Header: Contains source and destination port numbers to identify the endpoints of a connection.  UDP Header: Similar port fields but used in connectionless communication.  Connection Establishment and Release:  Purpose: Establishing and releasing connections allows for reliable and orderly transmission of data between sender and receiver.  Key Points:  Connection-Oriented Protocols (e.g., TCP):  Three-Way Handshake:  SYN (Synchronize): Initiates a connection request from the sender.

 TCP takes into account the level of congestion in the network.  Applications of TCP  World Wide Web (WWW) : When you browse websites, TCP ensures reliable data transfer between your browser and web servers.  Email : TCP is used for sending and receiving emails. Protocols like SMTP (Simple Mail Transfer Protocol) handle email delivery across servers.  File Transfer Protocol (FTP) : FTP relies on TCP to transfer large files securely. Whether you’re uploading or downloading files, TCP ensures data integrity.  Secure Shell (SSH) : SSH sessions, commonly used for remote administration, rely on TCP for encrypted communication between client and server.  Streaming Media : Services like Netflix, YouTube, and Spotify use TCP to stream videos and music. It ensures smooth playback by managing data segments and retransmissions.

 Advantages of TCP

 It is reliable for maintaining a connection between Sender and Receiver.  It is responsible for sending data in a particular sequence.  Its operations are not dependent on Operating System.  It allows and supports many routing protocols.  It can reduce the speed of data based on the speed of the receiver.

 Disadvantages of TCP

 It is slower than UDP and it takes more bandwidth.  Slower upon starting of transfer of a file.  Not suitable for LAN and PAN Networks.  It does not have a multicast or broadcast category.  It does not load the whole page if a single data of the page is missing.

 What is User Datagram Protocol (UDP)?

 User Datagram Protocol (UDP) is a Transport Layer protocol. UDP is a part of the Internet Protocol suite, referred to as the UDP/IP suite. Unlike TCP, it is an unreliable and connectionless protocol. So, there is no need to establish a connection before data transfer. The UDP helps to establish low-latency and loss-tolerating connections establish over the network. The UDP enables process-to-process communication.

 Features of UDP

 Used for simple request-response communication when the size of data is less and hence there is lesser concern about flow and error control.  It is a suitable protocol for multicasting as UDP supports packet switching.  UDP is used for some routing update protocols like RIP(Routing Information Protocol).  Normally used for real-time applications which can not tolerate uneven delays between sections of a received message.

 Application of UDP

 Real-Time Multimedia Streaming : UDP is ideal for streaming audio and video content. Its low-latency nature ensures smooth playback, even if occasional data loss occurs.  Online Gaming : Many online games rely on UDP for fast communication between players.  DNS (Domain Name System) Queries : When your device looks up domain names (like converting “www.example.com” to an IP address), UDP handles these requests efficiently.  Network Monitoring : Tools that monitor network performance often use UDP for lightweight, rapid data exchange.  Multicasting : UDP supports packet switching, making it suitable for multicasting scenarios where data needs to be sent to multiple recipients simultaneously.  Routing Update Protocols : Some routing protocols, like RIP (Routing Information Protocol), utilize UDP for exchanging routing information among routers.

 Advantages of UDP

 It does not require any connection for sending or receiving data.  Broadcast and Multicast are available in UDP.  UDP can operate on a large range of networks.  UDP has live and real-time data.  UDP can deliver data if all the components of the data are not complete.

 Disadvantages of UDP

 We can not have any way to acknowledge the successful transfer of data.  UDP cannot have the mechanism to track the sequence of data.

  1. First, it checks the local cache (our browser, operating system, or router) to see if it already knows the IP address.
  2. If the local cache doesn’t have the IP, the query is sent to a DNS resolver to find it.
  3. DNS resolver may check host files (used for specific manual mappings), but usually, it moves on.
  4. Resolver sends the query to a Root DNS server, which doesn’t know the exact IP address but points to the TLD server (e.g., .org server for this example).
  5. TLD server then directs the resolver to the authoritative nameserver for geeksforgeeks.org.
  6. Authoritative nameserver knows the exact IP address for geeksforgeeks.org and sends it back to the resolver.
  7. Resolver passes the IP address to our computer.
  8. Our computer uses the IP address to connect to the real server where the website is hosted.
  9. The website loads in our browser.

 Structure of DNS

 It is very difficult to find out the IP address associated with a website because there are millions of websites and with all those websites we should be able to generate the IP address immediately, there should not be a lot of delays for that to happen organization of the database is very important.

 Root DNS Server

 DNS Record: Domain name, IP address what is the validity? what is the time to live? and all the information related to that domain name. These records are stored in a tree-like structure.  Namespace: Set of possible names, flat or hierarchical. The naming system maintains a collection of bindings of names to values – given a name, a resolution mechanism returns the corresponding value.  Name Server: It is an implementation of the resolution mechanism.  DNS = Name service in Internet – A zone is an administrative unit, and a domain is a subtree.

 Types of Domain

 There are various kinds of domains:

  1. Generic Domains: .com(commercial), .edu(educational), .mil(military), .org(n onprofit organization), .net(similar to commercial) all these are generic domains.
  1. Country Domain: .in (India) .us .uk
  2. Inverse Domain: if we want to know what is the domain name of the website. IP to domain name mapping. So DNS can provide both the mapping for example to find the IP addresses of geeksforgeeks.org then we have to type  Types of DNS

 Domain Name Server

The client machine sends a request to the local name server, which, if the root does not find the address in its database, sends a request to the root name server, which in turn, will route the query to a top-level domain (TLD) or authoritative name server. The root name server can also contain some hostName to IP address mappings. The Top-level domain (TLD) server always knows who the authoritative name server is. So finally the IP address is returned to the local name server which in turn returns the IP address to the host.

 DNS Lookup

DNS Lookup, also called DNS Resolution, is the process of translating a human-readable domain name (like www.example.com) into its corresponding IP address (like 192.0.2.1), which computers use to locate and communicate with each other on the internet. It allows users to access websites easily using names instead of remembering numeric IP addresses

  1. DNS Lookup starts when a user types a domain name into their browser.
  2. The query goes through a series of servers: the DNS resolver, Root server, TLD server, and authoritative server.
  3. Each server plays a role in finding the correct IP address for the domain.
  4. Once the IP address is found, the browser connects to the website’s server and loads the page.

 DNS Resolver

DNS Resolver is simply called a DNS Client and has the functionality for initiating the process of DNS Lookup which is also called DNS Resolution. By using the DNS Resolver, applications can easily access different websites and services present on the Internet by using

name space corresponds to a set of resource records, which contain information about that domain name, such as its IP address, mail servers, and other information.  The DNS name space is hierarchical, meaning that each domain name can have subdomains beneath it. For example, the domain name "example.com" could have subdomains such as "www.example.com" and "mail.example.com". This allows for a very flexible and scalable naming structure for the Internet.  The DNS name space is managed by a number of organizations, including the Internet Corporation for Assigned Names and Numbers (ICANN), which is responsible for coordinating the allocation of unique domain names and IP addresses.

 DNS Namespace Hierarchy

 The DNS namespace is organized hierarchically, with the root of the hierarchy at the top. At the root of the DNS namespace, there are a number of top-level domains (TLDs), such as .com, .net, and .org. These TLDs are further divided into second-level domains, and so on.  For example, consider the domain name "example.com". "com" is the top-level domain, and "example" is the second-level domain. "Example.com" can have subdomains beneath it, such as "www.example.com" and "mail.example.com". Each subdomain can also have further subdomains beneath it, forming a tree-like structure.  The DNS namespace is decentralized, meaning that there is no central authority that controls the entire namespace. Instead, different organizations are responsible for managing different parts of the namespace. For example, ICANN is responsible for coordinating the allocation of unique domain names and IP addresses, while individual registrars are responsible for selling domain names to customers and maintaining records of those domain names in the DNS.

 DNS Hierarchy in a Local Domain

 In a local domain, the DNS hierarchy can be used to organize the domain's resources and make them easier to find. For example, a local domain might have a structure like this?  Root domain: example.local  Subdomain: servers.example.local  Subdomain: clients.example.local  Subdomain: printers.example.local  In this example, the root domain is "example.local", and there are three subdomains beneath it: "servers.example.local", "clients.example.local", and "printers.example.local". Each of these subdomains can contain resource records that describe the resources within that subdomain.  For example, the "servers.example.local" subdomain might contain resource records for the domain's servers, such as their hostnames and IP addresses. The "clients.example.local" subdomain might contain resource records for the domain's client computers, and the "printers.example.local" subdomain might contain resource records for the domain's printers.  By organizing the resources in a local domain using the DNS hierarchy, it becomes easier for users to locate and access the resources they need.

 DNS Hierarchy and the Internet

 The DNS hierarchy is used to organize domain names on the Internet as well. At the top of the Internet's DNS hierarchy is the root domain, which is represented by a single dot ("."). Below the root domain, there are a number of top-level domains (TLDs), such as .com, .net, and .org. These TLDs are further divided into second- level domains, and so on.  For example, consider the domain name "example.com". "com" is the top-level domain, and "example" is the second-level domain. "Example.com" can have subdomains beneath it, such as "www.example.com" and "mail.example.com". Each subdomain can also have further subdomains beneath it, forming a tree-like structure.  The DNS hierarchy on the Internet is decentralized, meaning that there is no central authority that controls the entire namespace. Instead, different organizations are responsible for managing