Assignment 2: Data Communication Network
MM = 20
Q1.
A network 192.168.1.0/24 is divided into 4 subnets. Find the new subnet mask and number of hosts per subnet.
Solution:
Given network address = 192.168.1.0/24, so default network bits = 24 and default host bits = 8.
To divide the network into 4 subnets, the number of host bits to borrow (n) is given by:
2n = 4 ⇒ n = 2 bits
Therefore, the new prefix length becomes 24 + 2 = /26.
1. New Subnet Mask:
Binary: 11111111 . 11111111 . 11111111 . 11000000
Decimal: 255.255.255.192
2. Number of Hosts per Subnet:
Remaining host bits (h) = 32 − 26 = 6 bits.
Usable hosts per subnet = 2h − 2 = 26 − 2 = 64 − 2 = 62
Ans. New subnet mask = 255.255.255.192 (/26) and usable hosts per subnet = 62.
Q2. The address of a Class B host is to be split into subnets with a 6-bit subnet number. What is the maximum number of subnets and the maximum number of hosts in each subnet?
Solution:
In a Class B IPv4 address, there are 16 network bits and 16 default host bits.
Given subnet number length (s) = 6 bits. Thus, the remaining host bits (h) = 16 − 6 = 10 bits.
1. Maximum Number of Subnets:
Max subnets = 2s = 26 = 64 (or 26 − 2 = 62 if all-0s and all-1s subnets are excluded per RFC 950)
2. Maximum Number of Hosts per Subnet:
Max usable hosts = 2h − 2 = 210 − 2 = 1024 − 2 = 1,022
Ans. Maximum subnets = 64 (62 per RFC 950) and maximum hosts per subnet = 1,022.
Q3. Consider the effect of using slow start on a line with a 10 msec RTT and no congestion. The receiver window is 24 KB and the maximum segment size is 2 KB. How long does it take before the first full window can be sent?
Solution:
Given: RTT = 10 ms, Receiver window (rwnd) = 24 KB, MSS = 2 KB, and there is no congestion.
Full window size in segments = 24 KB / 2 KB = 12 MSS.
In TCP Slow Start, the congestion window starts at 1 MSS (2 KB) and doubles after every RTT until it reaches the receiver window:
| Time (ms) | RTT Count | cwnd (MSS) | Data Sent (KB) |
|---|---|---|---|
| 0 ms | 0 (Start) | 1 MSS | 2 KB |
| 10 ms | After 1st RTT | 2 MSS | 4 KB |
| 20 ms | After 2nd RTT | 4 MSS | 8 KB |
| 30 ms | After 3rd RTT | 8 MSS | 16 KB |
| 40 ms | After 4th RTT | 12 MSS (capped at rwnd) | 24 KB (Full window) |
Note: If an initial threshold of ssthresh = rwnd / 2 = 6 MSS is assumed, linear growth from 6 to 12 MSS takes 9 RTTs = 90 ms.
Ans. It takes 40 ms (4 RTTs) before the first full window of 24 KB can be sent.
Q4. Consider an instance of TCP's Additive Increase Multiplicative Decrease (AIMD) algorithm where the window size at the start of slow start phase is 2 MSS and the threshold at the start of first transmission is 8 MSS. Assume that a timeout occurs during the fifth transmission. Find the congestion window size at the end of tenth transmission.
Solution:
Given: Initial cwnd = 2 MSS, initial ssthresh = 8 MSS, and a timeout occurs during the 5th transmission.
During Slow Start (cwnd < ssthresh), cwnd doubles after each transmission. During Congestion Avoidance (cwnd ≥ ssthresh), cwnd increases by 1 MSS per transmission. On timeout, ssthresh is set to half the current cwnd and cwnd resets to 1 MSS.
| Tx # | Start cwnd | Phase / Event | End cwnd | ssthresh |
|---|---|---|---|---|
| 1 | 2 MSS | Slow Start (×2) | 4 MSS | 8 MSS |
| 2 | 4 MSS | Slow Start (×2) | 8 MSS | 8 MSS |
| 3 | 8 MSS | Congestion Avoidance (+1) | 9 MSS | 8 MSS |
| 4 | 9 MSS | Congestion Avoidance (+1) | 10 MSS | 8 MSS |
| 5 | 10 MSS | Timeout → ssthresh = 10/2 = 5, cwnd = 1 | 1 MSS | 5 MSS |
| 6 | 1 MSS | Slow Start (×2) | 2 MSS | 5 MSS |
| 7 | 2 MSS | Slow Start (×2) | 4 MSS | 5 MSS |
| 8 | 4 MSS | Slow Start (capped at ssthresh = 5) | 5 MSS | 5 MSS |
| 9 | 5 MSS | Congestion Avoidance (+1) | 6 MSS | 5 MSS |
| 10 | 6 MSS | Congestion Avoidance (+1) | 7 MSS | 5 MSS |
Ans. The congestion window size at the end of the 10th transmission is 7 MSS.
Q5. Suppose that the TCP congestion window is set to 18 KB and a timeout occurs. How big will the window be if the next four transmission bursts are all successful? Assume that the MSS is 1 KB.
Solution:
Given: Current cwnd = 18 KB, MSS = 1 KB.
When a timeout occurs, TCP halves the current window for the threshold and resets cwnd to 1 MSS:
ssthresh = 18 KB / 2 = 9 KB, cwnd = 1 MSS = 1 KB
Tracing the next four successful transmission bursts:
| Burst | Window Sent | Phase / Rule | Resulting cwnd |
|---|---|---|---|
| 1st Burst | 1 KB | Slow Start (×2) | 2 KB |
| 2nd Burst | 2 KB | Slow Start (×2) | 4 KB |
| 3rd Burst | 4 KB | Slow Start (×2) | 8 KB |
| 4th Burst | 8 KB | Slow Start reaches threshold (capped at ssthresh) | 9 KB |
Ans. After four successful transmission bursts, the congestion window will be 9 KB (9 MSS).
Q6.
A video application uses UDP to transmit packets of 1,200 bytes at a rate of 800 packets per second. The sender uses IP address 192.168.10.15 and port 5000, while the receiver uses IP address 172.16.5.20 and port 6000. Calculate: (a) source and destination socket addresses, (b) UDP payload data rate in Mbps, (c) total transmission rate including the 8-byte UDP header, and (d) bandwidth required if each RTP packet adds a 12-byte RTP header.
Solution:
Given: Payload size = 1,200 bytes/packet, Packet rate = 800 packets/sec, UDP header = 8 bytes, RTP header = 12 bytes.
(a) Source and Destination Socket Addresses:
A socket address combines the IP address and port number as IP:Port:
Source socket address = 192.168.10.15:5000
Destination socket address = 172.16.5.20:6000
(b) UDP Payload Data Rate (in Mbps):
Payload rate = 1,200 bytes × 8 bits/byte × 800 packets/s = 7,680,000 bps = 7.68 Mbps
(c) Total Transmission Rate (including 8-byte UDP header):
Packet size = 1,200 + 8 = 1,208 bytes
Total rate = 1,208 × 8 × 800 = 7,731,200 bps = 7.7312 Mbps
(d) Bandwidth Required (with 12-byte RTP header + 8-byte UDP header):
Total packet size = 1,200 + 8 + 12 = 1,220 bytes
Required bandwidth = 1,220 × 8 × 800 = 7,808,000 bps = 7.808 Mbps
Ans. (a) 192.168.10.15:5000 → 172.16.5.20:6000; (b) 7.68 Mbps; (c) 7.7312 Mbps; (d) 7.808 Mbps.
Q7. A TCP connection has a round-trip time (RTT) of 80 ms and a receiver window size of 64 KB. The sender transmits data using segments of 1,000 bytes. Assume that acknowledgements are cumulative and there is no packet loss. Calculate: (a) maximum number of TCP segments transmitted before an ACK is required, (b) theoretical maximum throughput in Mbps, (c) transmission time for a 5 MB file under ideal conditions, and (d) congestion window size after 4 RTTs if initially 4 segments and doubling during slow start.
Solution:
Given: RTT = 80 ms = 0.08 s, Receiver window (rwnd) = 64 KB = 64 × 1,024 = 65,536 bytes, Segment size (MSS) = 1,000 bytes.
(a) Maximum Number of TCP Segments before an ACK:
Max segments = ⌊ rwnd / MSS ⌋ = ⌊ 65,536 / 1,000 ⌋ = 65 segments (64 segments if 1 KB = 1,000 B)
(b) Theoretical Maximum Throughput (in Mbps):
Max throughput = (rwnd × 8 bits) / RTT = (65,536 × 8) / 0.08 = 6,553,600 bps = 6.5536 Mbps
(c) Transmission Time for a 5 MB File (ideal conditions):
File size = 5 MB = 5 × 1,024 × 1,024 = 5,242,880 bytes = 41,943,040 bits
Transmission time = 41,943,040 bits / 6,553,600 bps = 6.4 seconds
(d) Congestion Window Size after 4 RTTs (Slow Start):
Starting from 4 segments and doubling every RTT (4 → 8 → 16 → 32 → 64):
cwnd after 4 RTTs = 4 × 24 = 4 × 16 = 64 segments (within the 65-segment receiver window)
Ans. (a) 65 segments; (b) 6.5536 Mbps; (c) 6.4 s; (d) 64 segments.