COMPUTER NETWORK
COMPUTER NETWORK
Explanation of Layers
1. Physical Layer
o Deals with physical connections (cables, switches, etc.).
o Transmits raw binary data (0s and 1s).
o Example: Ethernet cables, hubs.
2. Data Link Layer
o Ensures error-free data transfer between adjacent nodes.
o Divided into MAC (Media Access Control) and LLC (Logical Link Control)
sublayers.
o Example: Switches, Ethernet protocols.
3. Network Layer
o Handles routing and logical addressing (IP addresses).
o Determines the path data takes across the network.
o Example: Routers, IP protocol.
4. Transport Layer
o Ensures reliable data transfer and error recovery.
o Manages end-to-end communication between devices.
o Example: TCP (Transmission Control Protocol), UDP.
5. Session Layer
o Manages sessions or connections between applications.
o Keeps data from different sessions separate.
o Example: APIs, NetBIOS.
6. Presentation Layer
o Translates data between application and network formats.
o Handles encryption, compression, and data formatting.
o Example: SSL/TLS protocols.
7. Application Layer
o Provides services directly to end-users and applications.
o Examples: HTTP, FTP, DNS, email protocols (SMTP).
Key Points:
The OSI model helps standardize communication.
Each layer performs a specific task and communicates with adjacent layers.
It provides a logical structure for understanding networking.
2. Explain different error detection and correction mechanisms used in data communication.
b) Checksum
Data is divided into segments, and the sum of all segments is calculated.
The sum is then complemented (1's complement) and sent with the data.
The receiver adds all segments, including the checksum, and checks for errors.
Example:
Segments: 1010, 1100
Sum: 1010 + 1100 = 10110
Checksum: Complement of 0110 → 1001
Summary of Methods
3. Explain a congestion control algorithm.
Network Topology
Network topology refers to the physical or logical arrangement of nodes (computers, devices, etc.) in a
network. It defines how devices are connected and communicate with one another.
1. Bus Topology
All devices are connected to a single central cable (backbone).
Data travels in both directions on the shared bus.
Advantages:
Simple and inexpensive to set up.
Requires less cable compared to other topologies.
Suitable for small networks.
Disadvantages:
A single cable failure disrupts the entire network.
Performance degrades with an increase in nodes.
Difficult to troubleshoot.
2. Star Topology
All devices are connected to a central hub or switch.
Data passes through the central device to reach its destination.
Advantages:
Easy to install, manage, and troubleshoot.
Failure of one node does not affect others.
Centralized control makes it efficient.
Disadvantages:
If the central hub fails, the entire network fails.
Requires more cables compared to bus topology.
Expensive due to the central hub/switch.
3. Ring Topology
Devices are connected in a closed loop, where data travels in one direction (unidirectional) or
both directions (bidirectional).
Advantages:
Simple to install and manage.
Data flows in an orderly manner, reducing collisions.
Equal access for all devices.
Disadvantages:
A single node failure can disrupt the entire network.
Adding or removing devices requires reconfiguration.
Troubleshooting is difficult.
4. Mesh Topology
Every device is directly connected to every other device in the network.
Can be fully connected (every device to every other) or partially connected.
Advantages:
Highly reliable (redundant connections ensure no single point of failure).
Data can take multiple paths to reach its destination.
Suitable for critical networks like military and financial systems.
Disadvantages:
Very expensive due to high cabling and setup costs.
Complex installation and management.
Scalability is challenging.
5. Tree Topology
A combination of bus and star topologies. Devices are connected in a hierarchical structure
with a central hub acting as a root.
Advantages:
Scalable and easy to expand.
Hierarchical control makes management efficient.
Faults in one branch do not affect others.
Disadvantages:
Expensive due to extensive cabling and central hubs.
If the root node fails, the entire network fails.
Maintenance can be complex.
6. Hybrid Topology
Combines two or more types of topologies (e.g., star-ring, star-bus, etc.).
Advantages:
Highly flexible and scalable.
Can be customized to suit specific needs.
More reliable than individual topologies.
Disadvantages:
Complex to design and manage.
Expensive due to a mix of different components and connections.
7. Point to Point Topology
Point-to-point topology is a type of topology that works on the functionality of the sender and
receiver. It is the simplest communication between two nodes, in which one is the sender and the other
one is the receiver. Point-to-Point provides high bandwidth.
3. Channelization Protocols
These protocols divide the channel into smaller, separate parts to allow simultaneous transmissions.
a) Frequency Division Multiple Access (FDMA):
o The available bandwidth is divided into frequency bands, and each device gets a specific
frequency.
o Used in analog systems.
b) Time Division Multiple Access (TDMA):
o Time is divided into slots, and each device transmits during its assigned time slot.
o Used in digital cellular networks.
c) Code Division Multiple Access (CDMA):
o All devices transmit simultaneously using unique codes.
o Used in mobile communications (e.g., 3G networks).
Advantage: Efficient use of bandwidth.
Disadvantage: Complex to implement.
6. Describe fragmentation. How does the network layer handle fragmentation and reassembly of data
packets during transmission?
Fragmentation in Networking
Fragmentation is the process of breaking a large data packet into smaller pieces to accommodate the
Maximum Transmission Unit (MTU) size of a network. Different networks may have different MTU
sizes, so a large packet that exceeds the MTU must be fragmented to travel across these networks.
The network layer in the OSI model handles fragmentation.
Reassembly of Fragments
At the destination, the network layer reassembles the fragments back into the original packet.
1. The fragments are identified using the Identification field in the IP header.
2. Using the Fragment Offset, the receiver arranges the fragments in the correct order.
3. The packet is fully reassembled when:
o All fragments arrive, and
o The fragment with MF = 0 (last fragment) is received.
4. If any fragment is missing, the entire packet is discarded.
Advantages of Fragmentation
Allows data to travel across networks with different MTUs.
Ensures compatibility between heterogeneous networks.
Disadvantages of Fragmentation
Reassembly requires extra processing at the destination.
If a single fragment is lost, the entire packet must be retransmitted.
Increases overhead due to additional headers.
Conclusion
The network layer handles fragmentation by dividing large packets into smaller fragments and
appending necessary information in the IP header. The receiver reassembles the fragments using the
Identification, Fragment Offset, and MF fields.
Let me know if you'd like further clarification or an example!
7. What is Internet Protocol (IP)? State and describe various classes used for IP addressing.
Internet Protocol (IP)
Internet Protocol (IP) is a fundamental protocol in the network layer of the OSI and TCP/IP models.
It is responsible for delivering data packets from the source to the destination across interconnected
networks. IP enables communication by assigning a unique identifier, called an IP address, to each
device on the network.
Key Features of IP
1. Connectionless Protocol: IP does not establish a dedicated connection before transmitting data.
2. Best-Effort Delivery: IP does not guarantee packet delivery, order, or error recovery.
3. Logical Addressing: Each device on the network has a unique IP address.
4. Routing: IP supports packet forwarding using routers to reach the destination.
IP Addressing
An IP address is a unique 32-bit number (IPv4) or 128-bit number (IPv6) assigned to each device on a
network.
IPv4 addresses are divided into five classes (A, B, C, D, E).
An IPv4 address is written in dotted-decimal format (e.g., 192.168.1.1).
IP Address Classes
IPv4 addresses are divided into 5 classes based on the first octet (the first 8 bits of the address). These
are Class A, B, C, D, and E.
1. Class A
Range: 1.0.0.0 to 126.255.255.255
First Octet: 1 - 126
Network/Host Division:
o Network ID: First 8 bits.
o Host ID: Remaining 24 bits.
Default Subnet Mask: 255.0.0.0
Purpose: Designed for very large networks, such as multinational companies or ISPs.
Example: 10.0.0.1
2. Class B
Range: 128.0.0.0 to 191.255.255.255
First Octet: 128 - 191
Network/Host Division:
o Network ID: First 16 bits.
o Host ID: Remaining 16 bits.
Default Subnet Mask: 255.255.0.0
Purpose: Suitable for medium-sized networks like universities or large businesses.
Example: 172.16.0.1
3. Class C
Range: 192.0.0.0 to 223.255.255.255
First Octet: 192 - 223
Network/Host Division:
o Network ID: First 24 bits.
o Host ID: Remaining 8 bits.
Default Subnet Mask: 255.255.255.0
Purpose: Ideal for small networks like private businesses or local area networks (LANs).
Example: 192.168.1.1
4. Class D
Range: 224.0.0.0 to 239.255.255.255
Purpose: Reserved for multicasting (sending data to multiple devices simultaneously).
Class D addresses do not have a subnet mask.
Example: 224.0.0.1
5. Class E
Range: 240.0.0.0 to 255.255.255.255
Purpose: Reserved for experimental and research purposes.
Not used for general communication.
Goals of QoS
1. Minimize Delay (Latency): Reduce the time taken for data packets to travel from source to
destination.
2. Minimize Jitter: Ensure consistent packet arrival time to prevent delays in real-time
applications.
3. Minimize Packet Loss: Reduce dropped packets to ensure reliable data transmission.
4. Maximize Bandwidth Utilization: Efficiently manage network resources to meet the needs of
different applications.
Techniques to Improve QoS
1. Classification and Marking
o Purpose: Classify data packets into categories based on their priority and mark them for
proper handling.
o How: Use packet headers (e.g., Type of Service (ToS) in IP) to mark priority levels.
o Example: Differentiating voice, video, and background traffic.
2. Scheduling Techniques
Scheduling determines the order in which packets are transmitted based on their priority.
o a) First Come First Serve (FCFS):
Packets are transmitted in the order they arrive.
Drawback: No priority handling.
o b) Priority Queuing (PQ):
Packets are classified into priority levels. High-priority packets are transmitted
first.
Use Case: Real-time traffic like VoIP and video conferencing.
o c) Weighted Fair Queuing (WFQ):
Assigns weights to different queues based on priority and bandwidth needs.
Ensures fair sharing of bandwidth.
3. Traffic Shaping and Policing
o Traffic Shaping:
Controls outgoing traffic to smooth traffic flow and prevent bursts.
Limits bandwidth usage to avoid congestion.
Technique: Token Bucket Algorithm.
o Traffic Policing:
Monitors incoming traffic and drops or marks packets that exceed the bandwidth
limit.
4. Resource Reservation
o Reserve resources (e.g., bandwidth) for specific applications to meet their QoS
requirements.
o Protocol: RSVP (Resource Reservation Protocol) allows reservation of network
resources.
5. Congestion Management
o Techniques to prevent or reduce network congestion:
Buffer Management: Allocating buffer space for high-priority packets.
RED (Random Early Detection): Drops packets probabilistically before
congestion occurs.
6. Compression
o Reduces the size of data packets to minimize bandwidth usage.
o Example: Using compression techniques for VoIP data to improve transmission
efficiency.
7. Link Efficiency Techniques
o Fragmentation and Interleaving: Break large packets into smaller fragments to prevent
delays in real-time traffic.
o Example: Used in networks carrying both voice and data traffic.
10. Write short notes on ( i) Domain Name System ( ii) Hyper Text Transfer Protocol (iii) World Wide Web
(iv)TELNET (v) FTP
(iv) TELNET
Definition: TELNET (TELecommunication NETwork) is an application layer protocol used
for remote access to another computer or server over a network.
Purpose: Allows users to log in to a remote system and execute commands as if they were
physically present at the machine.
Working: TELNET uses port 23 and establishes a text-based connection.
Features:
o Provides a command-line interface.
o Unsecured protocol; data (including passwords) is transmitted in plain text.
Use Case: Managing servers remotely before the advent of secure protocols like SSH.
Example: Connecting to a server using the command telnet example.com.
1. Go-Back-N ARQ
Go-Back-N ARQ is a stop-and-wait protocol variant in which the sender can send multiple frames (up
to a window size NNN) without waiting for an acknowledgment (ACK) for each one. However, if an
error is detected in any frame, the sender goes back and retransmits all frames from that point onward.
How Go-Back-N Works:
Sender Side:
o The sender maintains a window of size NNN, where NNN is the maximum number of
unacknowledged packets it can send before waiting for ACKs.
o The sender keeps sending packets sequentially and waits for an acknowledgment.
o If the sender does not receive an acknowledgment for a specific frame within a timeout
period, it will retransmit all frames starting from the unacknowledged frame.
Receiver Side:
o The receiver is simple and only expects the next frame in sequence. If a frame is received
out of order, it will discard it.
o The receiver sends an acknowledgment for the last correctly received frame.
Example:
Assume the window size is 4 (i.e., N=4N = 4N=4).
The sender sends frames 1, 2, 3, and 4.
If the receiver successfully receives frames 1, 2, and 3 but there is an error in frame 4, the
receiver will discard frame 4 and acknowledge frame 3.
The sender will go back and retransmit frames 4, 5, 6, and so on (not just the erroneous frame
4).
Advantages of Go-Back-N:
Simpler to implement compared to other protocols.
Effective when packet loss or errors are rare.
Disadvantages of Go-Back-N:
Inefficient in networks with high packet loss or errors, as it retransmits all frames after an error,
even if many frames were transmitted successfully.
12. What do you mean error handling at data link layer? Discuss hamming code with suitable
example.
Hamming Code:
The Hamming Code is an error-correcting code developed by Richard Hamming. It can detect and
correct single-bit errors in data transmission. Hamming Code adds parity bits to the original data in
such a way that errors can be identified and corrected by the receiver.
How Hamming Code Works:
The number of parity bits required depends on the length of the data to be transmitted. The
relationship is given by:
2r≥m+r+12^r \geq m + r + 12r≥m+r+1
Where:
o rrr is the number of parity bits.
o mmm is the number of data bits.
The parity bits are inserted at positions that are powers of 2 (1, 2, 4, 8, etc.). These bits help in
determining whether an error occurred in any of the data bits.
Steps for Encoding Using Hamming Code:
1. Determine the Number of Parity Bits:
Calculate the number of parity bits rrr needed for a given number of data bits mmm using the
formula.
2. Place Parity Bits in the Correct Positions:
The parity bits are placed in positions 1,2,4,8,…1, 2, 4, 8, \dots1,2,4,8,… (powers of 2). These
positions will be filled with 0 initially, and later, the values will be calculated.
3. Calculate the Parity Bits:
Each parity bit checks certain bits in the data and calculates its value to ensure the total number
of 1's in those bits is even (even parity). If the number of 1's is odd, the parity bit is set to 1 to
make it even. If the count is already even, the parity bit remains 0.
4. Send the Data:
The encoded data (data bits + parity bits) is transmitted to the receiver.
Where P1, P2, and P3 are the parity bits, and D1, D2, D3, and D4 are the data bits.
13. Discuss IPv4 packet format with suitable diagram the at network layer.
14. Differentiate between Open Loop and Closed Loop Congestion Control at transport layer
Open Loop vs. Closed Loop Congestion Control at the Transport Layer
Congestion control at the transport layer is essential to manage the flow of data across the network to
prevent network congestion, ensuring efficient data transfer between source and destination. The two
primary strategies for congestion control are Open Loop and Closed Loop mechanisms.
Here's a comparison between the two:
2. Transport Layer
Role: The Transport layer is responsible for providing end-to-end communication and ensuring
reliable data transfer between two hosts.
Duties:
o Segmentation and Reassembly: It divides large application data into smaller chunks
(segments) for transmission and reassembles them at the receiving end.
o Reliability: Ensures reliable data delivery by detecting errors, retransmitting lost or
corrupted data, and managing data flow. This is typically handled by protocols like TCP
(Transmission Control Protocol).
o Flow Control: Manages the rate at which data is sent to avoid overwhelming the
receiving host (e.g., windowing in TCP).
o Error Detection and Correction: Uses checksums and acknowledgments to ensure that
data is received correctly.
o Multiplexing: Allows multiple applications to use the same network connection by using
port numbers to distinguish between different processes (e.g., ports 80 and 443 for web
traffic).
Examples:
o TCP: A connection-oriented protocol that ensures reliable, in-order delivery of data.
o UDP (User Datagram Protocol): A connectionless protocol that provides faster, but less
reliable, communication.
3. Internet Layer
Role: The Internet layer is responsible for routing data packets across different networks, from
the source to the destination, ensuring that they reach the correct destination regardless of the
underlying physical network infrastructure.
Duties:
o Routing: Routes data packets across multiple networks by determining the best path for
delivery (using IP addresses).
o Addressing: Assigns unique logical addresses (IP addresses) to devices for identification
and communication.
o Packet Forwarding: Responsible for forwarding data packets to the correct destination
based on IP addresses.
o Fragmentation and Reassembly: In case data packets are too large for transmission
over certain network links, this layer divides them into smaller fragments and
reassembles them at the receiving end.
Examples:
o IP (Internet Protocol) for addressing and routing data.
o ICMP (Internet Control Message Protocol) for diagnostic and error messages, like ping
and traceroute.
o ARP (Address Resolution Protocol) for mapping IP addresses to MAC addresses.
IP Addressing Method
IP addresses are assigned and used in two primary versions: IPv4 and IPv6. Both versions use different
formats and structures for addressing, but they serve the same purpose of identifying devices on a
network.
1. IPv4 Addressing (Internet Protocol Version 4)
IPv4 is the most widely used version of IP addresses. It uses a 32-bit address to represent an IP
address, which provides a total of 4.3 billion unique addresses (2^32).
Format: An IPv4 address is written in dotted decimal notation, consisting of four 8-bit octets
separated by periods (dots). Each octet is a number between 0 and 255.
Example: 192.168.1.1
This address consists of four parts:
o 192 (1st octet)
o 168 (2nd octet)
o 1 (3rd octet)
o 1 (4th octet)
Subnet Mask: A subnet mask is used to specify which portion of the IP address represents the
network and which part represents the host. For example, a common subnet mask is
255.255.255.0, which means the first three octets (192.168.1) identify the network, and the last
octet (1) identifies the specific device (host) on that network.
IPv4 Address Types:
IPv4 addresses are classified into several types based on the purpose of the address:
Unicast: Refers to communication between a single sender and a single receiver.
Broadcast: Refers to communication sent to all devices on a network.
Multicast: Refers to communication sent to a group of devices on a network.
2. IPv6 Addressing (Internet Protocol Version 6)
IPv6 was introduced to address the limitations of IPv4, especially the shortage of available addresses.
IPv6 uses a 128-bit address, providing an incredibly large number of unique addresses—about 340
undecillion (3.4 × 10^38) addresses.
Format: An IPv6 address is written in colon-separated hexadecimal format (eight groups of
four hexadecimal digits).
Example: 2001:0db8:85a3:0000:0000:8a2e:0370:7334
IPv6 uses hexadecimal numbers (base-16) rather than decimal, and each group consists of four
hexadecimal digits, separated by colons.
Compressed Format: Leading zeros in any of the eight groups can be omitted, and consecutive
groups of zeros can be replaced by ::. For example:
2001:0db8:85a3::8a2e:0370:7334 is a compressed version of the above address.
IPv6 Address Types:
o Unicast: One-to-one communication.
o Multicast: One-to-many communication.
o Anycast: One-to-nearest (to the closest device among a group of devices).
Key Differences Between IPv4 and IPv6:
Feature IPv4 IPv6
Total Number of
4.3 billion (2^32) 340 undecillion (2^128)
Addresses
IP Addressing Methods
IP addresses are assigned using various methods, depending on how the network is configured and
managed:
1. Static IP Addressing
Definition: A static IP address is manually configured for a device and does not change over
time.
Use Case: Static IP addressing is useful for servers, printers, or other devices that need a fixed IP
to be easily reachable on the network.
Example: A server may be assigned the IP 192.168.1.100 to always be accessible by users.
2. Dynamic IP Addressing
Definition: In dynamic IP addressing, IP addresses are assigned automatically by a Dynamic
Host Configuration Protocol (DHCP) server from a pool of available addresses. The address
may change over time.
Use Case: Dynamic IP addressing is typically used for end-user devices like laptops,
smartphones, and workstations, as they don't need a fixed address.
Example: A device might be assigned an IP address from the range 192.168.1.1 to 192.168.1.50, and
the address can change each time the device connects to the network.
3. Public and Private IP Addresses
Public IP Address: A public IP address is globally unique and is used to identify a device on the
public internet. It is assigned by an Internet Service Provider (ISP).
Example: 8.8.8.8 (Google's public DNS server).
Private IP Address: Private IP addresses are used within local networks and are not routable on
the public internet. These addresses are reserved for private use, and organizations can use them
internally without concern for conflicts on the internet.
Private IPv4 Address Ranges:
o 10.0.0.0 to 10.255.255.255
o 172.16.0.0 to 172.31.255.255
o 192.168.0.0 to 192.168.255.255
Example: A device in a home network might have the private IP 192.168.0.10.
20. What is significance of cryptography? Compare between public-key and private key
cryptography.
Significance of Cryptography
Cryptography is a critical field in information security that involves techniques for securing
communication and data from unauthorized access or tampering. The main purposes of cryptography
are:
1. Confidentiality: Ensures that the data remains private and is only accessible to the intended
recipient.
2. Integrity: Ensures that the data has not been altered or corrupted during transmission.
3. Authentication: Verifies the identity of the sender and the receiver.
4. Non-repudiation: Ensures that neither party can deny the transmission of the message.
5. Access Control: Limits access to data or systems based on permissions.
Cryptography is widely used in various applications such as secure communication, online transactions,
digital signatures, and more.
Conclusion
Public-Key Cryptography is more secure for key exchange and authentication, but it's slower.
It uses two keys: one public and one private.
Private-Key Cryptography is faster and more efficient for encrypting data but requires secure
key distribution. It uses a single shared key for both encryption and decryption.
Both types of cryptography have their specific uses depending on the need for speed, security, and key
management.