3.1.1 Basics — How Data Travels Through the Layers
📖 Client–Server model: A client (your browser or app) sends a request. A server (a computer that is always on) sends back a response. Almost every upper-layer protocol in this unit works this way.
Each layer adds its own header (encapsulation). The receiver removes them in the reverse order.
3.1.2 IPv4 vs IPv6
📖 IPv6: The newer Internet Protocol with 128-bit addresses (IPv4 has 32-bit). It was created because IPv4 gives only about 4.3 billion addresses, which are not enough for the number of devices today.
💡 Analogy: IPv4 is a 10-digit phone number that ran out. IPv6 is a number so long that every device on earth can have its own.
IPv6 packet format
Version (4)
Traffic Class (8)
Flow Label (20)
Payload Length (16)
Next Header (8)
Hop Limit (8)
Source Address (128 bits)
Destination Address (128 bits)
IPv6 header: fixed 40 bytes. No checksum, no options field (extension headers instead).
Address notation
2001:0db8:0000:0000:0000:ff00:0042:8329 = 8 groups of 4 hex digits. Drop leading zeros and replace one run of zero groups by :: → 2001:db8::ff00:42:8329
RemovedIHL, Identification, Flags, Fragment Offset, Header Checksum, Options
RenamedToS → Traffic Class · Total Length → Payload Length · Protocol → Next Header · TTL → Hop Limit
NewFlow Label (marks packets of the same flow)
Types of IPv6 addresses
Type
Meaning
Example
Unicast
One sender to one receiver
2001:db8::1, link-local starts with fe80
Multicast
One to a group
Starts with ff
Anycast
One to the nearest member of a group
Same address on several servers
Loopback
Own computer (like 127.0.0.1)
::1
Why a simpler header? A fixed 40-byte header with fewer fields means routers do less work per packet, so forwarding is faster.
3.1.3 TCP — Transmission Control Protocol
📖 TCP: A connection-oriented, reliable transport protocol. It sets up a connection, numbers every byte, acknowledges data, resends lost data, and controls flow and congestion.
💡 Analogy: A phone call. First you dial and the other person says "hello" (handshake), you talk in order, and you can ask "say that again".
TCP segment format
Source Port (16)
Destination Port (16)
Sequence Number (32)
Acknowledgement Number (32)
Offset (4)
Reserved
URG ACK PSH RST SYN FIN
Window (16)
Checksum (16)
Urgent Pointer (16)
Options + Padding
TCP header: 20 bytes minimum, 60 bytes maximum.
Flag
Meaning
SYN
Start a connection (synchronize sequence numbers)
ACK
Acknowledgement field is valid
FIN
Sender has finished, close connection
RST
Reset / abort the connection
PSH
Push data to the application at once
URG
Urgent pointer is valid
Connection setup
TCP three-way handshake. Data flows only after step 3.
Closing: FIN → ACK from each side (four steps). TCP flow control uses the Window field (sliding window); congestion control uses slow start and congestion avoidance.
How TCP makes data reliable
Sequence numbers label every byte so data can be put in order
Acknowledgements (ACK) tell the sender what has arrived
Timer + resend: if no ACK arrives in time, the segment is sent again
💡 Worked example: sequence and ACK numbers
Client sends 3 segments of 100 bytes each. First sequence number = 1000
Server received all → ACK = 1300 (the next byte it expects)
If segment 2 is lost, the server keeps sending ACK 1100 (duplicate ACKs). The sender then resends segment 2
Closing a connection
TCP connection closing: four steps, each side closes its own direction.
Slow start (congestion control)
cwnd = 1→2→4→8→…→threshold→+1 per round trip
TCP starts slowly and doubles its sending window every round trip (slow start). After a threshold it grows by 1 per round trip (congestion avoidance). On packet loss it cuts the window down.
Sequence numbers for a file transfer
💡 Example: The first byte of a file is numbered 10001 and each segment carries 1000 bytes. Segment 1 has sequence number 10001 (bytes 10001–11000), segment 2 has 11001, segment 3 has 12001. Next sequence number = sequence number + data bytes.
3.1.4 UDP and TCP vs UDP
📖 UDP (User Datagram Protocol): A connectionless, unreliable transport protocol. It just sends datagrams with no handshake, no ACK and no resend, so it is fast and light.
💡 Analogy: Dropping postcards in a letterbox. Quick, but no receipt and no guarantee.
Source Port (16)
Destination Port (16)
Length (16)
Checksum (16)
UDP header: only 8 bytes.
Point
TCP
UDP
Connection
Connection-oriented
Connectionless
Reliability
Reliable (ACK, resend)
Unreliable (best effort)
Ordering
In-order delivery
No ordering
Header
20 – 60 bytes
8 bytes
Speed
Slower
Faster
Flow / congestion control
Yes
No
Used by
HTTP, FTP, SMTP, POP3, IMAP, SSH
DNS, SNMP, VoIP, video streaming, DHCP
TCP or UDP? Quick decision
Every byte must arrive? (web, file, email)→Use TCP
Speed matters, small loss is OK? (call, game, live video, DNS)→Use UDP
Decode a UDP header
💡 Example: header 0045 000D 0058 FE20 → source port 0x0045 = 69, destination port 0x000D = 13, length 0x0058 = 88 bytes, so data = 88 − 8 = 80 bytes. The last field FE20 is the checksum.
3.1.5 Application Layer Protocols and Port Numbers
📖 Port number: A 16-bit number that tells which application on a host should get the data. IP address finds the computer, port finds the program.
Protocol
Port
Transport
Purpose
HTTP / WWW
80
TCP
Web pages
HTTPS
443
TCP
Secure web (HTTP + TLS)
DNS
53
UDP (TCP for large replies)
Name → IP
FTP
21 (control), 20 (data)
TCP
File transfer
SMTP
25
TCP
Send email
POP3
110
TCP
Download email
IMAP
143
TCP
Read email on server
TELNET
23
TCP
Remote login (not secure)
SSH
22
TCP
Secure remote login
SNMP
161 (agent), 162 (traps)
UDP
Network management
3.1.6 DNS — Domain Name System
📖 DNS: The phonebook of the Internet. It converts a name like www.example.com into an IP address. DNS is a distributed hierarchy: Root → TLD (.com, .in) → Authoritative server.
💡 Analogy: You remember a friend's name, not their number. DNS looks up the number for you.
Numbers show the order of messages (recursive resolution).
1 Browser asks the resolver for www.example.com
2-3 Resolver asks Root server, gets the address of the .com (TLD) server
4-5 Resolver asks TLD server, gets the address of the authoritative server of example.com
6-7 Resolver asks the authoritative server and gets the IP address
8 Resolver returns the IP to the browser (and caches it for the TTL time)
Record
Meaning
A
Name → IPv4 address
AAAA
Name → IPv6 address
CNAME
Alias of another name
MX
Mail server of the domain
NS
Authoritative name server
PTR
IP → name (reverse lookup)
DNS hierarchy
Names are read from right to left: root → .com → example.com → www.
Recursive query
Iterative query
Who does the work
The DNS server finds the final answer for the client
The server only gives a referral ("ask that server"); the asker continues
Typical use
Browser → resolver
Resolver → Root / TLD / Authoritative
Caching and TTL: Resolvers and browsers remember answers for a time called TTL, so repeated lookups are fast and the root servers are not overloaded.
3.1.7 HTTP and WWW
📖 WWW: A system of linked web pages (hypertext) on servers, opened with a browser. HTTP is the protocol browsers use to ask for them. It is a stateless request–response protocol over TCP (port 80).
Attacks → Passive (listen) vs Active (change / block)
Cryptography → Ciphers → Symmetric (one key) vs Public/Private key
Tools → Digital signature · Firewall · IDS · IPsec
3.2.1 Security Attacks
📖 Network security protects data and services using the CIA triad: Confidentiality (only authorised people read), Integrity (data not changed), Availability (service always usable).
InterruptionSender ✕ Receiver. Service is cut (DoS). Availability lost.
InterceptionSender → Attacker → Receiver. Data is read (sniffing, MITM). Confidentiality lost.
ModificationAttacker changes data in transit. Integrity lost.
Spoofing, replay, modification, DoS / DDoS, man-in-the-middle
Detection
Hard to detect, so prevent (encryption)
Easier to detect, so detect and recover
Malware: virus (needs a host file), worm (spreads by itself), trojan (looks useful but harmful), ransomware (locks data for money). Phishing: fake messages that trick users into giving passwords.
Attacks in real life
DoS / DDoSA crowd blocks the shop door, real customers cannot enter.
SniffingSomeone listens to your phone call.
Man-in-the-middleA dishonest postman opens, reads and re-seals your letter.
SpoofingFake caller ID: pretending to be someone else.
ReplayCopy of your old cheque is used again.
PhishingFake bank SMS asking for your password.
3.2.2 Cryptography and Types of Ciphers
📖 Cryptography: Converting readable plaintext into unreadable ciphertext using an algorithm and a key (encryption), and back again (decryption).
Cipher type
Idea
Example
Substitution
Replace each letter with another
Caesar cipher (shift 3): HELLO → KHOOR
Transposition
Rearrange the positions of letters
Rail fence (2 rows): HELLO → HLOEL
Stream cipher
Encrypts bit by bit or byte by byte
RC4
Block cipher
Encrypts fixed-size blocks
DES (64-bit block, 56-bit key), AES (128-bit block, 128/192/256-bit key)
💡 Caesar cipher: shift each letter 3 places forward: H→K, E→H, L→O, L→O, O→R. Key = 3. Decryption shifts back by 3.
Family of ciphers
ClassicalSubstitution: Caesar, monoalphabetic (fixed mapping), polyalphabetic like Vigenère (mapping changes with the key) Transposition: rail fence, columnar
📖 Hash: A one-way function that turns any message into a fixed-size output (SHA-256 gives 256 bits). It cannot be reversed, and a tiny change in the message changes the whole output.
Message
SHA-256 (first 16 hex digits)
Hello
185f8db32271fe25…
hello
2cf24dba5fb0a30e…
Only the first letter changed (H → h), yet the hash is completely different. MD5 (128-bit) is no longer considered secure.
3.2.3 Public Key and Private Key
📖 Symmetric: the same secret key encrypts and decrypts (AES, DES). Fast, but sharing the key safely is hard. Asymmetric (public key): every user has a public key (shared with all) and a private key (kept secret). What one key locks, only the other can unlock (RSA).
💡 Analogy: A letterbox. Anyone can drop a letter in (public key), but only the owner has the key to open it (private key).
Plaintext→🔒 Encrypt (Bob's PUBLIC key)→Ciphertext→🔓 Decrypt (Bob's PRIVATE key)→Plaintext
Symmetric
Asymmetric
Keys
1 shared key
Key pair (public + private)
Speed
Fast (bulk data)
Slow (small data, key exchange)
Problem
Key distribution
Needs trust in public keys
Examples
AES, DES
RSA
📐 RSA example
Choose p = 3, q = 11 → n = p×q = 33, φ = (p−1)(q−1) = 20
Public key e = 7, private key d = 3 (because 7×3 = 21 ≡ 1 mod 20)
Encrypt M = 4: C = 47 mod 33 = 16
Decrypt: 163 mod 33 = 4 = original message
3.2.4 Digital Signatures
📖 Digital signature: A value created with the sender's private key that proves who sent a message and that it was not changed. It gives authentication, integrity and non-repudiation (sender cannot deny sending).
💡 Analogy: A handwritten signature plus a seal on a letter. Anyone can verify it, nobody can copy it.
Sender signs
Message→Hash (SHA-256)→Encrypt hash with sender's PRIVATE key→Digital signature
Receiver verifies
Decrypt signature with sender's PUBLIC key → Hash A→Hash the received message → Hash B→A = B ? ✅ valid : ❌ rejected
A signature alone does not hide the message (no confidentiality). To keep it secret, also encrypt the message.
3.2.5 Firewalls and Intrusion Detection System (IDS)
📖 Firewall: A device or software between a trusted network and the Internet that allows or blocks traffic by rules. IDS: watches traffic or logs and raises an alert on suspicious activity. An IPS goes one step further and blocks it.
Firewall filters traffic at the entry. IDS watches a copy of the traffic and raises alerts.
Firewall type
Works on
Packet filter
Source/destination IP, port, protocol of each packet
Stateful inspection
Tracks the state of connections
Application proxy
Checks the actual application data (HTTP, FTP)
Next-generation (NGFW)
Adds deep inspection, IPS, user and app control
IDS
Details
NIDS / HIDS
Network-based (watches a network segment) / Host-based (watches one computer)
Signature-based
Matches known attack patterns. Misses new attacks
Anomaly-based
Flags unusual behaviour. Can give false alarms
Example rule: allow TCP port 80 to the web server, deny everything else (default deny). DMZ = separate zone for public servers.
Example firewall rule table
#
From
To
Port / Protocol
Action
1
Any
Web server (DMZ)
TCP 80, 443
✅ Allow
2
Internal LAN
Any
TCP 80, 443
✅ Allow
3
Any
Internal LAN
Any
⛔ Deny
4
Any
Any
Any
⛔ Deny (default)
Rules are checked from top to bottom. The first matching rule is applied.
Firewall
IDS
IPS
Job
Allow or block by rules
Detect and alert
Detect and block
Position
At the network edge, in the path
Watches a copy of traffic
In the path of traffic
Reacts?
Yes, by rules
No, only reports
Yes, automatically
3.2.6 IPsec — IP Security
📖 IPsec: A set of protocols that secures traffic at the Network layer (works for every application above it). It is the base of many VPNs.
Part
Role
AH (protocol 51)
Authentication and integrity, no encryption
ESP (protocol 50)
Encryption, plus optional authentication
IKE (UDP 500)
Negotiates keys and creates a Security Association (SA)
Transport mode
Protects only the payload. Host to host
Tunnel mode
Protects the whole original IP packet inside a new one. Gateway to gateway (VPN)
Transport mode (payload protected)
IP header
ESP hdr
TCP + data (encrypted)
ESP trailer
ESP auth
Tunnel mode (whole packet protected)
New IP hdr
ESP hdr
Original IP + TCP + data (encrypted)
Trailer
Auth
ESP packet layouts. Only the bold green part is encrypted.
How an IPsec VPN is set up
Traffic that must be protected is identified by policy
IKE phase 1: both ends authenticate each other and make a secure channel
IKE phase 2: they agree on the Security Association (AH or ESP, algorithms, keys, mode)
Data is sent protected with ESP (or AH)
When the SA expires or is closed, the tunnel ends
🏫Chapter 3.3 — Case Study
🏫 CHAPTER 3.3 — CASE STUDY MIND MAP
Case 1 → Campus Area Network: 3-tier design (Core, Distribution, Access)
Why 3 tiers? Each layer has one job, so a fault in one building does not stop the whole campus, and new buildings are added at the distribution layer.
3.3.2 Case Study 2 — Wi-Fi Network Deployment in Educational Institutions
📖 Goal: Give reliable Wi-Fi in classrooms, labs, hostels and library for many users at the same time, with safe access.
Aspect
What to do
Site survey
Measure signal (heat map) first, then decide AP positions
Bands
2.4 GHz: longer range, more interference (use channels 1, 6, 11). 5 GHz: faster, shorter range, more channels
Standards
Wi-Fi 5 (802.11ac), Wi-Fi 6 (802.11ax) for dense classrooms
Management
Wireless controller (or cloud) for central settings and roaming
Power
PoE switch powers APs through the network cable
Security
WPA2/WPA3, 802.1X with RADIUS for staff and students, captive portal for guests
Control
Separate SSID and VLAN per group, bandwidth limits (QoS), monitoring
Challenges: high user density, interference, rogue access points, guest access control.
Channel planning
AP1 ch 1
AP2 ch 6
AP3 ch 11
AP4 ch 1
Neighbouring APs use different non-overlapping channels (1, 6, 11 in 2.4 GHz). A channel is reused only by an AP that is far away.
How a student connects
Student selects the Student SSID
Login is checked by the RADIUS server (802.1X)
DHCP gives an IP address in the student VLAN
Traffic goes through the firewall to the Internet
3.3.3 Case Study 3 — Drone Communication Networks
📖 Drone (UAV) network: Drones communicate with a Ground Control Station (GCS) and with each other. A group of drones forming an ad-hoc network is called FANET (Flying Ad hoc Network).
Link
Purpose
Command and control (C2)
Pilot or GCS sends commands to the drone
Telemetry
Drone sends position, speed, battery to the GCS
Payload / video
Camera or sensor data sent down to the ground
Long range
Cellular (4G/5G) or satellite relay when beyond line of sight
Challenges
Examples
High mobility
Topology changes fast, routes break
Limited battery and range
Short flight time, weak signals
Interference, latency
Shared radio bands, video needs low delay
Security
Jamming, GPS spoofing, hijacking, data interception
Instructions: Q10 and Q11 are compulsory. Attempt any one of Q12 and Q13.
Section A — 2 Marks Questions
2M2025-26
Q1. Recall when OSI model proposed and by whom? [CO1 | BT1]▼
Answer:
OSI (Open Systems Interconnection) reference model was developed by the ISO (International Organization for Standardization). The work started in the late 1970s (1977) and the model was published in 1984 as ISO 7498.
It is a reference model with 7 layers, not a protocol
Its purpose: a common structure so that products of different vendors can work together
2M2025-26
Q2. Identify the net mask of the gateway interface in a sub network where maximum of 25 hosts exist and IP address of one of the hosts is 192.168.1.17? [CO4 | BT2]▼
Answer:
Answer: 255.255.255.224 (/27)
Working
Hosts needed = 25. Usable hosts = 2h − 2, so h = 5 gives 30 (≥ 25), while h = 4 gives only 14
Block size = 256 − 224 = 32. The blocks are 0–31, 32–63, 64–95 …
192.168.1.17 lies in the block 0–31
Item
Value
Subnet (network) address
192.168.1.0/27
Usable host range
192.168.1.1 to 192.168.1.30 (30 hosts)
Broadcast address
192.168.1.31
Net mask of the gateway interface
255.255.255.224 (the gateway, e.g. 192.168.1.1, is in the same subnet)
2M2025-26
Q3. Discuss the primary purpose of the Domain Name System (DNS)? [CO5 | BT1]▼
Answer:
DNS (Domain Name System) is the Internet's phonebook. Its primary purpose is to translate human-friendly domain names (like www.example.com) into the IP addresses that computers use to find each other.
Users remember names, computers need numbers, so DNS does the name → IP lookup (and IP → name in reverse lookup)
It is a distributed, hierarchical database: Root → TLD (.com, .in) → Authoritative server
Answers are cached for a time (TTL), so repeated lookups are fast
Also tells where to deliver mail for a domain (MX record)
Numbers 1 to 8 show one recursive lookup: browser → resolver → root → TLD → authoritative → back to the browser.
2M2025-26
Q4. Describe how a firewall operates to protect a network from unauthorized access. [CO5 | BT2]▼
Answer:
Firewall: a hardware or software barrier between a trusted internal network and an untrusted network (the Internet). It allows or blocks traffic by rules, so unauthorized access is stopped.
How a firewall operates
Every packet entering or leaving the network passes through the firewall
The firewall compares the packet with its rules: source and destination IP, port number and protocol
The first matching rule decides: Allow or Deny. If no rule matches, the default rule (usually deny) applies
Allowed packets are forwarded. Blocked packets are dropped and may be logged
#
From
To
Port / Protocol
Action
1
Any
Web server (DMZ)
TCP 80, 443
✅ Allow
2
Internal LAN
Any
TCP 80, 443
✅ Allow
3
Any
Internal LAN
Any
⛔ Deny (default)
Firewall type
Checks
Packet filter
IP, port, protocol of each packet
Stateful inspection
Also remembers the state of each connection
Application proxy
The actual application data (HTTP, FTP)
2M2025-26
Q5. Memorize the term WWW. [CO4 | BT1]▼
Answer:
WWW (World Wide Web) is a system of interlinked hypertext documents (web pages) stored on web servers and accessed over the Internet using a browser and the HTTP protocol. It was proposed by Tim Berners-Lee at CERN in 1989 and first implemented in 1990.
Component
Role
Web page / HTML
The document with text, images and links
URL
The address of a page, e.g. https://www.example.com/index.html
HTTP / HTTPS
Protocol used to request and send pages
Web browser
Client software that shows pages (Chrome, Firefox)
Web server
Computer that stores and serves the pages
WWW is not the Internet. The Internet is the global network of computers. The WWW is one service that runs on it (email, FTP and others are different services).
Section B — 5 Marks Questions
5M2025-26
Q6. Illustrate the Guided transmission Media in computer networks with the help of examples. [CO2 | BT3]▼
Answer:
Guided media carry the signal along a physical path (a cable). The signal is guided by the cable. Three kinds are used.
Twisted pair
Coaxial cable
Optical fibre
Structure
Two insulated copper wires twisted together (UTP or STP)
Copper core, insulator, metal shield, plastic jacket
Glass or plastic core, cladding, jacket
Signal
Electrical
Electrical
Light
Speed
Cat 5e: 1 Gbps, Cat 6a: 10 Gbps
Up to hundreds of Mbps
Very high (Gbps to Tbps)
Distance
About 100 m per segment
Hundreds of metres
Many kilometres
Interference
Some noise, STP shields it
Better than twisted pair
Immune to electromagnetic noise
Cost
Lowest
Medium
Highest
Examples
LAN cabling (Ethernet), telephone lines
Cable TV, older Ethernet (10Base2)
Backbone, undersea cables, FTTH broadband
Twisting cancels noise: the two wires pick up the same interference, which cancels out
Optical fibre types: single-mode (thin core, long distance) and multi-mode (thick core, short distance)
Unguided media (radio, microwave, infrared) carry signals through air and are not guided by a cable
5M2025-26
Q7. Examine the working of Shortest Path Routing Algorithm with an example. [CO3 | BT3]▼
Answer:
Shortest path routing finds the path with the least total cost (distance, delay or hops) between a source and every destination. The standard algorithm is Dijkstra. It is the base of link-state routing (OSPF).
Dijkstra algorithm
Set the distance of the source = 0 and of all other nodes = ∞. All nodes are unvisited
Pick the unvisited node with the smallest distance and mark it visited (final)
For each neighbour, if (distance of picked node + link cost) is smaller than its current distance, update it and remember the previous node
Repeat steps 2 and 3 until all nodes are visited. Trace the previous nodes back to get each path
Example: source A
Edge numbers are costs. Thick green edges form the shortest path tree from A. d = shortest distance from A.
Step
Picked
B
C
D
E
F
1
A (0)
7
9
∞
∞
14
2
B (7)
7
9
22
∞
14
3
C (9)
7
9
20
∞
11
4
F (11)
7
9
20
20
11
5
D (20)
7
9
20
20
11
6
E (20)
7
9
20
20
11
Destination
Shortest cost
Path
B
7
A → B
C
9
A → C
D
20
A → C → D
E
20
A → C → F → E
F
11
A → C → F
Result: A → F costs 11 via C (9 + 2), which is better than the direct link of 14. A → E costs 20 via C and F, and A → D costs 20 via C.
Works only with non-negative costs. The router needs the full network map (link-state). Time is about O(E log V) with a priority queue.
5M2025-26
Q8. Explain Cyclic Redundancy Check? Suppose we want to transmit the message 11001001 and protect it from errors using the CRC polynomial x^3 + 1. Use polynomial long division to deduce the message that should be transmitted. [CO4 | BT4]▼
Answer:
CRC (Cyclic Redundancy Check) is an error-detection method. The sender divides the data (plus appended zeros) by a fixed generator polynomial using XOR (modulo-2) division and attaches the remainder. The receiver divides the received frame by the same generator. A remainder of 0 means no error.
Procedure for message 11001001 and generator x³ + 1
Answer: CRC bits = 011. The message to be transmitted is 11001001011.
Check at the receiver: dividing 11001001011 by 1001 gives remainder 000, so the frame is accepted. CRC detects all single-bit errors and all burst errors shorter than the length of the CRC.
5M2025-26
Q9. Examine the term Cryptography. Analyze the working of Symmetric & Asymmetric Encryption. [CO5 | BT4]▼
Answer:
Cryptography is the science of securing information by converting readable plaintext into unreadable ciphertext with an algorithm and a key (encryption), and back again (decryption). It provides confidentiality, integrity, authentication and non-repudiation.
Plaintext→🔒 Encrypt (Bob's PUBLIC key)→Ciphertext→🔓 Decrypt (Bob's PRIVATE key)→Plaintext
Symmetric encryption: working
Steps
Sender and receiver first share one secret key K safely
Sender encrypts: C = E(K, P)
Ciphertext C is sent over the network
Receiver decrypts with the same key: P = D(K, C)
Toy example (Caesar cipher, key K = 3): HELLO → KHOOR → (shift back by 3) → HELLO. Real systems use AES (128/192/256-bit key) or DES (56-bit key).
Asymmetric encryption: working
Steps
Bob makes a key pair: a public key (shared with everyone) and a private key (kept secret)
Alice encrypts the message with Bob's public key
Only Bob's private key can decrypt it, so nobody else can read it
No secret key has to be sent in advance
RSA example: p = 3, q = 11 → n = 33, φ = 20. Public key e = 7, private key d = 3 (7 × 3 = 21 ≡ 1 mod 20). Encrypt M = 4: C = 47 mod 33 = 16. Decrypt: 163 mod 33 = 4.
Symmetric
Asymmetric
Keys
One shared secret key
Key pair: public + private
Speed
Fast, good for large data
Slow, good for small data
Key distribution
Hard (must share the key safely)
Easy (public key is open)
Keys for 10 users
10 × 9 / 2 = 45 keys
10 key pairs
Examples
AES, DES
RSA, ECC
In practice (hybrid): HTTPS first uses asymmetric encryption to exchange a secret session key, then uses fast symmetric encryption for the data.
Section C — 10 Marks Questions
10M2025-26
Q10. Identify the devices at each layer of OSI reference model and illustrate their working. [CO1 | BT3]▼
Answer:
OSI reference model has 7 layers. Networking devices work at specific layers, depending on which header they read.
Data units: Application data → segment (Transport) → packet (Network) → frame (Data Link) → bits (Physical).
Device
Layer
Working
Repeater
1 Physical
Receives a weak signal, regenerates it and sends it on, to extend the cable length
Hub
1 Physical
Multi-port repeater. Copies every incoming bit to all other ports (one collision domain)
Modem
1 Physical
Converts digital data to analog signals and back for phone or cable lines
NIC
1 and 2
Connects a computer to the network and holds its MAC address
Bridge
2 Data Link
Joins two LAN segments and forwards frames only when needed, using MAC addresses
Switch
2 Data Link
Multi-port bridge. Learns which MAC address is on which port and sends the frame only to that port
Router
3 Network
Reads the IP address and forwards the packet to the next network using its routing table
Layer-3 switch
3 Network
A switch that can also route between VLANs and subnets
Firewall
3 to 7
Filters traffic by IP, port or application data using rules
Gateway
4 to 7 (up to Application)
Connects networks that use different protocols and converts between them
Example: PC A sends data to PC B in another network
PC A (Application to Transport) creates data and a segment. IP adds the IP header (Network). The NIC adds a frame header with the router's MAC address (Data Link)
The switch reads the MAC address and sends the frame to the router's port only
The router removes the frame, reads the IP address, picks the next hop and builds a new frame
The frame reaches PC B, which removes the headers layer by layer and gives the data to the application
10M2025-26
Q11. Explain the sliding window protocol for data link layer in detail. Compare its various types. [CO3 | BT3]▼
Answer:
Sliding window protocol is a Data Link Layer method for reliable and efficient delivery. The sender may send several frames before an ACK arrives. The number of frames allowed is the window. Frames are numbered with m-bit sequence numbers (0 to 2m − 1). As ACKs arrive, the window slides forward.
0
1
2
3
4
5
6
7
Window of 4: frames 0 to 3 may be sent without waiting for an ACK. Frames 4 to 7 must wait.
0
1
2
3
4
5
6
7
ACKs for frames 0 and 1 arrive: the window slides right by 2. Now frames 2 to 5 may be sent.
Working
The sender numbers each frame and keeps a copy until it is acknowledged
The sender may send as many frames as its window allows, without waiting
The receiver accepts frames inside its window and sends an ACK (it can piggyback the ACK on its own data frames)
When an ACK arrives, the sender window slides forward, so new frames can be sent
If an ACK does not arrive before the timeout (or a NAK arrives), the lost frame is retransmitted
Types of sliding window protocols
1) Stop-and-Wait (1-bit sliding window): window size 1. Send one frame, wait for its ACK. Simple, but the link is idle while waiting. 2) Go-Back-N (GBN): sender window up to 2m − 1, receiver window 1. Frames must arrive in order. If one frame is lost, the receiver discards all later frames and the sender resends that frame and all after it. ACKs are cumulative. 3) Selective Repeat (SR): sender and receiver windows 2m−1. The receiver buffers out-of-order frames and the sender resends only the lost frame. ACKs are individual.
Go-Back-N: frame F2 is lost, F3 is discarded (out of order), the sender goes back and resends F2 and F3.
Sliding window efficiency = N / (1 + 2a), when N < 1 + 2a
Example: a = 20. Stop-and-Wait = 1/41 ≈ 2.4%. GBN with m = 3 (N = 7) = 7/41 ≈ 17.1%
m = 3 → GBN window = 2³ − 1 = 7, SR window = 2² = 4
Optional pair: attempt Q12 or Q13
10M2025-26
Q12. (a) Explain the various fields of TCP header and working of TCP protocol. (b) Suppose a TCP connection is transferring a file of 5000 bytes. The first byte is numbered 10001. Evaluate the sequence number for each segment if data is sent in three segments, each carrying 1000 bytes. [CO4 | BT5]▼
Answer:
(a) TCP (Transmission Control Protocol) is a connection-oriented, reliable transport protocol. It numbers bytes, acknowledges data, resends lost data and controls flow and congestion.
TCP header fields
Source Port (16)
Destination Port (16)
Sequence Number (32)
Acknowledgement Number (32)
Offset (4)
Reserved
URG ACK PSH RST SYN FIN
Window (16)
Checksum (16)
Urgent Pointer (16)
Options + Padding
TCP header: 20 bytes minimum, 60 bytes maximum.
Field
Purpose
Source / Destination port (16 bits each)
Identify the sending and receiving applications
Sequence number (32)
Number of the first data byte in this segment
Acknowledgement number (32)
Next byte the receiver expects (valid when ACK = 1)
Data offset / HLEN (4)
Header length in 32-bit words (5 to 15 → 20 to 60 bytes)
Flags (URG ACK PSH RST SYN FIN)
SYN: start, ACK: acknowledgement, FIN: close, RST: reset, PSH: push data now, URG: urgent data
Window size (16)
How many bytes the receiver can accept (flow control)
Checksum (16)
Error detection for header and data
Urgent pointer (16)
End of urgent data (valid if URG = 1)
Options + padding
Extra settings such as maximum segment size
Working of TCP
Phases
Connection setup by a three-way handshake: SYN → SYN + ACK → ACK
Data transfer: data is cut into segments, each with a sequence number. The receiver sends ACKs. Unacknowledged data is retransmitted after a timeout
Flow control uses the window size and congestion control uses slow start and congestion avoidance
Connection close by FIN and ACK from each side
(b) Sequence numbers
The sequence number of a segment is the number of its first byte. The next segment starts where the previous one ended: next sequence number = sequence number + number of data bytes.
Seg.
Bytes
Seq. no.
ACK no.
1
10001 to 11000
10001
11001
2
11001 to 12000
11001
12001
3
12001 to 13000
12001
13001
Seq. no. = first byte of the segment. ACK no. = the next byte the receiver expects.
Answer: the three segments have sequence numbers 10001, 11001 and 12001.
The numbers 11000, 12000 and 13000 are the last bytes of the three segments, not their sequence numbers. The whole file is 5000 bytes, so two more segments are needed: 13001 (bytes 13001 to 14000) and 14001 (bytes 14001 to 15000).
10M2025-26
Q13. OR — (a) Explain the features of UDP and its advantages and disadvantages over the TCP. (b) Suppose a UDP header in hexadecimal format is as 0045000D0058FE20. Evaluate & explain: i) Source port number ii) Destination port number iii) Length of user datagram iv) Length of the data. [CO4 | BT5]▼
Answer:
(a) UDP (User Datagram Protocol) is a connectionless, unreliable transport protocol. It sends independent datagrams without a handshake, acknowledgement or retransmission.
Features
Connectionless: no connection setup or closing
Unreliable: no ACK, no retransmission, no ordering
Small header: only 8 bytes (TCP: 20 to 60 bytes)
Message oriented: each datagram is sent as one unit
Supports broadcast and multicast
Checksum for error detection (optional in IPv4, mandatory in IPv6)
A UDP header is 8 bytes = 16 hex digits. Split it into four 16-bit fields (4 hex digits each) and convert each from hexadecimal to decimal.
Field
Hex
Working
Value
Source port
0045
4 × 16 + 5
69
Destination port
000D
13 (D = 13)
13
Length of datagram
0058
5 × 16 + 8
88 bytes
Checksum
FE20
not asked
65056
Answers: i) Source port number = 69 ii) Destination port number = 13 iii) Length of user datagram = 88 bytes (header + data) iv) Length of the data = 88 − 8 (header) = 80 bytes