CNND Ai 2 Ans PDF
CNND Ai 2 Ans PDF
ChatGPT said:
The Transport Layer (Layer 4 of the OSI model) is responsible for ensuring reliable
end-to-end communication between devices on a network. It provides services like
error detection, flow control, and data segmentation.
Flow Control: Regulates the data flow between sender and receiver to prevent
congestion.
Error Detection and Correction: Ensures that the data is accurately transmitted by
detecting and correcting errors.
Reliable Data Transfer: Uses protocols like TCP to guarantee that data is delivered
correctly and in order.
Diagram
+--------------------+
| Application |
+--------------------+
|
+--------------------+
| Transport Layer |
| (TCP/UDP) |
+--------------------+
|
+--------------------+
| Network Layer |
+--------------------+
|
+--------------------+
| Data Link Layer |
+--------------------+
|
+--------------------+
| Physical Layer |
+--------------------+
The Transport Layer sits between the Application Layer (top) and the Network Layer
(bottom), handling the transport of data.
It uses TCP (Transmission Control Protocol) for reliable communication or UDP (User
Datagram Protocol) for faster, less reliable communication.
ANS ::
TCP Segment Format:
A TCP segment is the unit of data that is exchanged between two devices over a TCP
connection. The segment contains both header information and the data being sent.
The header consists of fields that control the segment's behavior, ensuring
reliable data transmission.
Sequence Number (32 bits): Specifies the sequence number of the first byte of data
in this segment.
Acknowledgment Number (32 bits): If the ACK flag is set, this field holds the value
of the next expected sequence number.
Data Offset (4 bits): The length of the TCP header (in 32-bit words).
Window Size (16 bits): Indicates the size of the sender's receive window for flow
control.
Checksum (16 bits): Used for error-checking of the header and data.
Urgent Pointer (16 bits): If the URG flag is set, points to the end of the urgent
data.
Options (Variable length): Optional fields like Maximum Segment Size (MSS), window
scaling, and timestamps.
The client sends a TCP segment with the SYN flag set, requesting to start a
connection.
The segment contains a sequence number (let's say Seq = X), which indicates the
first byte of data the client is going to send.
The SYN flag indicates that the server is willing to accept the connection, and the
ACK flag confirms receipt of the client's SYN segment.
The server sends back its own sequence number (Seq = Y) and acknowledges the
client's sequence number (Ack = X + 1).
The client sends a final ACK segment back to the server, confirming the server’s
sequence number (Ack = Y + 1).
Now both the client and server have synchronized their sequence numbers, and the
connection is established.
ans :;
Flooding: Each router sends its link-state information to all other routers in the
network. This information includes the state of each link (up or down) and the cost
of each link.
Building a Link-State Database: Each router uses the information received to build
a link-state database (LSDB), which is a complete map of the network.
Dijkstra’s Algorithm:
Dijkstra’s algorithm is used by each router to calculate the shortest path from
itself to all other routers in the network. The algorithm works as follows:
Initialization:
Start with the source router (let’s call it S) and set the initial distance to
itself as 0 (i.e., Dist(S) = 0).
Set the distance to all other routers as infinity (Dist(X) = ∞ for all routers X
except S).
Select the unvisited router with the smallest distance (U), then mark it as
visited.
New Distance
=
Dist(U)
+
cost of the edge (link) between U and Neighbor
.
New Distance=Dist(U)+cost of the edge (link) between U and Neighbor.
If the new calculated distance to a neighboring router is smaller than its previous
distance, update the distance.
Repeat:
Repeat the process for all routers in the network, ensuring that the shortest path
to each router is calculated.
Final Output:
Once all routers are visited, the shortest path tree from the source router is
built, and the distances to all other routers are known.
Q 5 Subnetting Ke Sums
ANS :::
1. What is Subnetting?
Determine the Required Number of Subnets (How many smaller networks you need).
Borrow Bits from the host portion to create the required number of subnets.
Example: A /24 subnet mask means 24 bits for the network, leaving 8 bits for hosts.
Each subnet will have a network address, usable IP range, and a broadcast address.
3. Example 1:
IP Address: 192.168.1.0/24
Required: 4 subnets
Subnets:
4. Example 2:
IP Address: 10.0.0.0/8
Subnets:
Key Formulae:
Number of Subnets:
2
�
2
n
, where
�
n is the number of borrowed bits.
Number of Hosts:
2
ℎ
−
2
2
h
−2, where
ℎ
h is the number of host bits. Subtract 2 for network and broadcast addresses.
ANS
Sure! Here's a **Distance Vector Table** format for each router based on the
previous example. Each router maintains a table that shows the **minimum distance**
to every other router in the network.
---
---
Router **A** receives information from B and C, router **B** from A and C, and so
on.
---
1. **Router A**:
- After receiving information from **B** and **C**, A updates its distance to
**D** via **B** (`1 + 5 = 6`).
2. **Router B**:
- After receiving information from **A** and **C**, B updates its distance to
**D** via **C** (`2 + 1 = 3`).
3. **Router C**:
- No update needed because the information received from **A** and **B** doesn't
offer shorter paths.
4. **Router D**:
- After receiving information from **B** and **C**, D updates its distance to
**A** via **C** (`1 + 4 = 5`).
---
After several iterations, the routers converge and reach the final state where no
more updates happen.