🌐 Computer Networks

Unit 3 — Protocols, Network Security & Case Study

📚 Chapters

🌐Chapter 3.1 — Protocols in Upper Layers
🌐 CHAPTER 3.1 — PROTOCOLS IN UPPER LAYERS MIND MAP
Network layer → IPv4 (32-bit) vs IPv6 (128-bit)
Transport layer → TCP (reliable, connection) vs UDP (fast, no connection)
Application layer → DNS · HTTP/WWW · FTP · SNMP · Email (SMTP, POP3, IMAP) · TELNET/SSH
Ports → Identify the application: 80 HTTP, 53 DNS, 22 SSH …

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.
Client (browser)→Request→Server (web server)→Response→Client
💡 Analogy: Ordering food. You (client) place an order, the restaurant (server) sends the food. The delivery boy is the network.
Layers used in this unit
LayerProtocolsJob
ApplicationDNS, HTTP, FTP, SMTP, POP3, IMAP, SNMP, TELNET, SSHWhat the user's program needs
TransportTCP, UDPDelivers data to the right program (port number)
NetworkIPv4, IPv6Delivers data to the right computer (IP address)
IP address vs port number
IP addressLike a building address. It finds the computer.
Port numberLike a flat number inside the building. It finds the program.
SocketIP + port together, e.g. 192.168.1.5:80
Encapsulation: how headers are added
Application: data→Transport: + TCP/UDP header = segment→Network: + IP header = packet→Data Link: + frame header = frame
Frame hdr
IP hdr
TCP hdr
Data (HTTP, DNS …)
Trailer
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
PointIPv4IPv6
Address size32 bits128 bits
Header20 – 60 bytes (variable)40 bytes (fixed)
Header checksumYesNo (removed for speed)
FragmentationRouters and sourceOnly the source host
ConfigurationManual or DHCPAuto-configuration (SLAAC) or DHCPv6
BroadcastYesNo (uses multicast / anycast)
IPsecOptional add-onDesigned into the protocol
NotationDotted decimalHexadecimal with colons
Transition methods: Dual stack (run both), tunneling (IPv6 packet inside IPv4), translation (NAT64).
What changed from IPv4 to IPv6 header?
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
TypeMeaningExample
UnicastOne sender to one receiver2001:db8::1, link-local starts with fe80
MulticastOne to a groupStarts with ff
AnycastOne to the nearest member of a groupSame address on several servers
LoopbackOwn 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)ReservedURG ACK PSH RST SYN FINWindow (16)
Checksum (16)Urgent Pointer (16)
Options + Padding
TCP header: 20 bytes minimum, 60 bytes maximum.
FlagMeaning
SYNStart a connection (synchronize sequence numbers)
ACKAcknowledgement field is valid
FINSender has finished, close connection
RSTReset / abort the connection
PSHPush data to the application at once
URGUrgent pointer is valid
Connection setup
ClientServer1. SYN (seq = x)2. SYN + ACK (seq = y, ack = x+1)3. ACK (ack = y+1)
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
  1. Client sends 3 segments of 100 bytes each. First sequence number = 1000
  2. Segment 1: seq 1000 (bytes 1000–1099), Segment 2: seq 1100, Segment 3: seq 1200
  3. Server received all → ACK = 1300 (the next byte it expects)
  4. If segment 2 is lost, the server keeps sending ACK 1100 (duplicate ACKs). The sender then resends segment 2
Closing a connection
ClientServer1. FIN2. ACK3. FIN4. ACK
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.
PointTCPUDP
ConnectionConnection-orientedConnectionless
ReliabilityReliable (ACK, resend)Unreliable (best effort)
OrderingIn-order deliveryNo ordering
Header20 – 60 bytes8 bytes
SpeedSlowerFaster
Flow / congestion controlYesNo
Used byHTTP, FTP, SMTP, POP3, IMAP, SSHDNS, 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.
ProtocolPortTransportPurpose
HTTP / WWW80TCPWeb pages
HTTPS443TCPSecure web (HTTP + TLS)
DNS53UDP (TCP for large replies)Name → IP
FTP21 (control), 20 (data)TCPFile transfer
SMTP25TCPSend email
POP3110TCPDownload email
IMAP143TCPRead email on server
TELNET23TCPRemote login (not secure)
SSH22TCPSecure remote login
SNMP161 (agent), 162 (traps)UDPNetwork 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.
BrowserResolverRootTLDAuth12345678
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)
RecordMeaning
AName → IPv4 address
AAAAName → IPv6 address
CNAMEAlias of another name
MXMail server of the domain
NSAuthoritative name server
PTRIP → name (reverse lookup)
DNS hierarchy
Root ( . ).com.in.orgexample.comwww.example.comwikipedia.orgRead right to left: www . example . com
Names are read from right to left: root → .com → example.com → www.
Recursive queryIterative query
Who does the workThe DNS server finds the final answer for the clientThe server only gives a referral ("ask that server"); the asker continues
Typical useBrowser → resolverResolver → 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).
💡 URL parts: https://www.example.com:443/notes/cn?unit=3 → scheme, host, port, path, query.
Browser: GET /index.html→Web server→Response: 200 OK + HTML page
ItemDetails
MethodsGET (fetch), POST (send data), PUT (replace), DELETE (remove), HEAD (headers only)
Status codes200 OK · 301 moved · 404 not found · 500 server error
VersionsHTTP/1.0 closes after each request. HTTP/1.1 keeps connection open (persistent)
CookiesSmall data stored by the browser so a stateless server can recognise you
HTTPSHTTP over TLS: encrypted and authenticated, port 443
HTTP message format (example)
PartRequestResponse
First lineGET /index.html HTTP/1.1HTTP/1.1 200 OK
HeadersHost: www.example.com
Accept: text/html
Content-Type: text/html
Content-Length: 1256
Blank line(ends the headers)(ends the headers)
BodyEmpty for GETThe HTML page

3.1.8 Email Protocols — SMTP, POP3, IMAP

📖 Email system: SMTP pushes mail from the sender to mail servers. The receiver then fetches it from the server using POP3 or IMAP.
Sender (user agent)→SMTP→Sender mail server→SMTP→Receiver mail server→POP3 / IMAP→Receiver (user agent)
POP3IMAP
Port110143
Mail storageDownloaded to one device (usually removed from server)Stays on the server, synced to all devices
Folders on serverNoYes
Best forSingle device, offline useMany devices (phone + laptop)
💡 Example: Rahul sends mail to Priya
  1. Rahul writes a mail to priya@example.com in his mail app
  2. His app sends it to Rahul's mail server using SMTP
  3. Rahul's server finds Priya's mail server using the MX record from DNS
  4. The mail is passed on with SMTP and stored in Priya's mailbox
  5. Priya's app fetches it using POP3 or IMAP

3.1.9 FTP, TELNET, SSH and SNMP

ProtocolWhat it doesKey points
FTPTransfers files between client and serverUses two connections: control (21) and data (20). Username and password are sent in plain text
TELNETRemote login to another computerPort 23, all text including password is not encrypted
SSHSecure replacement of TELNETPort 22, encrypted login and file transfer
SNMPMonitor and manage network devicesManager talks to agents on devices, data kept in a MIB. Messages: GET, SET, TRAP. Uses UDP 161/162
🔐Chapter 3.2 — Network Security
🔐 CHAPTER 3.2 — NETWORK SECURITY MIND MAP
Goals (CIA) → Confidentiality, Integrity, Availability
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.
FabricationAttacker sends fake messages (spoofing). Authenticity lost.
Passive attackActive attack
IdeaOnly listens, data is not changedChanges, blocks or creates data
ExamplesEavesdropping / sniffing, traffic analysisSpoofing, replay, modification, DoS / DDoS, man-in-the-middle
DetectionHard 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 typeIdeaExample
SubstitutionReplace each letter with anotherCaesar cipher (shift 3): HELLO → KHOOR
TranspositionRearrange the positions of lettersRail fence (2 rows): HELLO → HLOEL
Stream cipherEncrypts bit by bit or byte by byteRC4
Block cipherEncrypts fixed-size blocksDES (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
ModernSymmetric: DES, 3DES, AES
Asymmetric: RSA, ECC
Hash function (used in integrity and signatures)
📖 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.
MessageSHA-256 (first 16 hex digits)
Hello185f8db32271fe25…
hello2cf24dba5fb0a30e…
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).
Symmetric: one shared key
Plaintext→🔒 Encrypt (secret key K)→Ciphertext→🔓 Decrypt (same key K)→Plaintext
Asymmetric: key pair
Plaintext→🔒 Encrypt (Bob's PUBLIC key)→Ciphertext→🔓 Decrypt (Bob's PRIVATE key)→Plaintext
SymmetricAsymmetric
Keys1 shared keyKey pair (public + private)
SpeedFast (bulk data)Slow (small data, key exchange)
ProblemKey distributionNeeds trust in public keys
ExamplesAES, DESRSA
📐 RSA example
  1. Choose p = 3, q = 11 → n = p×q = 33, φ = (p−1)(q−1) = 20
  2. Public key e = 7, private key d = 3 (because 7×3 = 21 ≡ 1 mod 20)
  3. Encrypt M = 4: C = 47 mod 33 = 16
  4. 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.
InternetFirewallSwitchInternal LANIDScopy of trafficblocks / allows
Firewall filters traffic at the entry. IDS watches a copy of the traffic and raises alerts.
Firewall typeWorks on
Packet filterSource/destination IP, port, protocol of each packet
Stateful inspectionTracks the state of connections
Application proxyChecks the actual application data (HTTP, FTP)
Next-generation (NGFW)Adds deep inspection, IPS, user and app control
IDSDetails
NIDS / HIDSNetwork-based (watches a network segment) / Host-based (watches one computer)
Signature-basedMatches known attack patterns. Misses new attacks
Anomaly-basedFlags 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
#FromToPort / ProtocolAction
1AnyWeb server (DMZ)TCP 80, 443✅ Allow
2Internal LANAnyTCP 80, 443✅ Allow
3AnyInternal LANAny⛔ Deny
4AnyAnyAny⛔ Deny (default)
Rules are checked from top to bottom. The first matching rule is applied.
FirewallIDSIPS
JobAllow or block by rulesDetect and alertDetect and block
PositionAt the network edge, in the pathWatches a copy of trafficIn the path of traffic
Reacts?Yes, by rulesNo, only reportsYes, 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.
PartRole
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 modeProtects only the payload. Host to host
Tunnel modeProtects 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
  1. Traffic that must be protected is identified by policy
  2. IKE phase 1: both ends authenticate each other and make a secure channel
  3. IKE phase 2: they agree on the Security Association (AH or ESP, algorithms, keys, mode)
  4. Data is sent protected with ESP (or AH)
  5. 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)
Case 2 → Wi-Fi: APs + controller + SSIDs + security
Case 3 → Drone networks: control link, FANET, relay

3.3.1 Case Study 1 — Campus Area Network (CAN) for a University

📖 CAN: A network that connects many LANs of buildings within a campus (labs, library, hostels, admin) using a high-speed backbone.
InternetFirewallCore SwitchServer / DMZAcademicAccess SW + APHostelAccess SW + APAdminAccess SW + APCore → Distribution → Access (3-tier)
Hierarchical design: easy to grow, easy to find faults.
LayerRoleDevices and media
CoreFast backbone, no heavy filteringCore switches/routers, fiber links
DistributionPer-building routing, VLANs, policiesLayer-3 switches
AccessConnects usersAccess switches, Wi-Fi APs, UTP Cat6 (up to 100 m)
  • Requirements: users (students, staff, labs, hostels), Wi-Fi coverage, servers, internet link, security, future growth
  • Design steps: requirement analysis → topology → IP and VLAN plan → hardware selection → security → testing and monitoring
  • IP plan: separate VLAN per department, private IP addresses with NAT, DHCP and DNS servers
  • Security: firewall at the edge, DMZ for public web server, ACLs, IDS
  • Reliability: redundant links and two ISPs
Sample IP and VLAN plan (for understanding)
GroupVLANNetworkUsable hosts
Academic1010.10.10.0/24254
Hostel2010.10.20.0/23510
Admin3010.10.30.0/25126
Guest Wi-Fi4010.10.40.0/24254
Servers5010.10.50.0/2662
Requirements→Topology→IP + VLAN plan→Hardware→Security→Test + monitor
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.
InternetFirewallControllerPoE SwitchAPSSID StudentAPSSID StaffAPSSID GuestSeparate SSID + VLAN for each user group
AspectWhat to do
Site surveyMeasure signal (heat map) first, then decide AP positions
Bands2.4 GHz: longer range, more interference (use channels 1, 6, 11). 5 GHz: faster, shorter range, more channels
StandardsWi-Fi 5 (802.11ac), Wi-Fi 6 (802.11ax) for dense classrooms
ManagementWireless controller (or cloud) for central settings and roaming
PowerPoE switch powers APs through the network cable
SecurityWPA2/WPA3, 802.1X with RADIUS for staff and students, captive portal for guests
ControlSeparate 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
  1. Student selects the Student SSID
  2. Login is checked by the RADIUS server (802.1X)
  3. DHCP gives an IP address in the student VLAN
  4. 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).
Satellite / 5G towerGround StationD1D2D3Green = drone-to-drone links (FANET). Dashed = control / relay links
LinkPurpose
Command and control (C2)Pilot or GCS sends commands to the drone
TelemetryDrone sends position, speed, battery to the GCS
Payload / videoCamera or sensor data sent down to the ground
Long rangeCellular (4G/5G) or satellite relay when beyond line of sight
ChallengesExamples
High mobilityTopology changes fast, routes break
Limited battery and rangeShort flight time, weak signals
Interference, latencyShared radio bands, video needs low delay
SecurityJamming, GPS spoofing, hijacking, data interception
RegulationFlight permissions, frequency rules
Applications: surveillance, agriculture, delivery, mapping, disaster management.
What is inside a drone?
Flight controllerKeeps the drone stable and follows commands
GPSGives position
Radio / telemetryLink to the ground station
Camera / sensorsPayload data
Battery + motorsPower and movement
Single link (drone ↔ GCS)FANET (drones as relays)
RangeLimited to the GCS rangeLarger, drones forward data for each other
If one link failsControl may be lostData can take another path
ComplexitySimpleRouting is harder because nodes move fast (adapted MANET protocols like AODV or OLSR are used)
⚡Ready for Exam?Sab padh liya? Ab Quick Revision karo — definition, example aur diagram ek jagah!Quick Revision Karo →
⚡Quick Revision — Last Minute Exam Prep!
📌 How to use: Har topic mein pehle Definition, phir Example, phir Diagram hai.

📝 2025-26 Final Exam — One-line Recall

1️⃣ Q1 OSI modelProposed by ISO. Work from 1977, published 1984 (ISO 7498). 7 layers.
2️⃣ Q2 Net mask25 hosts need 5 host bits → /27 → 255.255.255.224. 192.168.1.17 is in 192.168.1.0/27.
3️⃣ Q3 DNSTranslates domain names to IP addresses. Root → TLD → Authoritative.
4️⃣ Q4 FirewallFilters traffic by rules (IP, port, protocol): allow or deny.
5️⃣ Q5 WWWInterlinked web pages over HTTP, read in a browser. Tim Berners-Lee, CERN.
6️⃣ Q6 Guided mediaTwisted pair, coaxial cable, optical fibre.
7️⃣ Q7 Shortest pathDijkstra: pick the nearest unvisited node, update neighbours. A to E = 20 via C and F.
8️⃣ Q8 CRC11001001 with x³ + 1 (1001): CRC = 011, frame = 11001001011.
9️⃣ Q9 CryptographySymmetric: one shared key (AES). Asymmetric: public + private key (RSA).
🔟 Q10 OSI devicesHub, repeater (L1). Switch, bridge (L2). Router (L3). Gateway (L4 to 7).
🅰️ Q11 Sliding windowStop-and-Wait 1, GBN 2m−1, SR 2m−1. Efficiency = N/(1+2a).
🅱️ Q12 TCPSeq no. = first byte. 10001, 11001, 12001 (then 13001, 14001).
🆎 Q13 UDP0045000D0058FE20: source 69, destination 13, length 88, data 80.

🌐 Chapter 3.1 — Protocols in Upper Layers

1. Layers and Encapsulation
📖 Definition: Each layer adds its own header to the data before sending (encapsulation). IP address finds the computer, port finds the program.
💡 Example: Browser data + TCP header (port 80) + IP header + frame header.
Application: data→Transport: + TCP/UDP header = segment→Network: + IP header = packet→Data Link: + frame header = frame
Frame hdr
IP hdr
TCP hdr
Data (HTTP, DNS …)
Trailer
Each layer adds its own header (encapsulation). The receiver removes them in the reverse order.
2. IPv4 vs IPv6
📖 Definition: IPv6 uses 128-bit addresses and a fixed 40-byte header. IPv4 uses 32-bit addresses.
💡 Example: 2001:0db8:0000:0000:0000:ff00:0042:8329 → 2001:db8::ff00:42:8329
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).
3. TCP
📖 Definition: Connection-oriented, reliable transport protocol with a three-way handshake.
💡 Example: SYN → SYN+ACK → ACK, then data flows.
ClientServer1. SYN (seq = x)2. SYN + ACK (seq = y, ack = x+1)3. ACK (ack = y+1)
TCP three-way handshake. Data flows only after step 3.
4. UDP
📖 Definition: Connectionless, unreliable, fast. 8-byte header.
💡 Example: DNS query, video streaming, VoIP.
Source Port (16)Destination Port (16)
Length (16)Checksum (16)
UDP header: only 8 bytes.
TCPUDP
ReliableYesNo
Header20–60 B8 B
SpeedSlowerFaster
5. DNS
📖 Definition: Converts a domain name to an IP address using Root → TLD → Authoritative servers.
💡 Example: www.example.com → 93.184.216.34 style IP is returned and cached.
BrowserResolverRootTLDAuth12345678
1 → 8 = order of messages
6. HTTP and Email
📖 Definition: HTTP is stateless request-response (port 80). SMTP sends mail, POP3 downloads it, IMAP keeps it on the server.
💡 Example: GET /index.html → 200 OK. Gmail on phone and laptop uses IMAP-style sync.
Sender (user agent)→SMTP→Sender mail server→SMTP→Receiver mail server→POP3 / IMAP→Receiver (user agent)
PortProtocol
80 / 443HTTP / HTTPS
53DNS
21 / 20FTP
25 / 110 / 143SMTP / POP3 / IMAP
22 / 23SSH / TELNET
161SNMP

🔐 Chapter 3.2 — Network Security

1. Attacks
📖 Definition: Passive attacks listen. Active attacks change, block or create data.
💡 Example: Sniffing = passive. DoS and spoofing = active.
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.
FabricationAttacker sends fake messages (spoofing). Authenticity lost.
2. Ciphers and Keys
📖 Definition: Cipher = encryption method. Symmetric uses one key, asymmetric uses public + private key.
💡 Example: Caesar shift 3: HELLO → KHOOR. RSA: p=3, q=11, e=7, d=3, M=4 → C=16.
Symmetric: one shared key
Plaintext→🔒 Encrypt (secret key K)→Ciphertext→🔓 Decrypt (same key K)→Plaintext
Asymmetric: key pair
Plaintext→🔒 Encrypt (Bob's PUBLIC key)→Ciphertext→🔓 Decrypt (Bob's PRIVATE key)→Plaintext
3. Digital Signature
📖 Definition: Hash of message encrypted with the sender's private key. Gives authentication, integrity, non-repudiation.
💡 Example: Receiver decrypts with public key and compares hashes.
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
4. Firewall and IDS
📖 Definition: Firewall allows or blocks traffic by rules. IDS detects and alerts.
💡 Example: Allow TCP 80, deny everything else.
InternetFirewallSwitchInternal LANIDScopy of trafficblocks / allows
Firewall filters traffic at the entry. IDS watches a copy of the traffic and raises alerts.
5. IPsec
📖 Definition: Network-layer security with AH (authentication) and ESP (encryption). Modes: transport and tunnel.
💡 Example: Site-to-site VPN uses ESP in tunnel mode.
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

🏫 Chapter 3.3 — Case Studies

1. Campus Area Network
📖 Definition: Many building LANs joined by a fiber backbone, designed in Core, Distribution and Access layers.
💡 Example: University: fiber between buildings, VLAN per department, firewall + DMZ at the edge.
InternetFirewallCore SwitchServer / DMZAcademicAccess SW + APHostelAccess SW + APAdminAccess SW + APCore → Distribution → Access (3-tier)
2. Wi-Fi in Institutions
📖 Definition: Many APs managed by a controller, powered by PoE, with separate SSIDs and secure login.
💡 Example: Student, Staff and Guest SSIDs on different VLANs with WPA2/WPA3.
InternetFirewallControllerPoE SwitchAPSSID StudentAPSSID StaffAPSSID GuestSeparate SSID + VLAN for each user group
3. Drone Networks
📖 Definition: Drones link to a ground station and to each other (FANET), with cellular or satellite relay for long range.
💡 Example: Delivery or survey drones sharing position and video.
Satellite / 5G towerGround StationD1D2D3Green = drone-to-drone links (FANET). Dashed = control / relay links
📄Previous Year Questions
📝 Final Examination (2025-26) — complete paper
Program: BE-CSE/IT
Subject: Computer Networks (23CST-302 / 23ITT-302)
Semester: 5  ·  Time: 3 Hours  ·  Max Marks: 60
Section A: 5 × 2 = 10  ·  Section B: 4 × 5 = 20  ·  Section C: 3 × 10 = 30
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.
Application→Presentation→Session→Transport→Network→Data Link→Physical
  • 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
  1. Hosts needed = 25. Usable hosts = 2h − 2, so h = 5 gives 30 (≥ 25), while h = 4 gives only 14
  2. 5 host bits → prefix length = 32 − 5 = /27 → mask 255.255.255.224
  3. Block size = 256 − 224 = 32. The blocks are 0–31, 32–63, 64–95 …
  4. 192.168.1.17 lies in the block 0–31
ItemValue
Subnet (network) address192.168.1.0/27
Usable host range192.168.1.1 to 192.168.1.30 (30 hosts)
Broadcast address192.168.1.31
Net mask of the gateway interface255.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)
BrowserResolverRootTLDAuth12345678
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.
InternetFirewallSwitchInternal LANIDScopy of trafficblocks / allows
How a firewall operates
  1. Every packet entering or leaving the network passes through the firewall
  2. The firewall compares the packet with its rules: source and destination IP, port number and protocol
  3. The first matching rule decides: Allow or Deny. If no rule matches, the default rule (usually deny) applies
  4. Allowed packets are forwarded. Blocked packets are dropped and may be logged
#FromToPort / ProtocolAction
1AnyWeb server (DMZ)TCP 80, 443✅ Allow
2Internal LANAnyTCP 80, 443✅ Allow
3AnyInternal LANAny⛔ Deny (default)
Firewall typeChecks
Packet filterIP, port, protocol of each packet
Stateful inspectionAlso remembers the state of each connection
Application proxyThe 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.
ComponentRole
Web page / HTMLThe document with text, images and links
URLThe address of a page, e.g. https://www.example.com/index.html
HTTP / HTTPSProtocol used to request and send pages
Web browserClient software that shows pages (Chrome, Firefox)
Web serverComputer 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 pairCoaxial cableOptical fibre2 twisted wirescore · insulator · shieldcore · cladding · jacket
Twisted pairCoaxial cableOptical fibre
StructureTwo insulated copper wires twisted together (UTP or STP)Copper core, insulator, metal shield, plastic jacketGlass or plastic core, cladding, jacket
SignalElectricalElectricalLight
SpeedCat 5e: 1 Gbps, Cat 6a: 10 GbpsUp to hundreds of MbpsVery high (Gbps to Tbps)
DistanceAbout 100 m per segmentHundreds of metresMany kilometres
InterferenceSome noise, STP shields itBetter than twisted pairImmune to electromagnetic noise
CostLowestMediumHighest
ExamplesLAN cabling (Ethernet), telephone linesCable 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
  1. Set the distance of the source = 0 and of all other nodes = ∞. All nodes are unvisited
  2. Pick the unvisited node with the smallest distance and mark it visited (final)
  3. For each neighbour, if (distance of picked node + link cost) is smaller than its current distance, update it and remember the previous node
  4. Repeat steps 2 and 3 until all nodes are visited. Trace the previous nodes back to get each path
Example: source A
7914101511269Ad = 0Bd = 7Cd = 9Dd = 20Ed = 20Fd = 11
Edge numbers are costs. Thick green edges form the shortest path tree from A. d = shortest distance from A.
StepPickedBCDEF
1A (0)79∞∞14
2B (7)7922∞14
3C (9)7920∞11
4F (11)79202011
5D (20)79202011
6E (20)79202011
DestinationShortest costPath
B7A → B
C9A → C
D20A → C → D
E20A → C → F → E
F11A → 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
  1. Generator x³ + 1 = 1·x³ + 0·x² + 0·x + 1 → 1001 (degree 3, so append 3 zeros)
  2. Dividend = 11001001 + 000 = 11001001000
  3. Divide by 1001. Leading bit 1 → XOR with 1001, leading bit 0 → XOR with 0000
  4. Remainder = 011
  5. Transmitted frame = message + remainder = 11001001011
StepBits takenXOR → remainder
11100
first 4 bits
⊕ 1001
= 0101 → 101
21011
101 + next bit 1
⊕ 1001
= 0010 → 010
30100
010 + next bit 0
⊕ 0000
= 0100 → 100
41000
100 + next bit 0
⊕ 1001
= 0001 → 001
50011
001 + next bit 1
⊕ 0000
= 0011 → 011
60110
011 + next bit 0
⊕ 0000
= 0110 → 110
71100
110 + next bit 0
⊕ 1001
= 0101 → 101
81010
101 + next bit 0
⊕ 1001
= 0011 → 011
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.
Symmetric: one shared key
Plaintext→🔒 Encrypt (secret key K)→Ciphertext→🔓 Decrypt (same key K)→Plaintext
Asymmetric: key pair
Plaintext→🔒 Encrypt (Bob's PUBLIC key)→Ciphertext→🔓 Decrypt (Bob's PRIVATE key)→Plaintext
Symmetric encryption: working
Steps
  1. Sender and receiver first share one secret key K safely
  2. Sender encrypts: C = E(K, P)
  3. Ciphertext C is sent over the network
  4. 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
  1. Bob makes a key pair: a public key (shared with everyone) and a private key (kept secret)
  2. Alice encrypts the message with Bob's public key
  3. Only Bob's private key can decrypt it, so nobody else can read it
  4. 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.
SymmetricAsymmetric
KeysOne shared secret keyKey pair: public + private
SpeedFast, good for large dataSlow, good for small data
Key distributionHard (must share the key safely)Easy (public key is open)
Keys for 10 users10 × 9 / 2 = 45 keys10 key pairs
ExamplesAES, DESRSA, 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.
7 ApplicationGateway, proxy firewall6 PresentationGateway (encryption, compression)5 SessionGateway (session control)4 TransportGateway, firewall, load balancer3 NetworkRouter, Layer-3 switch2 Data LinkSwitch, bridge, NIC, access point1 PhysicalHub, repeater, modem, cables
Data units: Application data → segment (Transport) → packet (Network) → frame (Data Link) → bits (Physical).
DeviceLayerWorking
Repeater1 PhysicalReceives a weak signal, regenerates it and sends it on, to extend the cable length
Hub1 PhysicalMulti-port repeater. Copies every incoming bit to all other ports (one collision domain)
Modem1 PhysicalConverts digital data to analog signals and back for phone or cable lines
NIC1 and 2Connects a computer to the network and holds its MAC address
Bridge2 Data LinkJoins two LAN segments and forwards frames only when needed, using MAC addresses
Switch2 Data LinkMulti-port bridge. Learns which MAC address is on which port and sends the frame only to that port
Router3 NetworkReads the IP address and forwards the packet to the next network using its routing table
Layer-3 switch3 NetworkA switch that can also route between VLANs and subnets
Firewall3 to 7Filters traffic by IP, port or application data using rules
Gateway4 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
  1. 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)
  2. The switch reads the MAC address and sends the frame to the router's port only
  3. The router removes the frame, reads the IP address, picks the next hop and builds a new frame
  4. 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
  1. The sender numbers each frame and keeps a copy until it is acknowledged
  2. The sender may send as many frames as its window allows, without waiting
  3. The receiver accepts frames inside its window and sends an ACK (it can piggyback the ACK on its own data frames)
  4. When an ACK arrives, the sender window slides forward, so new frames can be sent
  5. 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.
SenderReceiverF0F1F2F3✕F3 discarded⏱ timeout for F2F2 (resent)F3 (resent)
Go-Back-N: frame F2 is lost, F3 is discarded (out of order), the sender goes back and resends F2 and F3.
Stop-and-WaitGo-Back-NSelective Repeat
Sender window12m − 12m−1
Receiver window112m−1
Out-of-order framesNot possibleDiscardedBuffered
On a lost frameResend that frameResend it and all after itResend only that frame
ACK typePer frameCumulativeIndividual (or NAK)
Receiver bufferNoneNoneNeeded
Bandwidth usePoorWastes bandwidth on errorsBest
ComplexityLowestMediumHighest
📐 Efficiency and window size
a = Tp / Tt. Stop-and-Wait efficiency = 1 / (1 + 2a)
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)ReservedURG ACK PSH RST SYN FINWindow (16)
Checksum (16)Urgent Pointer (16)
Options + Padding
TCP header: 20 bytes minimum, 60 bytes maximum.
FieldPurpose
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 + paddingExtra settings such as maximum segment size
Working of TCP
Phases
  1. Connection setup by a three-way handshake: SYN → SYN + ACK → ACK
  2. Data transfer: data is cut into segments, each with a sequence number. The receiver sends ACKs. Unacknowledged data is retransmitted after a timeout
  3. Flow control uses the window size and congestion control uses slow start and congestion avoidance
  4. Connection close by FIN and ACK from each side
ClientServer1. SYN (seq = x)2. SYN + ACK (seq = y, ack = x+1)3. ACK (ack = y+1)ClientServer1. FIN2. ACK3. FIN4. ACK
(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.BytesSeq. no.ACK no.
110001 to 110001000111001
211001 to 120001100112001
312001 to 130001200113001
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)
Advantages over TCPDisadvantages compared with TCP
Faster, no handshake or waiting for ACKNo reliability: data can be lost or duplicated
Low overhead: 8-byte headerNo ordering: datagrams can arrive out of order
Good for real-time use: VoIP, video, gaming, DNSNo flow control or congestion control
Works with multicast and broadcastApplication must handle errors if it needs them
Simple, little memory per connectionLess secure and easier to misuse for flooding
Source Port (16)Destination Port (16)
Length (16)Checksum (16)
UDP header: Source port, Destination port, Length and Checksum, 16 bits each.
(b) Decode the UDP header 0045000D0058FE20
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.
FieldHexWorkingValue
Source port00454 × 16 + 569
Destination port000D13 (D = 13)13
Length of datagram00585 × 16 + 888 bytes
ChecksumFE20not asked65056
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