Overview of Computer Networks Concepts
Overview of Computer Networks Concepts
com
1
Computer Networks
INDEX
famousrajbhatt@[Link]
[Link] TOPIC PAGE NO.
Computer Networks 1 – 57
1 Introduction 3–9
2 Devices 10 – 14
3 Physical Layer 15 – 16
4 Data link Layer 17 – 27
5 Network Layer 28 – 37
6 Transport Layer 38 – 44
7 Session Layer 45
8 Presentation Layer 46
9 Application Layer 47 – 51
10 Delays 52 – 53
11 Interview Questions 54 – 55
12 MCQs & Answer Key 55 – 57
Important topics
2
Introduction
famousrajbhatt@[Link]
1. What is a computer network?
A computer network is a group of interconnected nodes (devices) that share resources and
information via communication links.
2. What is a node?
• A node is a device capable of sending and receiving data.
End nodes: PC, printer, server, smartphone.
Intermediary nodes: Router, Bridge, Modem.
7. What is a protocol?
• Set of rules for effective communication.
• The sender and receiver follow a common set of rules to communicate.
3
8. Types of data flow
i. Simplex: One-way communication (e.g., keyboard to
CPU)
famousrajbhatt@[Link]
ii. Half Duplex: Two-way communication, but only one
direction at a time (e.g., walkie-talkie)
iii. Full Duplex: Two-way communication simultaneously
(e.g., telephone)
Leased line,
Bluetooth, Ethernet, Metro
Ethernet, MPLS,
Technology IrDa, Wi-Fi, Fiber Ethernet,
wi-fi VPN,
Zigbee optics MPLS
Satellite
Above 50
Range 1 - 100 m upto 2km 1 - 5 km 5 - 50 km km to global
range
Transmission
Very high Very high High Average Low
speed
Within Within
Within a Within cities Within
Area office university,
room like Mumbai countries
building office, etc.
Private/ Private/
Ownership Private Private Private
Public Public
4
12. Client-Server vs Peer-to-Peer (P2P) Network Models
famousrajbhatt@[Link]
Centralized with one or more dedicated Decentralized network where each
servers system functions as both client and server
Used in web apps, email systems, Used in File Sharing, P2P Games,
databases, enterprises Blockchain, and Home Networks
Architecture
• Client- Server • Peer-To-Peer Network
5
Bus Topology
• Definition: All devices share a single central cable.
famousrajbhatt@[Link]
• Data Flow: Bidirectional along the bus.
• Pros:
o Easy to set up.
o Minimal cabling.
• Cons:
o Cable failure breaks network.
o Limited devices and slow with traffic.
• Use: Suitable for small networks or temporary network setups.
Ring Topology
• Definition: Devices form a closed loop, each connected to two others.
• Data Flow: Typically, one-directional using a circulating token (some versions support
bidirectional flow).
• Pros:
o Simple setup.
o Fast data transfer.
• Cons:
o One failure affects the whole network.
o Harder to troubleshoot.
• Use: Token-based, orderly data networks.
Star Topology
• Definition: All devices connect to a central hub/switch.
• Data Flow: Via central hub to destination.
• Pros:
o Easy setup & fault isolation
o One device failure doesn't affect others
• Cons:
o Hub failure breaks network
o More cabling needed
• Use: Common in homes/offices.
Mesh Topology
• Definition: Every device is connected to every other device directly.
• Data Flow: Data can take multiple paths between devices.
• Advantages:
o Highly reliable and fault-tolerant.
o If one link fails, data routes through other paths.
o Provides high privacy and security.
• Disadvantages:
o Expensive and complex to install.
o Requires lots of cables and ports.
• Use: Critical networks requiring high availability and redundancy.
6
Tree Topology
• Definition: Hierarchical topology combining multiple star networks connected to a central
famousrajbhatt@[Link]
bus backbone.
• Data Flow: Data flows from leaves to root and vice versa through the backbone.
• Pros:
o Scalable and easy to manage.
o Fault isolation is easier than bus topology.
o Supports future expansion.
• Cons:
o If the backbone fails, entire network
segments go down.
o More cabling required than bus or star.
• Use: Large networks with hierarchical structure, like university campuses.
Hybrid Topology
• Definition: Mix of two or more topologies
(e.g., bus + ring + star).
• Data Flow: Depends on combined types.
• Pros:
o Flexible & scalable.
o Customizable design.
o Easier fault isolation.
• Cons:
o Complex setup.
o Higher cost.
• Use: Large, tailored networks.
7
14. What is Switching?
Switching is a method of transmitting data
famousrajbhatt@[Link]
between devices by selecting the best available
path.
i. Circuit Switching
• Circuit switching is a switching technique in which a dedicated communication path
is established between two endpoints for the duration of a transmission.
• Phases:
1. Connection Establishment.
2. Data Transfer.
3. Connection Termination
• Used in: Traditional telephone networks
(a dedicated line is reserved during a call).
• Pros: Reliable, fixed path.
• Cons: Wastes resources if idle.
8
Types of packet switching
famousrajbhatt@[Link]
Connectionless: No path is Connection-oriented: Path established
Connection
established before data transfer before data transfer
Each packet may take a different All packets follow the same established
Routing
route route
Addressing Packets carry full destination address Packets carry a virtual circuit identifier
9
Devices
famousrajbhatt@[Link]
1. Devices
Hardware: Cable, Repeater, Hub, Modem
Hardware + Software: Bridge, Switch, Router
Software: Gateway, IDS, Firewall.
2. Cables
Cables are a medium used to send data from one device to another. Twisted Cable
Types of Cables:
i. Unshielded Twisted Pair (UTP) Cables
• Commonly used in homes and offices.
• Pairs of wires are twisted to reduce electromagnetic interference
Coaxial Cable
(EMI).
ii. Coaxial Cable
• Has a single copper wire in the center.
• Used for cable TV and internet.
Fiber Optic
iii. Fiber Optic Cable
• Sends data using light signals.
• Very fast and supports long distances.
3. Repeaters
Work at the Physical Layer
A 2-port device (one input, one output)
Key Points:
• Placed at regular intervals along the cable.
• Does forwarding of the signal.
• No filtering — only boosts and sends.
• Collision domain = n (where n is the number of devices) because repeater transmits
without memory or buffering
o No buffer or memory.
o Does not use store-and-forward; simply amplifies and transmits signals in real-time.
10
4. Difference Between Repeater and Amplifier:
famousrajbhatt@[Link]
Feature Repeater Amplifier
Noise Removal Removes noise from the signal Amplifies both signal and noise
5. Hub
• Works at the Physical Layer.
• It is pure hardware (no smart processing).
• Acts as a multiport repeater (has multiple
input/output ports).
Key Features:
• Forwards data to all connected devices
(broadcasts).
• No filtering – sends everything to
everyone
o This causes high traffic on the network.
• Hubs are prone to collisions since all data is broadcast.
6. Bridges
• Work at the Data Link Layer
(Layer 2)
• Used to connect two or
more LAN segments.
• More intelligent than hubs or
repeaters.
Key Features:
• Does forwarding of data
• Checks MAC addresses to decide where to send data
• Can filter traffic and reduce collisions ⇒ because of store-and-forward mechanism
• Maintains a table to learn which MAC addresses are on which side
11
Example:
• Has two interfaces/ports:
famousrajbhatt@[Link]
o P1 (connected to M1, M2, M3, M4)
o P2 (connected to M5, M6, M7, M8)
• If M1 sends a message to M3, • If M1 sends a message to M7,
o The message goes to the Bridge first o The message goes to the Bridge first
o Bridge checks its MAC table o Bridge checks its MAC table
o It learns M3 is on the same port segment P1 o It learns M7 is on the other side of P1
o So, it does not forward the message to P2. o So, it forwards the message to P2
o This reduces unnecessary traffic on the
other segment.
Handling New Devices Requires manual update Learns automatically through traffic
Manual reconfiguration
Port Changes Automatically adapts
needed
Minimal or no broadcasting
Initial Operation (depending on manual table Broadcasts initially to learn devices
setup)
8. Switch
• Operates at Layer 2 (Data Link Layer)
• Functionally similar to a multiport
bridge, but more advanced in terms
of speed and switching logic
• Supports full-duplex links
(communication both ways
simultaneously)
• Creates separate communication
paths for different device pairs
(e.g., A-B, C-D)
• Results in minimal network traffic
• Collision domain per port = 1; no
collision across ports
• No collisions occur because each link is a dedicated circuit
Example:
• Commonly used to connect devices to the network, e.g., Laptop → Switch → Router
12
9. Roputer
• Works at the Network Layer (Layer 3) of the
famousrajbhatt@[Link]
OSI model.
• Connected to multiple networks.
• Forwards packets using a routing table.
• Routers drop or ICMP unreachable; flooding
is not default behavior.
• Routes packets based on IP addresses.
• Routers separate collision domains, but
collisions may still occur on half-duplex Ethernet interfaces.
Protocols Used
• RIP (Routing Information Protocol)
• OSPF (Open Shortest Path First)
• BGP (Border Gateway Protocol)
10. Gateway
• Connects two different networks (e.g., LAN to WAN).
• Acts as a translator between different network
protocols.
• Placed at the edge of LAN, connecting to the
internet.
• Gateways work across multiple OSI layers
depending on protocol translation but is
commonly associated with layer 7 (Application
Layer)
• Handles protocol conversion and sometimes
NAT/firewall.
Example:
A VoIP gateway connecting IP-based networks
with traditional telephone networks.
11. Firewall
• A security device that monitors and
controls network traffic.
• Acts as a barrier between trusted
(LAN) and untrusted (Internet)
networks.
• Placed at the network boundary,
usually before/after the router.
• Filters traffic based on IP, port, or
protocol using predefined rules.
• Can be hardware, software, or
both.
Example: pfSense, Cisco ASA, Windows Defender Firewall.
13
12. IDS (Intrusion Detection System)
• Monitors network or system activity to detect suspicious behavior or attacks.
famousrajbhatt@[Link]
• Does not block traffic, only detects and alerts.
• Can detect threats like unauthorized access, malware, or policy violations.
• Works by Analyzing traffic patterns, logs, or behavior.
• Two main types:
o NIDS (Network IDS) - monitors entire network.
o HIDS (Host IDS) - monitors individual devices.
• Example:
Snort (for NIDS), OSSEC (for HIDS)
14
Physical Layer
famousrajbhatt@[Link]
1. Where is it located in the OSI Model?
It is the 1st layer from the bottom (7th from the top) in the OSI
Model.
15
5. Types of connection
i. Point-to-point
famousrajbhatt@[Link]
• Connects exactly two devices directly.
• Used for direct communication
between two devices.
ii. Multipoint
• Multiple devices share a single link.
• Used for shared communication over a single
physical link.
ii. Anycasting: If the message is sent from the source to any one of the
nodes, it is known as anycasting. It is commonly used in Content
Delivery Networks (CDNs), where the request is routed to the nearest or
best-performing server.
iv. Broadcasting: If the message is sent from a source to all the nodes in
a network, it is known as broadcasting. Protocols such as DHCP and
ARP use broadcasting within local area networks (LANs).
16
Data link Layer
famousrajbhatt@[Link]
1. Where is it located in the OSI Model?
It is the 2nd layer from the bottom (6th from the top) in the OSI Model.
3. Sublayers
i. Logical Link Control (LLC)
• Handles flow control and multiplexing between upper
layers and the MAC sublayer.
• Provides:
o Error detection notifications to higher layers
o Acknowledgments
ii. Media Access Control (MAC)
• Manages device interaction with the physical medium.
• Responsibilities:
o Frame addressing
o Provides access control to the physical transmission medium
o Encapsulates Network Layer packets into frames and forwards them to the Physical
Layer.
17
v. Access Control
Manages access to the shared medium to avoid collisions.
famousrajbhatt@[Link]
Random Access Protocols:
• ALOHA
• CSMA (Carrier Sense Multiple Access)
o 0-persistent
o 1-persistent
o p-persistent
• CSMA/CD (Collision Detection)
Controlled Access Protocols:
• Polling
• Token Passing
Channelization Protocols:
• FDMA (Frequency Division Multiple Access)
• TDMA (Time Division Multiple Access)
7. Framing
• Groups raw bits into frames for clear separation.
• Enables reliable node-to-node (hop-to-hop) delivery across the physical link.
• Structure of a frame:
o Flag: Like an envelope in a postal system. It defines the start and end of data (delimiter).
o Header: Contains source and destination MAC address.
o Payload Field: It is the actual data.
o Trailer: Error detection and correction bits.
18
Types of Framing
i. Fixed-Size Framing
famousrajbhatt@[Link]
• Frame size is constant.
• No delimiters needed; length defines
frame boundaries.
9. Flow Control
i. Stop-And-Wait
• Window size = 1 (only one frame in transit).
• Sender sends 1 frame, waits for ACK
before sending next.
• Sender is idle during wait.
• Prevents data loss if receiver is slower.
• Simple but inefficient due to idle time.
Problems in Stop-and-Wait Flow Control
• Lost Data
• Lost Acknowledgement
• Delayed ACK/Data
19
Transmission Process
• Suppose the sender has to send 11
frames (0 to 10).
famousrajbhatt@[Link]
• Window size is 4.
• Sender sends frames: 0, 1, 2, 3.
• Receiver sends ACK for frame 0.
• Sender slides window and sends
frame 4 (now window is 1,2,3,4).
• Receiver ACKs frame 1, sender sends frame 6 (window is 3,4,5,6).
• This process continues.
Error Handling (Go-Back Mechanism)
• If a frame or ACK is lost, the sender
waits.
• If ACK for frame 2 is missing:
o Sender cannot send frame 6.
o After a timeout, sender goes back
to frame 2.
o Retransmits frames 2 onward (e.g.,
2, 3, 4...), even if some were
received correctly.
• This ensures reliable delivery but
may cause extra retransmissions.
20
i. Error detection method
a. Single Bit Parity Check
famousrajbhatt@[Link]
• Helps detect single-bit errors in transmission.
• A basic error detection technique.
• Adds 1 extra bit (parity bit) to the data.
• Ensures total number of 1s is even.
o If data has odd number of 1s ⇒ add 1
o If data has even number of 1s ⇒ add 0
• In advanced parity methods, like 2D matrix-based parity, errors involving 2 or 3 bits can
be detected but not corrected.
b. Checksum
• A computed value (often a sum or similar operation) of data bits before transmission.
• Checksum is transmitted along with the data.
• Receiver recomputes the checksum and compares it.
• If values don’t match, an error is detected.
21
11. MAC (Multiple Access Control)
Determines how multiple devices share the communication channel.
famousrajbhatt@[Link]
1) Random Access Protocol
• No station has priority, all are equal.
• Any station can transmit when the medium is idle.
• No fixed timing, stations transmit at random times.
• Collisions may occur if two stations send at the same time.
i. ALOHA
a. PURE ALOHA
• When a station sends data, it waits for an ACK (Acknowledgement).
• If no ACK is received, it assumes a collision has occurred.
• The station waits for a random backoff time (Tb) before retrying.
• The back-off time in Pure
ALOHA is random
• Pure ALOHA does not perform
carrier sensing.
• Used in early LAN protocols,
now mostly obsolete.
• Only transmission time is
considered; propagation delay
is ignored.
Vulnerable Time = 2 x tp
• tp = amount of time required to send a frame between the two most widely separated
stations
22
b. SLOTTED ALOHA
• Any station cannot start
transmission at any time.
famousrajbhatt@[Link]
• Time is divided into equal
slots.
• A station can only start
transmission at the beginning
of a time slot.
• If a station misses the start of
the slot, it must wait for the
next one.
• This reduces the chance of
collisions compared to Pure
ALOHA.
Vulnerable Time = tp
23
iii. CSMA/CD (Collision Detection)
• It is a slight modification of CSMA.
famousrajbhatt@[Link]
• If a collision occurs during transmission:
o Sends a jam signal to notify others.
o Waits a random backoff time, then retries.
• CSMA/CD doesn’t use acknowledgments; it
relies on collision detection.
• Requires transmission time ≥𝟐×
propagation delay for proper collision
detection. So that collisions can be detected
before transmission ends.”
• Not used in modern networks (e.g., switched
Ethernet).
24
CSMA/CA Flow:
• Station senses the channel:
famousrajbhatt@[Link]
Check if the medium is idle.
• If medium is idle:
Wait for Interframe Space (IFS) —a
short delay based on priority.
• After IFS:
Check medium again.
o If still idle, proceed to send data.
o If busy, wait.
• If medium was busy initially or
after IFS:
Enter Contention Window:
o Randomly select a backoff slot
before transmission attempt.
o If transmission fails, double the
contention window size and
select a new random backoff time
(exponential backoff).
o Pause timer during busy periods
and resume when medium
becomes idle.
• Send data.
• Wait for acknowledgement (ACK):
o If ACK received, transmission is
successful.
o If no ACK is received within
timeout, retransmit using the same backoff mechanism.
25
2) Controlled Access Protocol
A protocol used in shared channels to avoid collisions by regulating device transmission access.
famousrajbhatt@[Link]
i. Reservation
• Devices reserve future time slots by marking their requests in a reservation frame
(containing mini-slots for requests). This is done in a centralized or distributed manner
depending on the system.
• Only the devices that reserved slots are allowed to transmit, eliminating collisions.
• Image shows: Stations mark their slots in the reservation frame and send data
accordingly in turn.
ii. Polling
• A central controller (primary) polls devices one at a time to
check if they have data to send.
• Only the polled device can respond, preventing data collisions.
• Image shows: Primary polls Station A and B; A responds with
no data (NULL or silence), B sends DATA and receives ACK.
3) Channelization protocols
Channelization protocols divide the shared communication medium so that multiple
users can transmit data simultaneously without interference.
Users get separate Users get separate time Users share frequency &
frequency bands slots time with unique codes
26
famousrajbhatt@[Link]
Ethernet Frame Format
• LAN technology Protocol
• Used by CSMA/CD
i. Preamble (7 Bytes)
• Used for bit synchronization.
• Receiver gets alert before the actual data starts flowing.
v. Length (2 Bytes)
• Indicates length of the data field (up to 1500 Bytes).
• Value range can go up to 65535 in IEEE 802.3 but Ethernet payload limit is 1500 Bytes.
27
Network Layer
famousrajbhatt@[Link]
1. Where is it located in the OSI Model?
It is 3rd layer from bottom; 5th from top.
5. What is an IP address?
• An IP address can be 32-bit (IPv4) or 128-bit (IPv6), used to identify devices on a network.
• Helps locate and communicate with devices, especially outside your local network (LAN).
• 32 bits → each 8 bits are separated by dots(.)
• Types of IP address
i. Public
ii. Private
• We have two different addressing types
o Classful addressing
o Classless addressing (CIDR)
28
First Number of
Leading Network Host Default
Class Octet Purpose Networks
Bits Bits Bits Subnet Mask
Range Calculation
famousrajbhatt@[Link]
Large
A 0-127 0 8 24 [Link] 27=128
networks
Medium/large
B 128-191 10 16 16 [Link] 214=16,384
networks
Small
C 192-223 110 24 8 [Link] 221=2,097,152
networks
Research /
E 240-255 1111 N/A N/A Not defined N/A
Experimental
Subnet Mask
32-bit number used to determine the network portion of an IP address via bitwise AND.
Example (Class A)
o Host bits = 24
o Actual hosts = 224 - 2 = 16,777,214
29
Why do we subtract 2?
famousrajbhatt@[Link]
First IP address in the
Network ID All host bits = 0 Identifies the network
network
8. Classless addressing
• Improved IP system replacing classful addressing.
• Efficient IP allocation based on user need.
• CIDR = Classless Inter-Domain Routing.
• IPs are given in format:
CIDR Block
• A CIDR block is a range of IP addresses assigned dynamically.
• It contains the exact number of IPs needed.
Rules to Form CIDR Block
i. All IPs in the block must be contiguous.
ii. Block size must be a power of 2 (e.g., 2¹, 2², 2³, ...).
iii. First IP must be divisible by the block size.
NOTE: An address is divisible by 2ⁿ if its last n bits in binary are all equal to 0.
CIDR Notation (/n)
• n = number of network bits
• 32 - n = number of host bits
Example:
[Link]/28
→ 28 bits for network, 4 bits for host
→ 24 = 16 - 2 = 14 usable hosts.
30
9. Subnet
• A subnet is a smaller group inside a larger network.
famousrajbhatt@[Link]
• Allows efficient data routing within smaller, isolated sections.
• Each subnet can operate and be managed independently.
• Subnetting means dividing a large network into smaller networks called subnets.
Benefits of subnetting
• Efficient IP allocation.
• Reduces network congestion.
• Enhances security, scalability and speed.
Hosts = 2 host_bits_left – 2
[Link]/24 split into four /26 [Link]/24 split into /25, /26, /27
Example
subnets (64 Ips each) subnets matching host needs
31
12. IPV4 Header
famousrajbhatt@[Link]
• Version (4 bits): IP version number (4 for Ipv4).
• Header Length (HLEN, 4 bits): Length of the header in 32-bit words (min 5, max 15).
• Type of Service (8 bits): Priority flags like Low Delay, High Throughput, Reliability.
• Total Length (16 bits): Size of header + data (20 to 65,535 bytes).
• Identification (16 bits): Unique ID for packet fragments.
• Flags (3 bits):
o Reserved: Always set to 0; not currently used.
o DF (Don’t Fragment): Prevents the packet from being fragmented.
o MF (More Fragments): Indicates that more fragments are coming after this one.
• Fragment Offset (13 bits): Position of fragment in original data (in 8-byte units).
• Time to Live (TTL, 8 bits): Limits packet lifetime (prevents infinite looping).
• Protocol (8 bits): Indicates protocol (TCP, UDP, ICMP) for payload.
• Header Checksum (16 bits): Error-check for header integrity.
• Source IP Address (32 bits): Senderʼs IP.
• Destination IP Address (32 bits): Receiverʼs IP.
• Options (variable): Optional data (e.g., routing info, diagnostics).
32
13. IPV6 Header
famousrajbhatt@[Link]
number, always 6 (binary 0110).
• Traffic Class (8 bits): Indicates
packet priority/class; helps with
QoS. Similar to Ipv4ʼs Type of
Service.
• Flow Label (20 bits): Identifies
packet flow for special handling
like QoS or real-time service.
• Payload Length (16 bits): Length of data following the header (includes extension headers
+ actual payload). Max = 65,535 bytes.
• Next Header (8 bits): Type of next header (can be an extension header or upper-layer
protocol like TCP/UDP).
• Hop Limit (8 bits): Like TTL in Ipv4; max number of hops before the packet is discarded.
• Source Address (128 bits): Ipv6 address of the packet sender.
• Destination Address (128 bits): Ipv6 address of the final receiver.
• Extension Header
o To replace IPV4 options field.
o Each has a Next Header (8 bits) → points to next header or upper-layer protocol
(TCP/UDP).
o We can have it for Hop-by-Hop options, Destination options, Routing, Fragment,
Authentication, Encapsulating Security Payload.
Important difference
Version 4 6
33
14. Routing
Routing is the process of selecting the best path for data
famousrajbhatt@[Link]
to travel from a source to a destination across networks.
How does it work?
i. A device sends a request to another device (e.g., a web
server).
ii. Data is split into smaller packets. Each packet gets the
destination IP address.
iii. The router checks its routing table to find the best path
to the destination.
iv. Packets travel through multiple routers (hops) to
reach the destination.
v. Packets are collected and reassembled at the
destination. Errors are checked and corrected.
Routing table
A routing table shows the best paths to reach different networks.
Resource Low resource usage, but less Higher resource usage, but more
Use flexible flexible
Example Small office router with fixed paths Protocols like RIP, OSPF, EIGRP
34
For the solved example have a look on the video.
famousrajbhatt@[Link]
• Each router maintains a table listing the best-known distance and next hop to each
destination.
• Routers periodically share only their distance vectors (not the entire routing table)
with immediate neighbours.
• Upon receiving a neighbourʼs distance vector, a router updates its own vector by
selecting routes with the lowest distance metric.
• Shares routing info only with neighbour routers.
35
Disadvantages
• Requires more memory and CPU power.
famousrajbhatt@[Link]
• More complex to configure and maintain.
• Uses more bandwidth for routing updates.
• Not suitable for small networks due to overhead.
iii. Path Vector Protocol
• Dynamic exterior gateway protocol for routing between autonomous systems (AS).
• Uses path-vector mechanism to maintain and update route information dynamically.
• Selects the most efficient and reliable path for data transmission across networks.
Chooses the best path for reliable data transfer.
Advantages:
• Scalable for large, complex networks like the Internet.
• Supports multi-homing for better redundancy and reliability.
• Provides fine control over routing policies and traffic management.
• Quickly adapts to network failures and topology changes.
• Enables inter-domain routing across diverse networks.
Disadvantages
• Complex to configure and manage compared to interior protocols.
• Requires more CPU and memory resources on routers.
• Can be slower to converge during topology changes.
• Vulnerable to misconfigurations which can affect large parts of the Internet.
How it works?
i. Device wants to send data but only knows the IP.
ii. Checks ARP Cache for MAC address.
iii. If not found,
broadcasts ARP
Request asking who
has the IP.
iv. Target device replies
with its MAC address.
v. Sender saves MAC in
ARP Cache.
vi. Data is sent using the
MAC address.
36
17. NAT
• Purpose: Allows multiple private IPs to share a single public IP for internet access.
famousrajbhatt@[Link]
• Reason: IPv4 addresses
are limited. NAT allows
devices to share one public
IP by using private IPs,
helping avoid address
shortage.
• How it works:
o NAT runs on a
router/firewall at the
network border.
o Does both types of translation:
▪ Private IP → Public IP
▪ Public IP → Private IP
o Translates IP and port numbers using a NAT table.
• If no free address: Packets dropped, ICMP “host unreachableˮ message is sent.
37
Transport Layer
famousrajbhatt@[Link]
1. Where it is located in OSI Model?
It is 4th layer from bottom; 3rd from top.
This combination ensures that data is delivered to the correct application on the correct device.
i. Why is it required?
• The IP address identifies the device (e.g., a
computer or smartphone).
• The port number identifies the specific
application or service running on that device.
Together, they allow accurate and complete
routing of data from one application to another
across a network.
38
ii. Why IP Address or Port alone is not enough?
• If Only IP is used: Cannot identify which application should receive the data.
famousrajbhatt@[Link]
• If Only Port is used: Cannot identify which device should receive the data.
Example:
• [Link]:80 ⇒ Web server
• [Link]:21 ⇒ FTP server
Same IP; different ports — different applications.
6. TCP
Transmission Control Protocol (TCP) is a connection-oriented protocol for communications
that helps in the exchange of messages between different devices over a network.
Features
i. Reliable Data Transfer
Ensures error-free, in-order delivery using acknowledgments and retransmissions.
ii. Connection-Oriented
Establishes a connection using a three-way handshake (SYN, SYN-ACK, ACK) and
closes it with a three-step process (FIN, FIN-ACK, ACK).
v. Piggybacking
When sending an acknowledgment (ACK), if there is also outgoing data, both are sent
together in the same segment to optimize efficiency. This is known as piggybacking.
39
7. TCP Header
• Source Port (16 bits): Port number of the
famousrajbhatt@[Link]
sending application.
• Destination Port (16 bits): Port number of
the receiving application.
• Sequence Number (32 bits): Byte number
of the first byte in this segment; used for
reassembling out-of-order segments.
• Acknowledgement Number (32 bits):
Byte number which the receiver expects
next; acknowledges successful receipt of
previous bytes.
• Header Length (HLEN) (4 bits): TCP header size in 4 byte words; ranges from 5 (20 bytes)
to 15 (60 bytes).
To get the actual length, multiply by 4.
• Control Flags (6 bits): Manage connection and data flow:
o URG: Urgent pointer valid.
o ACK: Acknowledgement number valid.
o PSH: Push data immediately.
o RST: Reset connection.
o SYN: Synchronize sequence numbers (connection setup).
o FIN: Finish/Terminate connection.
• Window Size: Size of the senderʼs receive window (in bytes) for flow control.
• Checksum: Error-checking field (mandatory in TCP).
• Urgent Pointer: Points to urgent data byte (valid if URG flag set).
• Options & Padding: Optional extra data fields; used to send additional info like Maximum
Segment Size (MSS).
o MSS for Ethernet is typically 1460 bytes (1500 – 20 IP header – 20 TCP header).
40
i. Client sends SYN
• Picks a random sequence number (e.g., 9000).
famousrajbhatt@[Link]
• Sets SYN flag = 1 to request
synchronization.
• Uses any source port (A) and destination
port 80 (HTTP).
• Announces window size (e.g., 12000 bytes).
• MSS (e.g., 1200 bytes) in options.
• Sends SYN segment to server.
iii. Rule:
Acknowledgment Number always indicates the next byte the receiver expects.
41
iv. TCP Acknowledgment
a. Pure Acknowledgment (No Data):
If no data is to be sent, a segment can carry only the acknowledgment:
famousrajbhatt@[Link]
• Only ACK flag is set.
• Prevents receiver from waiting.
• Does not consume a new sequence number.
• No payload.
• Indicates successful receipt of data.
42
iv. Client releases server-related resources
• Server → Client data sending stops.
• Server can still send ACKs without resources.
famousrajbhatt@[Link]
v. Client sends final ACK (ACK = 1)
• Confirms serverʼs FIN
vi. Server receives final ACK and closes the connection fully
• Both sides have released resources.
• Connection termination complete.
4 WAY
i. Client sends FIN = 1 to close its side.
ii. Server sends ACK = 1 to acknowledge FIN (connection
half closed).
iii. Server waits (may send/receive data) before closing.
iv. Server sends FIN = 1 when ready to close.
v. Client sends final ACK = 1 to acknowledge serverʼs FIN.
vi. Connection fully closed after final ACK.
43
13. User Datagram Protocol
• Connectionless & Unreliable.
famousrajbhatt@[Link]
• No handshake, no delivery/order/error guarantee.
• Lightweight & fast, low overhead.
• No flow or congestion control.
• Best for: Time-sensitive, loss-tolerant applications.
• Since UDP relies on IP, segments may follow different paths based on IP routing.
Used in: Web browsing, email, file transfer Used in: Video calls, online games, streaming
Ex. HTTP, HTTPS, FTP, SMTP Ex. YouTube, Zoom, WhatsApp Calls, DNS
44
Session Layer
famousrajbhatt@[Link]
1. Where it is located in OSI Model?
It is the 5th layer from bottom; 3rd from top.
v. Resynchronization
• Restores session state after an interruption by resetting tokens and session
parameters.
• Three resynchronization modes:
o Set: Sets new synchronization points.
o Abandon: Discards current session progress.
o Restart: Restarts session from a previously saved state.
45
Presentation Layer
famousrajbhatt@[Link]
1. Where it is located in OSI Model?
It is 6th layer from bottom; 2nd from top.
Types
• Lossy Compression: Reduces file size by
permanently removing some data. Original file cannot
be restored.
• Lossless Compression: Reduces file size without any loss of data. Original file can
be restored.
iv. Syntax Semantics Management: Agrees on a common data syntax and semantics for
smooth communication between devices.
46
Application Layer
famousrajbhatt@[Link]
1. Where it is located in OSI Model?
It is 7th layer from bottom; 1st from top.
47
Real-life examples
famousrajbhatt@[Link]
When you open a browser and type [Link], your browser sends an
HTTP HTTP request to the web server, which responds with the webpage content (HTML,
images).
When you type [Link], your computer asks a DNS server "What's the IP
DNS for [Link]?" The DNS server replies with the IP, so your computer can
connect.
A network admin remotely logs into a server using Telnet to configure settings or
TELNET
check system status over a text-based session.
When you connect your laptop to Wi-Fi at a cafe, the DHCP server automatically
DHCP
assigns your device an IP address so it can communicate on the network.
You upload your website files to a web hosting server using an FTP client,
FTP transferring your HTML, images, and scripts. For secure transfer, FTPS or SFTP
should be used.
When you send an email from Outlook or Gmail, your email client uses SMTP to
SMTP
push the message to your mail server, which forwards it to the recipient's server.
You use an email client (like Thunderbird) to download emails from your mail server
POP
via POP, allowing you to read emails offline.
A developer accesses shared project files on a remote Linux server as if they were
NFS
on their own computer, using NFS to mount the remote directory locally.
4. HTTP
• Port Number: 80
• Uses TCP because HTTP itself is not reliable.
• In-band protocol (commands and data sent over the same connection).
• Each request is independent; the server does not retain client session information. Hence,
it is stateless.
HTTP Method Description
HEAD Retrieves only the headers of a resource.
GET Requests data from the server.
POST Submits data to be processed to the server.
PUT Updates or replaces a resource on the server.
DELETE Deletes a resource from the server.
CONNECT Establishes a tunnel, often for SSL connections.
48
6. DNS
• The Domain Name System (DNS) acts like the internet’s phone book.
famousrajbhatt@[Link]
• It maps domain names to their IP addresses.
• Some IP addresses are dynamic; DNS maps domain names to IPs regardless of type.
• DNS lets you change servers without changing the domain, keeping everything smooth
for users.
Example: You host [Link] on AWS. DNS maps the domain to its IP address.
Users type the domain, not the IP. Later, you switch to a cheaper host. The IP changes,
but you just update the DNS. Users still access [Link], no change on their end.
7. How it works?
We have a hierarchical structure for query-lookup.
DNS Hierarchy:
• Root Server: Top-level directory that points to
the correct TLD server based on the domain
extension (e.g., .com, .in).
• TLD Server: Manages all domains under that
extension and directs to the authoritative server
for the specific domain.
• Authoritative Server: Holds the actual DNS
records and returns the IP address for the domain.
Example: [Link] → [Link]
8. The resolver caches it inside the local cache for the future requests and then sends the
IP address back to the computer.
49
B) Iterative
Your computer requests to resolve [Link] in the following steps:
famousrajbhatt@[Link]
1. It checks the local cache for the IP
address.
2. If not found, the DNS resolver contacts
the Root Server.
3. The Root Server replies with a pointer
to the .com Top-Level Domain (TLD)
server.
4. The resolver queries the TLD server.
5. TLD responds with authoritative server.
6. Resolver queries the authoritative server.
7. Authoritative server replies with IP.
8. The resolver caches this IP address.
Finally, the resolver sends the IP address back to your computer.
9. FTP
• File Transfer Protocol
• Used to transfer files.
• It is out-of-band protocol. It operates on separate ports for data and control channels.
• Data connection = non-persistent (20)
• Control connection (port 21) remains open throughout the session; data connection (port
20) is opened as needed.
• Reliable and stateful protocol.
Synchronizes emails
Sends or pushes emails Downloads or pulls emails
between server and client
Used to send mail from client to Fetches mail from server Accesses mail directly on the
server or between servers to client server
50
11. Difference between Persistent HTTP and Non-persistent HTTP
famousrajbhatt@[Link]
Server keeps the connection open after Server closes the connection after sending
sending response response
Requires 1 RTT to request referenced objects Requires 2 RTTs for each object
51
Delays
famousrajbhatt@[Link]
Delays in computer networks, also called Nodal Delays, refer to the time taken during different
stages of processing and transferring a packet. There are four main types of delays:
Tt = L/B
Where:
• L = Packet size (in bits).
• B = Bandwidth (in bits per second (bps)).
Example:
If bandwidth B = 1B = 1 bps and Packet size L = 20L = 20 bits, then:
L 20 bits
Tt = = 1 bps = 20 seconds
B
Distance
Tp =
Velocity
52
4. Processing Delay (Tpro)
Definition: Time taken by routers or destination systems to process the packet (e.g., check
famousrajbhatt@[Link]
headers, update TTL, etc.).
NOTE: No formula, as it depends on processor speed and system load.
5. Total Delay
Definition: Sum of all delays.
NOTE: It is also called as with negligible Delay.
Ttotal = Tt + Tp + Tpro + Tq
Ttotal = Tt + Tp
53
Interview Questions:
1. Can you name and briefly describe any five common network protocols and their
famousrajbhatt@[Link]
purposes?
2. Which protocol ensures reliable communication between two endpoints on a network?
3. What is the difference between LAN, MAN, and WAN? Give examples.
4. Where would you typically use a PAN or CAN?
5. How does a client-server model differ from a peer-to-peer model?
6. Which architecture is more scalable and why?
7. What are the different types of network topologies and their advantages/disadvantages?
8. Why is star topology more commonly used than bus topology in modern networks?
9. What are the functions of the following devices: Hub, Switch, Router, Modem, Repeater?
10. How is a switch different from a hub in handling network traffic?
11. How does a router determine the best path to route a packet?
12. What’s the difference between a router and a switch in terms of OSI layer and
functionality?
13. What is a firewall and how does it protect a network?
14. Can a firewall block internal threats? Why or why not?
15. Explain the TCP 3-way handshake step by step.
16. What happens if the final ACK is lost during the handshake?
17. What are the four types of delays in a network? Explain each briefly.
18. Which delay is affected by congestion in the network?
19. What are the main differences between IPv4 and IPv6?
20. What is the purpose of private IP addresses?
21. Can a device with a private IP access the internet directly? Why or why not?
22. Describe step-by-step What happens when you hit enter after typing [Link] in
your browser.
23. What is the difference between unicast, multicast, broadcast, and anycast? Give real-life
examples.
24. Why is a switch preferred over a hub in modern LANs?
25. In what form is data represented at each layer of the OSI model (bits, frames, packets,
etc.)?
26. How does subnetting help in efficient IP address management?
27. What is DNS and how does it resolve domain names to IP addresses?
28. What is the difference between recursive and iterative DNS queries?
54
29. Why does a device need both MAC and IP addresses?
30. What is flow control in networking? Name two protocols that provide flow control.
famousrajbhatt@[Link]
31. What are two methods used for error detection and correction?
32. How does checksum differ from CRC in detecting errors?
33. Compare TCP and UDP in terms of reliability, speed, and use cases.
34. Which protocol would you use for live video streaming and why?
35. What are the responsibilities of the session layer in the OSI model?
36. What functions does the presentation layer perform in data communication?
37. Why do we need data encryption?
38. Explain how propagation delay and transmission delay differ.
39. Which delay is dependent on bandwidth and which on distance?
40. What is a VPN and how does it work?
41. What are some advantages and limitations of using a VPN?
MCQs:
1. Which protocol ensures reliable 5. Which architecture offers
communication? centralized control and better
A. UDP security?
B. IP A. Peer-to-peer
C. TCP B. Client-server
D. FTP
6. In peer-to-peer networks, devices
2. Which protocol is used to transfer are both:
files over a network? A. Clients only
A. HTTP B. Servers only
B. FTP C. Clients and Servers
C. DHCP D. None of the above
D. SNMP
7. Which topology connects all nodes
3. Which network is used within a to a central device?
single room or device range? A. Bus
A. PAN B. Ring
B. LAN C. Star
C. MAN D. Mesh
D. WAN
8. Which topology provides full
4. Campus-wide network is an
redundancy?
example of:
A. Mesh
A. WAN
B. Star
B. MAN
C. Bus
C. CAN
D. Ring
D. PAN
55
9. Which device works at the Data Link 17. If the last ACK in handshake is lost,
Layer (Layer 2)? the sender:
A. Router A. Closes connection
famousrajbhatt@[Link]
B. Switch B. Retransmits SYN
C. Modem C. Retransmits ACK
D. Repeater D. Waits or times out
10. What does a router do? 18. Which delay is caused by the time
A. Broadcasts data to push data into the link?
B. Forwards packets between networks A. Propagation
C. Encrypts data B. Queuing
D. Stores web pages C. Transmission
D. Processing
11. Switches are better than hubs
because they: 19. Congestion mainly affects which
A. Use more power type of delay?
B. Flood all ports A. Processing
C. Forward data intelligently B. Propagation
D. Are cheaper C. Queuing
D. Transmission
12. Which device connects two
different networks? 20. IPv6 address size is:
A. Switch A. 32-bit
B. Repeater B. 64-bit
C. Router C. 128-bit
D. Hub D. 256-bit
13. Routers operate on which OSI layer? 21. What is a benefit of using private IPs?
A. Transport A. Global accessibility
B. Network B. Cost saving
C. Session C. Easy routing
D. Data Link D. No need of NAT
14. What is the primary function of a firewall?
22. Can a private IP access the Internet
A. Speed up connection
directly?
B. Filter network traffic
A. Yes
C. Provide IP addresses
B. No
D. Store files
23. What is the first thing that happens
15. Firewalls can block:
when we visit [Link]?
A. Outgoing only
A. TCP connection
B. Incoming only
B. DNS resolution
C. Both incoming and outgoing
C. HTTP request
D. None
D. IP assignment
16. The first step in a TCP 3-way
24. Which is an example of one-to-
handshake is:
many communication?
A. SYN
A. Unicast
B. ACK
B. Multicast
C. SYN-ACK
C. Anycast
D. FIN
D. Broadcast
56
25. Which communication sends data 31. MAC address is unique to:
to all nodes in the network? A. IP
A. Unicast B. User
famousrajbhatt@[Link]
B. Broadcast C. Device
C. Multicast D. Port
D. Anycast
32. IP address is used for:
26. A VPN provides: A. Local communication only
A. Physical security B. Internet routing
B. Encrypted remote access C. Encryption
C. Faster internet D. Hardware control
D. Static IP
33. Flow control prevents:
27. Data at the Network layer is called: A. Packet loss from congestion
A. Frame B. Address resolution
B. Segment C. Network discovery
C. Packet D. IP conflict
D. Bit
34. Which protocol provide no flow
28. Subnetting is used to: control or error correction?
A. Combine Ips A. TCP
B. Allocate bandwidth B. UDP
C. Divide IP space efficiently C. FTP
D. Reduce security D. ICMP
29. DNS converts: 35. Session layer is responsible for:
A. IP to MAC A. Logical addressing
B. Domain to IP B. End-to-end delivery
C. Port to MAC C. Dialog control
D. IP to Domain D. Data encryption
30. Which DNS query type returns the
full IP resolution to the client?
A. Recursive
B. Iterative
C. Redundant
D. Cache-only
ANSWER KEY
1. (C) 2. (B) 3. (A) 4. (C) 5. (B)
6. (C) 7. (C) 8. (A) 9. (B) 10. (B)
11. (C) 12. (C) 13. (B) 14. (B) 15. (C)
16. (A) 17. (D) 18. (C) 19. (C) 20. (C)
21. (B) 22. (B) 23. (B) 24. (B) 25. (B)
26. (B) 27. (C) 28. (C) 29. (B) 30. (A)
31. (C) 32. (B) 33. (A) 34. (B) 35. (C)
57