0% found this document useful (0 votes)
12 views11 pages

Past Papers

The document provides a detailed comparison between IPv4 and IPv6, highlighting their differences in address size, format, security, and routing. It also covers subnetting for a Class C network, explaining the number of networks, hosts, usable address ranges, and broadcast addresses. Additionally, it describes the three-way handshake in TCP connection establishment, UDP header analysis, and differentiates between circuit switching and packet switching, along with an overview of Address Resolution Protocol (ARP) and transmission impairments in computer networks.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views11 pages

Past Papers

The document provides a detailed comparison between IPv4 and IPv6, highlighting their differences in address size, format, security, and routing. It also covers subnetting for a Class C network, explaining the number of networks, hosts, usable address ranges, and broadcast addresses. Additionally, it describes the three-way handshake in TCP connection establishment, UDP header analysis, and differentiates between circuit switching and packet switching, along with an overview of Address Resolution Protocol (ARP) and transmission impairments in computer networks.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Computer networks

Que no 5

a) Differentiate between IPv4 and IPv6


IPv4 and IPv6 are two versions of the Internet Protocol (IP), with the primary difference being their address
size: IPv4 uses 32-bit addresses, while IPv6 uses 128-bit addresses, offering a significantly larger address space
and improved features.
Here's a more detailed comparison:
IPv4:
• Address Size: 32 bits, resulting in approximately 4.3 billion unique addresses.
• Address Format: Uses a dotted-decimal notation (e.g., 192.168.1.1).
• Address Classes: Uses distinct classes (A, B, C, etc.) for network addressing and subnetting.
• Security: Relies on optional security protocols like IPsec.
• Routing: IPv4 packets can be fragmented by routers, which can lead to performance issues and security
vulnerabilities.
• Address Resolution Protocol (ARP): IPv4 uses ARP to find the physical (MAC) address associated with
an IP address.
• Dynamic Host Configuration Protocol (DHCP): IPv4 uses DHCP to assign IP addresses to devices on a
network.
IPv6:
• Address Size: 128 bits, providing a vast address space of 3.4 x 10^38 unique addresses.
• Address Format: Uses a colon-separated hexadecimal notation (e.g.,
2001:0db8:85a3:0000:0000:8a2e:0370:7334).
• Address Classes: Does not use address classes.
• Security: IPsec is built-in and required for IPv6.
• Routing: IPv6 packets are designed to be routed without fragmentation by routers, improving efficiency
and security.
• Address Resolution: IPv6 uses Neighbor Discovery Protocol (NDP) and Internet Control Message
Protocol version 6 (ICMPv6) for address resolution and other network functions.
• Stateless Autoconfiguration: IPv6 allows devices to automatically configure their IP addresses without
the need for a DHCP server.
Que no 5
b) You have Subnetting Class C network 172.16.0.0 with a subnet mask of 255.255.255.192. Please list the
following:
1. Number of Networks 2. Number of Hosts per Network 3. Usable Address Ranges from the First Two
networks 4. Broadcast Addresses for the First Two Networks

Answer: Subnetting the Class C Network 172.16.0.0 with Subnet Mask 255.255.255.192
Given:
IP Address (Class C): 172.16.0.0 (Actually, this is Class B, but we will treat it like Class C for subnetting purposes)
Subnet Mask: 255.255.255.192
Step 1: Convert Subnet Mask
255.255.255.192 = /26 in CIDR
So, we're borrowing 2 bits from the host portion.
1) Number of networks:
With 2 borrowed bits:
Number of subnets = 2² = 4 subnets
2) Number of hosts per network:
Number of host bits = 6 (since /26 = 32 - 26 = 6)
Hosts per subnet = 2⁶ - 2 = 62 usable hosts
3) Usable address ranges from the first two networks:
Each subnet increment = 64 (because 256 - 192 = 64)
First subnet (0th):
Network Address: 172.16.0.0
First Usable: 172.16.0.1
Last Usable: 172.16.0.62
Broadcast: 172.16.0.63
Second subnet (1st):
Network Address: 172.16.0.64
First Usable: 172.16.0.65
Last Usable: 172.16.0.126
Broadcast: 172.16.0.127
4) Broadcast addresses for the first two networks:
First subnet: 172.16.0.63
Second subnet: 172.16.0.127
……………………………………………………………………………………………………………………………………………………………………..
Question no 4
a. Describe three-way handshake in TCP connection establishment. Also, TCP opens a connection for Computer
A using an initial sequence number (ISN) of 14,137. The other Computer B opens the connection with an ISN of
18,332. Show the three TCP Segments during the connection establishment.
Three -Way Handshake in TCP Connection Establishment
The three-way handshake is a process used by TCP (Transmission Control Protocol) to establish a reliable
connection between two devices (e.g., Computer A and Computer B). It ensures that both sides are ready to
communicate and synchronize their sequence numbers (ISN) before data transfer begins.
Steps in the Three-Way Handshake
1) SYN (Synchronize) – Computer A → Computer B
Computer A initiates the connection by sending a SYN segment with:
• SYN = 1 (flag set)
• Initial Sequence Number (ISN) = 14,137 (randomly chosen)
2) SYN-ACK (Synchronize-Acknowledge) – Computer B → Computer A
Computer B acknowledges Computer A's SYN and sends its own SYN with:
• SYN = 1, ACK = 1 (flags set)
• ISN = 18,332 (its own initial sequence number)
• Acknowledgment Number (Ack) = 14,138 (Computer A's ISN + 1)
3) ACK (Acknowledge) – Computer A → Computer B
Computer A acknowledges Computer B's SYN by sending:
• ACK = 1 (flag set)
• Sequence Number (Seq) = 14,138 (previous Ack)
• Acknowledgment Number (Ack) = 18,333 (Computer B's ISN + 1)
• Summary of the Three TCP Segments
Step Direction TCP Segment

1 Computer A → Computer B SYN=1, Seq=14137

2 Computer B → Computer A SYN=1, ACK=1, Seq=18332, Ack=14138

3 Computer A → Computer B ACK=1, Seq=14138, Ack=18333

• After this exchange, the TCP connection is fully established, and data transmission can begin reliably.

Key Points:
• SYN packets are used to initiate and synchronize sequence numbers.
• ACK packets confirm receipt and readiness for communication.
• The Acknowledgment Number is always the received sequence number + 1.
This ensures a reliable and error-checked connection before any actual data is transmitted.

Question no 4
a) The content of a UDP header in hexadecimal format C8B4000D001C001C then what is the total length
of the user datagram and what is the destination port number?

Analyzing the UDP Header in Hexadecimal

The given UDP header in hexadecimal is:


C8B4 000D 001C 001C

Step-by-Step Breakdown
The header is C8B4 000D 001C 001C, which we split into 2-byte (16-bit) fields:
1. Source Port (Bytes 0-1) → C8B4
2. Destination Port (Bytes 2-3) → 000D
3. Length (Bytes 4-5) → 001C
4. Checksum (Bytes 6-7) → 001C

1) Source Port (First 2 Bytes: C8B4)


• Hexadecimal: C8B4
• Decimal Conversion:
C×163+8×162+B×161+4×160C×163+8×162+B×161+4×160
o C (hex) = 12 (decimal)
o B (hex) = 11 (decimal)
o Calculation:
(12×4096)+(8×256)+(11×16)+(4×1)(12×4096)+(8×256)+(11×16)+(4×1)=49,152+2,048+176+4=51,380=49
,152+2,048+176+4=51,380
2. Destination Port Number
• Hexadecimal: 000D
• Decimal:
0×163+0×162+0×161+13×160=130×163+0×162+0×161+13×160=13
Destination Port = 13(used for daytime protocol)

3. Total Length of the UDP Datagram


• Hexadecimal: 001C
• Decimal:
0×163+0×162+1×161+12×160=16+12=280×163+0×162+1×161+12×160=16+12=28
• Total Length = 28 bytes (includes 8-byte header + 20-byte payload)

4. Checksum (Last 2 Bytes: 001C)


• Hexadecimal: 001C
• Used for error detection (optional in UDP).

Final Summary

Field Hex Value Decimal Value Meaning

Source Port C8B4 51,380 Sender’s port number

Destination Port 000D 13 Receiver’s port (Daytime Protocol)

Length 001C 28 bytes Total UDP datagram size

Checksum 001C - Error-checking value


Question no 2
a. Differentiate between packet switching and circuit switching
Definition
• Circuit Switching:
o Establishes a dedicated communication path (circuit) between sender and receiver before data
transfer.
o The entire bandwidth is reserved for the duration of the call.
o Example: Traditional telephone networks (PSTN).
• Packet Switching:
o Data is broken into small packets and sent independently over the network.
o No dedicated path is reserved; packets take different routes and are reassembled at the
destination.
o Example: The Internet (TCP/IP).
Feature Circuit Switching Packet Switching

Connection Dedicated physical path established before No dedicated path; packets take
Type communication. independent routes.

Bandwidth Dynamic bandwidth sharing (efficient


Fixed bandwidth reserved (even if unused).
Usage utilization).

Data Handling Entire data travels as a continuous stream. Data split into packets, sent separately.

Variable (depends on congestion &


Latency Low & consistent after setup.
routing).

Requires call setup (delay before data No setup needed (immediate


Setup Time
transfer). transmission).

More resilient (packets reroute if a link


Reliability Less fault-tolerant (fails if path breaks).
fails).

Highly efficient for bursty data (e.g.,


Efficiency Wastes bandwidth for intermittent traffic.
web browsing).

Cost Expensive (dedicated resources). Cost-effective (shared resources).

Highly scalable (supports multiple users


Scalability Limited (each connection needs a circuit).
dynamically).

Examples Traditional telephone networks (PSTN). Internet (TCP/IP, VoIP, emails).

Question no 2
b. briefly describe Address Resolution Protocol with diagram and its different cases

Address Resolution Protocol (ARP) is a network protocol used to map an IP address (logical address) to a
MAC address (physical address) in a local area network (LAN). It operates at the Link Layer of the OSI model
and is essential for enabling communication between devices on the same network.

How ARP Works – Basic Case


When a device wants to send data to another device on the same network, it needs to know the MAC
address of the destination. If it only knows the IP address, it uses ARP.
Steps:
1. Sender broadcasts an ARP Request:
"Who has IP 192.168.1.5? Tell 192.168.1.2."
2. The target device with IP 192.168.1.5 replies with its MAC address.
3. Sender updates its ARP table (cache) and sends the data.

Different Cases in ARP


1. Normal Case (Same Network):
ARP resolves IP to MAC and stores it in the ARP cache.
2. Gratuitous ARP:
A device sends an ARP request for its own IP to check for IP conflicts or update others' ARP tables.
3. Proxy ARP:
A router answers ARP requests on behalf of another device in a different network, making it seem like it's
local.
4. Inverse ARP (InARP):
Used to find the IP address corresponding to a known MAC address (used in Frame Relay networks).
5. ARP Spoofing (Security Issue):
An attacker sends fake ARP messages to associate their MAC with another IP, allowing them to intercept
traffic.

Question no 3

How traffic flow control , error control and congestion control are handled over transport layer, explain with
examples

1. Traffic Flow Control

Purpose:
To prevent the sender from overwhelming the receiver with too much data at once.
How it works:
The sender adjusts its sending rate based on the receiver's ability to process the data.
Example (TCP - Sliding Window Protocol):
• The receiver advertises a window size (e.g., 5 segments).
• The sender can only send 5 segments without waiting for an acknowledgment.
• If the receiver gets busy, it might reduce the window size to 2 or 0, signaling the sender to slow down or
pause.
2. Error Control

Purpose:
To ensure reliable delivery of data by detecting and retransmitting lost or corrupted segments.
How it works:
• Uses checksums to detect errors in each segment.
• Acknowledgments (ACKs) are used to confirm receipt.
• Retransmission occurs if an acknowledgment is not received in time (due to packet loss or corruption).
Example (TCP):
• Sender sends 5 packets.
• Receiver gets packets 1, 2, 4, 5 (packet 3 is lost).
• Receiver sends an ACK for packet 2 and maybe duplicate ACKs for packet 2.
• Sender uses timeout or duplicate ACKs (Fast Retransmit) to detect loss and retransmits packet 3.

3. Congestion Control

Purpose:
To prevent network congestion by controlling the amount of data entering the network.
How it works:
TCP uses algorithms like:
• Slow Start
• Congestion Avoidance
• Fast Retransmit
• Fast Recovery
Example (TCP - Slow Start & Congestion Avoidance):
• Initially, the sender starts with a small congestion window (e.g., 1 segment).
• With each ACK, the window size doubles (exponential growth).
• When a threshold is hit or loss is detected, growth becomes linear or is reduced (to avoid congestion).

Summary Table
o Control Type o Goal o Mechanism o Example (TCP)

o Prevent receiver o Sliding window (receiver o Receiver limits data it can


o Flow Control handle
overload window)

o Ensure reliable o ACKs, checksums, o Resend lost/corrupted packets


o Error Control
data retransmission

o Congestion o Prevent network o Congestion window, slow o Reduce sending rate on


Control overload start, etc. congestion signs

Question no 2
What are Transmission Impairments in computer networks. briefly describe each one
Answer:
In computer networks, transmission impairments refer to issues that can distort or degrade the quality
of signals as they travel through a communication medium. There are three main types of transmission
impairments:

1. Attenuation
• Definition: Loss of signal strength as it travels through the medium.
• Cause: Natural resistance in cables or wireless path over distance.
• Effect: The signal becomes weaker and harder to detect.
• Solution: Use amplifiers or repeaters to boost the signal at intervals.

2. Noise
• Definition: Unwanted electrical signals that interfere with the original data signal.
• Types:
o Thermal Noise – Caused by random motion of electrons.
o Induced Noise – From other devices (e.g., motors, fluorescent lights).
o Crosstalk – Interference from adjacent wires.
o Impulse Noise – Spikes caused by external factors (e.g., lightning).
• Effect: Causes errors in data reception.
• Solution: Shielded cables, proper grounding, and error detection techniques.

3. Distortion
• Definition: Signal changes its shape or form as it travels.
• Cause: Different signal components (frequencies) travel at different speeds.
• Effect: Data becomes misaligned or unreadable at the destination.
• Solution: Use equalizers and proper synchronization.
…………………………………………………………………………………………………………………………………………
Question no 3
Define TCP or IP header in detail

IP Header (Internet Protocol Header)

• Used in network layer (Layer 3) for routing packets across networks.


Structure of IPv4 Header (20–60 bytes)

Field Size Description


Version 4 bits IP version (usually 4 for IPv4)
Header Length 4 bits Length of the header (in 32-bit words)
Type of Service (ToS) 8 bits Priority of the packet
Total Length 16 bits Total size of the packet (header + data)
Identification 16 bits Unique ID for fragmentation/reassembly
Flags 3 bits Control flags for fragmentation
Fragment Offset 13 bits Position of this fragment in the original packet
Time to Live (TTL) 8 bits Packet's life span (hops)
Protocol 8 bits Type of payload (e.g., 6 for TCP, 17 for UDP)
Field Size Description
Header Checksum 16 bits Error checking for header
Source IP Address 32 bits Sender’s IP address
Destination IP Address 32 bits Receiver’s IP address
Options (optional) Variable Used for special purposes (rarely used)
Padding Variable Ensures header ends on 32-bit boundary

TCP Header (Transmission Control Protocol Header)

• Used in transport layer (Layer 4) for reliable connection-oriented communication.


Structure of TCP Header (20–60 bytes)

Field Size Description


Source Port 16 bits Sender’s port number
Destination Port 16 bits Receiver’s port number
Sequence Number 32 bits Tracks packet order
Acknowledgment Number 32 bits Confirms receipt of data
Data Offset 4 bits Header size (in 32-bit words)
Reserved 3 bits Reserved for future use
Flags (Control bits) 9 bits Includes SYN, ACK, FIN, etc.
Window Size 16 bits Amount of data that can be accepted
Checksum 16 bits Error checking for header and data
Urgent Pointer 16 bits Indicates urgent data (if URG flag is set)
Options (optional) Variable E.g., Maximum Segment Size (MSS)
Padding Variable To align header to 32-bit boundary

Example of TCP Flags:


• SYN: Start a connection
• ACK: Acknowledgment
• FIN: Finish connection
• RST: Reset connection
• PSH: Push data immediately
• URG: Urgent data
Question no 4:

what is IPv4 addressing Briefly differentiate classful and classless addressing .

What is IPv4 Addressing?


IPv4 (Internet Protocol version 4) addressing is a method used to identify devices on a network. Each device gets a unique 32-bit
address, usually written in dotted decimal format, like:

192.168.1.1
Each IPv4 address has two parts:
• Network part: Identifies the network.
• Host part: Identifies the specific device on that network.

Classful Addressing (Old Method)


IPv4 addresses were divided into fixed classes:

Class Starting Bits Range Default Subnet Mask Use

A 0xxx 1.0.0.0 to 126.255.255.255 255.0.0.0 Large networks

B 10xx 128.0.0.0 to 191.255.255.255 255.255.0.0 Medium networks

C 110x 192.0.0.0 to 223.255.255.255 255.255.255.0 Small networks

D 1110 224.0.0.0 to 239.255.255.255 – Multicasting

E 1111 240.0.0.0 to 255.255.255.255 – Reserved

Problem with Classful:


• Wasted IPs (e.g., a Class A gives millions of addresses even if you don’t need them).
• Not flexible for custom network sizes.

Classless Addressing (Modern Method)


Also called CIDR (Classless Inter-Domain Routing).
• Doesn’t use fixed classes.
• Uses prefix notation like: 192.168.1.0/24
o Here, /24 means the first 24 bits are the network part.
• Allows more efficient use of IP addresses.

Benefits:
• No waste of IPs.
• Flexible subnetting.
• Better routing performance.

You might also like