0% found this document useful (0 votes)
25 views7 pages

Final Term Paper CN SP 2025 Solution

The document outlines the final-term exam for the Computer Networks course at Lahore Garrison University, detailing the structure and types of questions, including short and long questions on IP addressing, Dijkstra's algorithm, packet fragmentation, and security attacks. It includes specific questions on public vs. private IP addresses, the role of TTL and IHL in IPv4 packets, and countermeasures against various network security threats. The exam is designed to assess students' understanding of key networking concepts and their practical applications.
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)
25 views7 pages

Final Term Paper CN SP 2025 Solution

The document outlines the final-term exam for the Computer Networks course at Lahore Garrison University, detailing the structure and types of questions, including short and long questions on IP addressing, Dijkstra's algorithm, packet fragmentation, and security attacks. It includes specific questions on public vs. private IP addresses, the role of TTL and IHL in IPv4 packets, and countermeasures against various network security threats. The exam is designed to assess students' understanding of key networking concepts and their practical applications.
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/ 7

Lahore Garrison University

Final-Term Exam (Spring 2025)


Department of Computer Sciences

Solution

Instructor Name: Mumtaz Ahmad, Aisha Riaz, Nazish Umer. Program/Semester: 6th
Course Code: CSC343 Course Title: Computer Networks
Time Allowed: 120 Minutes Max Marks: 40
SUBJECTIVE TYPE

Q#1: Short Questions. [10]


PLO CLO Learning
i. Find the class of the following classful IP addresses: [2] Level/LL

a. 11101111 11110011 10000111 11011101 [D] 2 3 C-2


b. 11011111 10110000 00011111 01011101 [C]

ii. Evaluate the CIDR value: [2]

a. 255.224.0.0 /11
b. 255.255.240.0 /20

iii. Calculate the number of usable hosts in a subnet with mask 255.255.255.224? [30] [2]

iv. What is the first and last valid host of 4th subnet of the network 192.168.200.62 255.255.255.240? [2]

v. You need to subnet the 192.168.4.0 network into 7 different subnets. What subnet mask would you use? [2]
255.255.255.224
Long Questions.
Q#2: (i) Differentiate between Public IP address and Private IP address. Also write down the PLO CLO Learning
Level/LL
ranges of Private IP addresses. [4]
3 2 C-2

Feature Public IP Address Private IP Address


Definition An IP address assigned by the ISP to identify a An IP address used within a private network (LAN) not
device on the internet. visible on the internet.
Scope Global – accessible over the internet Local – used only within a private network
Uniqueness Must be unique across the entire internet Can be reused in different private networks
Assigned by Internet Service Provider (ISP) Set manually or assigned by DHCP within LAN
Accessibility Can be accessed directly from outside the network Not directly accessible from the internet
Security Less secure – exposed to threats from the internet More secure – behind routers/firewalls
Example Hosting websites, email servers Home routers, printers, internal devices
Use
Class IP Range CIDR Notation
A 10.0.0.0 – 10.255.255.255 10.0.0.0/8
B 172.16.0.0 – 172.31.255.255 172.16.0.0/12
C 192.168.0.0 – 192.168.255.255 192.168.0.0/16

Page 1 of 7
(ii) : Find Shortest Path between All the Vertices using Dijkstra Algorithm. [6]

PLO CLO Learning


Level/LL

3 3 C-2

Source → PTO

Node A B C D E F
A→A 0 ∞ ∞ ∞ ∞ ∞
A→ B 4 ∞ ∞ ∞ ∞
A→ C 5 ∞ ∞ ∞
B→D 13 ∞ ∞
C→E 8 ∞
E→ F 14

Node Distance Path


A 0 A
B 4 A→B
C 5 A→C
D 13 A→B→D
E 8 A→C→E
F 14 A→C→E
→F
Q#3: [6] PLO CLO Learning
Level/LL
(i) A datagram of 2000 bytes (including 20 bytes of IP header and 1980 bytes of IP
payload) arrives at a router. The router needs to forward it to a link with an MTU of 600
3 2 C-2
bytes.How many fragments will be generated? Find the value of MF, DF, Offset, and total length for each
fragment.
Given:
• Original Datagram Size: 2000 bytes
• IP Header: 20 bytes
• Payload: 1980 bytes
• MTU (Maximum Transmission Unit): 600 bytes
• Each fragment must:
• Include its own 20-byte IP header
• The payload per fragment ≤ MTU - 20 = 580 bytes
• The payload must be a multiple of 8 bytes, except possibly for the last fragment
• Max payload per fragment = 600 - 20 = 580 bytes
• Closest multiple of 8 ≤ 580 = 576 bytes
• 4 fragments will be created

Page 2 of 7
Fragment Offset MF DF Total Length
1 0 1 0 596
2 72 1 0 596
3 144 1 0 596
PLO CLO Learning
4 216 0 0 272 Level/LL

2 3 C-2
(ii): What is the role of the TTL and IHL fields in an IPv4 packet? [4]
TTL: The size of this field is 8 bits. This field is used to discard the undeliverable packets. The original specification
defines this field as a time counter. it defines the lifetime of the datagram. The sender initiated the TTL value
(32, 64, or 255 based on Operating Systems) in the IP header and it is then decremented by one at every hop it
crosses. When it reaches 0 the datagram is discarded and an ICMP message is sent back to the sender.
This prevents routing loops at Layer 3 of the OSI layer model.

IHL: The size of this field is 4 bits. This field indicates the length of the IPv4 header. Not all IPv4 headers are
equal in length. The length of the header depends on how many options are added. An option tells intermediate
devices how packets should be forwarded or processed. Most IPv4 options are optional. Depending on the
specific requirement, nodes can add options. The minimum value for this field is 5 and the maximum is 15.

Q#4:
(i) Briefly Describe how can we defeat the following security attacks? [6]
a. Packet Sniffing
PLO CLO Learning
b. Packet Modification Level/LL

c. IP Spoofing
2 3 C-2

a. Packet Sniffing Definition:


Packet sniffing is the unauthorized capture of data packets traveling over a network.
Countermeasures:
Use Encryption: Encrypt network traffic using protocols like HTTPS, SSL/TLS, or VPN to make data unreadable to
sniffers.
Secure Wi-Fi: Enable WPA3/WPA2 encryption on wireless networks.
Use Switches, not Hubs: Switches send data only to intended recipients, limiting sniffing opportunities.
Network Monitoring: Detect sniffing tools using intrusion detection systems (IDS).
b. Packet Modification Definition:
Packet modification involves altering the contents of packets during transit.
Countermeasures:
Use Integrity Checks: Use protocols like IPsec, TLS, or HMAC to verify that packets haven’t been altered.
End-to-End Encryption: Prevents attackers from modifying data without detection.
Authentication Mechanisms: Ensure that packets come from verified sources using digital signatures.

Page 3 of 7
c. IP Spoofing Definition: IP spoofing is the act of sending packets with a forged source IP address to impersonate another
system.
Countermeasures:
Ingress and Egress Filtering: Configure routers to block packets with invalid or spoofed IP addresses.
Use IPsec: Authenticates and encrypts IP packets, preventing spoofing.
Enable Authentication: Require strong authentication at the application level to validate user identity.
Monitor Logs: Use IDS/IPS to detect suspicious IP behavior or anomalies.

Page 4 of 7
Page 5 of 7
(ii): Differentiate between TCP and UDP? [4]

Page 6 of 7
Page 7 of 7

You might also like