CS代考 FIT3165/FIT4165 Tutorial #4 TCP/IP Layered Architecture Week 5 – Semester 1

FIT3165/FIT4165 Tutorial #4 TCP/IP Layered Architecture Week 5 – Semester 1 – 2022
17 March 2022
Revision Status
Updated by Dr. , Mar 2022.

Copyright By PowCoder代写 加微信 powcoder

©2022, Faculty of IT, Monash University

Instructions
1. Form ad-hoc groups of 2 to 3 students to solve this week’s exercise.
2. Discuss between the group members in your team and find answers to all the following review questions.
Review Questions
1 Can you explain why we need four (or sometimes three) message-segments for connection termination in TCP?
There are two parties involved in a two-way communication. TCP allows each party to stop sending while the other party is still sending data. This means we need at least two FIN segments (or data segments in which the FIN bit is set). Since each FIN segment should be acknowledged, we normally need four segments for connection termination. Sometimes the second FIN segment can be combined with the ACK segment to reduce the number of segments to three.
2 In TCP, how many sequence numbers are consumed by each of the following segments:
b. ACK c. SYN+ACK d. Data
A SYN segment consumes one sequence number.
An ACK segment does not consume any sequence numbers.
A SYN + ACK segment consumes one sequence number because it is a SYN segment.
©2022, Faculty of IT, Monash University

d. A data segment consumes n sequence numbers, where n is the number of bytes carried by the segment.
3. In TCP, does a FIN segment close a connection in only one direction or in both directions?
Solution: A FIN segment closes the connection in only one direction. The party that issues a
FIN segment cannot send data to the other party, but needs to acknowledge the data received from the other party. The other party can still send data and acknowledgments. To completely close the connection, two FIN segments are required, one in each direction. Of course, the FIN and ACK segments can always be combined.
4. In a TCP segment, what does a sequence number identify?
The answer depends on whether the segment is carrying data or not.
● If the segment carries data, the sequence number defines the number of the first byte in the segment.
● If the segment carries no data (pure control segment), the sequence number identifies the segment itself.
5 What are the maximum and minimum sizes of the TCP header?
• The maximum size of the TCP header is 60 bytes (20 bytes of header and a maximum of 40 bytes of options).
• The minimum size of the TCP header is 20 bytes.
6. Answer the following questions:
a. What is the minimum size of a UDP user datagram?
b. What is the maximum size of a UDP user datagram?
c. What is the minimum size of the application-layer payload data that can be
encapsulated in a UDP user datagram?
d. What is the maximum size of the application-layer payload that can be
encapsulated in a UDP user datagram?
©2022, Faculty of IT, Monash University

a. The minimum size is 8 bytes (header without payload).
b. Although the theoretical maximum size is 65,535 bytes, since a user data- gram
needs to be encapsulated in a single IP datagram (UDP is a connectionless protocol) and the maximum payload of an IP datagram is 65,515 bytes, we should say the maximum size of a UDP datagram is only 65,515 bytes.
c. The minimum size of the application-layer payload is zero bytes.
d. The maximum size of the application-layer payload is 65,507 bytes (65,515 −
7. The following is a dump (contents) of a UDP header in hexadecimal format 0045 DF00 0058 0000
a. What is the source port number?
b. What is the destination port number?
c. What is the total length of the user datagram?
d. What is the length of the data?
e. Is the packet directed from a client to a server or vice versa?
f. What is the application -layer protocol?
g. Has the sender calculated a checksum for this packet?
a. The source port number is the first 16 bits or (0045)16 = 69.
b. The destination port number is the second 16 bits (DF00)16 = 57,088.
c. The total length of the datagram is the third 16 bits (0058)16 = 88 bytes.
d. The length of the data is 88 − 8 = 80 bytes.
e. The message is from a server with a small (well-known) port number(69) to a
client with a large (ephemeral) port number(57088).
f. The well-known source-port number = 69 belongs to TFTP.
g. The sender has not calculated the checksum for this packet because the value of
the checksum is all zeros.
©2022, Faculty of IT, Monash University

8. A client uses TCP to send data to a server. The data consist of 16 bytes. Calculate the efficiency of this transmission at the TCP level (ratio of useful bytes to total bytes considering only TCP header).
The data section is only 16 bytes. The TCP header is 20 bytes. The efficiency is (16) / (16 + 20) = 0.444 → 44.4%
9. Assume Alice uses her browser to open two connections to the HTTP server running on Bob’s server. How can these two connections be distinguished by the TCP?
A connection is distinguished by a pair of socket addresses, one for each end. Although the socket addresses at Bob’s site are the same in this case, the socket addresses at Alice’s site are different. Each socket address at Alice’s site has a different ephemeral port number. (An ephemeral port is a short-lived endpoint that is created by the operating system when a program requests any available user port. The operating system selects the port number from a predefined range, typically between
1024 and 65535, and releases the port after the related TCP connection terminates.)
10. In TCP, can the sender window be smaller, larger, or the same size as the receiver window?
▪ The sender window in TCP is originally the same size as the receiver window,
▪ But as the congestion builds up in the network, it can become smaller than the
receiver window. It can never become larger than the receiver window.
▪ The size of the sender window is the smaller of the window size either dictated by
the congestion or determined by the receiver.
11. Is the use of checksum for error control optional or mandatory? a. UDP?
a. The use of checksum in UDP is optional. If the sender does not use the check-
sum, it fills the checksum field with sixteen 0s.
b. The use of the checksum in TCP, on the other hand, is mandatory. The sender
should calculate the check- sum; otherwise, the checksum calculation at the receiver fails and the segment is dropped.
©2022, Faculty of IT, Monash University

12. Assume we need to design a Selective-Repeat sliding-window protocol for a network in which the bandwidth is 1 Gbps and the average distance between the sender and receiver is 5,000 Km. Assume the average packet size is 50,000 bits and the propagation speed in the media is 2 x 108 m/s.
a. Find the maximum size of the send and receive windows,
b. Find the number of bits in the sequence number field (m), and
c. Appropriate time-out value for the timer.
We first calculate the average round-trip time (RTT) and the number of packets in the pipe before finding the sizes of the windows, the value of m, and the time-out value.
▪ Average RTT = 2 × (5,000 Km) / (2 × 108) = 50 ms.
▪ The bandwidth-delay product = 1 Gbps × 50 ms = 50,000,000 bits.
▪ The number of Packets ==bandwidth-delay product/packet_size = 50,000,000 bits /
50,000 bits = 1000 packets.
➢ The maximum send window size should be 1000 to allow not more than 1000
packets in the pipe.
➢ The maximum receive window size should also be 1000 packets.
➢ We know that the (window size) ≤ (2m − 1) or 1000 ≤ (2m − 1). This means that
we need to choose (m − 1) to be at least 10 or m = 11. The sequence
numbers are then 0 to 2047.
➢ The timeout value should be at least the average RTT = 50 ms to avoid early
retransmission of the packets and to prevent congestion.
13. In a TCP connection, assume that maximum segment size (MSS) is 1000 bytes. The client process has 5400 bytes to send to the server process, which has no bytes to respond (unidirectional communication). The TCP server generates ACKs according to the rules we discussed already. Show the timeline for the transactions during the slow start phase, indicating the value of cwnd at the beginning, at the end, and after each change. Assume that each segment header is only 20 bytes.
The data from the client process, 5400 bytes, can be divided into six chunks (five chunks of 980 bytes and one chunk of 500 bytes). After adding a header of 20 bytes, we have six segments (five segments of 1000 bytes and one segment of 520 bytes).
The segments and the ACKs are created according to the rule we mentioned in the text. The size of the congestion window is doubled by every RTT.
©2022, Faculty of IT, Monash University

If we follow the growth of the cwnd, we can see the pattern is exponential (20 = 1, 21 =2, 22 =4, 23 =8).
14. Assume a TCP client expects to receive byte 2001, but it receives a segment with sequence number 1201. What is the reaction of the TCP client to this event? Can you justify the reaction?
The received segment is a duplicate. The TCP client needs to discard the segment and immediately send an ACK with acknowledgment number 2001. This reaction helps the server to update itself if the previous ACK with acknowledgment number 2001 is somehow lost (Rule 6 in ACK generation).
15. Compare the range of 16-bit addresses, 0 to 65,535, with the range of 32-bit IP addresses, 0 to 4,294,967,295. Why do we need such a large range of IP addresses, but only a relatively small range of port numbers?
The domain of IP addresses is universal. A device directly connected to the Internet needs a unique IP address.
©2022, Faculty of IT, Monash University

The domain of port numbers is local; they can be repeated or reused. Two computers running the HTTP server process use the same well-known port number (80); two computers running the HTTP client process can use the same ephemeral port number.
©2022, Faculty of IT, Monash University

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com