Yu Cheng (Jade) ICS 351 Prelab Report 5 October 28, 2008 [Question 1] Explain the role of port numbers in TCP and UDP To use different port numbers for different protocols allows the host to receive more than one protocol transmissions. The receiver tells the sender what port number it is using for this certain kind of protocol, the sender would sent to that port. Also specifying the port numbers allow the host to decide which transmissions to listen to but not the others. [Question 2] Provide the syntax of the ttcp command for both the sender and receiver which executes the following scenario: A TCP server has IP address 10.0.2.6 and a TCP client has IP address 10.0.2.7. The TCP server is waiting on port number 2222 for a connection request The client connects to the server and transmits 2000 bytes to the server, which are sent as four write operations of 500 bytes each. on receiverPC (server)#: ttcp -rs -l2000 -n4 -p 2222 on senderPC (client)#: ttcp -ts -l2000 -n4 -p2222 -D 10.0.2.6 [Question 3] Answer the followig questions on Path MTU Discovery: a. How does TCP decide the maximum size of a TCP segment? This Maximum Segment Size (MSS) announcement is sent from the data receiver to the data sender and says "I can accept TCP segments up to size X". The size (X) may be larger or smaller than the default. b. How does UDP decide the maximum size of a UDP datagram? UDP provides a message-oriented interface. Each message is sent as a single UDP segment, which means that data boundaries are preserved. However, this also means that the maximum size of a UDP segment depends on the maximum size of an IP datagram, which is 576 bytes. Allowing large UDP segments can cause problems. Processes sending large segments can result in IP fragmentation. c. What is the ICMP error generated by a router when it needs to fragment a datagram with the DF bit set? Is the MTU of the interface that caused the fragmentation also returned? The basic procedure of path MTU discovery is simple--send the largest packet the sender can, and if it won't fit through, some link get back a notification saying what size will fit. The notifications arrive as ICMP packets known as "fragmentation needed" ICMPs. The notifications are requested by setting the "do not fragment" (DF) bit in packets that are sent out. So to answer the question, ICMP error "fragment needed" messages are generated. The MTU interface that caused the fragmentation would return and tell what size will fit. d. Explain why a TCP connection over an Ethernet segment never runs into problems with fragmentation. Ethernet MTU is 1500, and MSS is 1460. TCP runs over IP and IP fragment is smaller than ethernet fragment size. [Question 4] Assume a TCP sender receives an ackowledgment (ACK)--that is, a TCP segment with the ACK flag set--in which the acknowledgment number is set to 34567 and te window size is set to 2048. Which sequence number can the sender transmit. Window (16 bits)--the size of the receive window, which specifies the number of bytes (beyond the sequence number in the acknowledgment field) that the receiver is currently willing to receive. The sequence number can the sender transmit is 34567 - 2048 = 32519. [Question 5] Describe the following heuristics in TCP and explan why thay are used. a. Nagle's algorithm: Nagle's algorithm works by coalescing a number of small outgoing messages, and sending them all at once. Specifically, as long as there is a sent packet for which the sender has received no acknowledgment, the sender should keep buffering its output until it has a full packet's worth of output, so that output can be sent all at once. b. Karn's algorthm: Karn's Algorithm requires not using retransmitted segments when updating the round trip estimate. Round trip time estimation is based only on unambiguous acknowledgments, which are acknowledgments for segments that were sent only once. A solution to the problem that the ack messages may be for the previous transmission, is to incorporate transmission timeouts with a timer backoff strategy. The timer backoff strategy computes an initial timeout. If the timer expires and causes a retransmission, TCP increases the timeout generally by a factor of 2. [Question 6] Anwer the following question about TCP acknowledgments: a. What is a delayed acknowledgment? It is a TCP preformance problem. The server waits for the client to ACK the segment before responding. Delayed acknowledgment means that the client fail to do so for up to 200ms. b. What is a piggybacked acknowledgment? To reduce the number of segments, we can combine the 2nd and 3rd segments in a delayed acknowledgement. In this case, each end waits for about 200 milliseconds to see if there is any data going in the same direction as acknowledgement. If it finds one, the acknowledgement can be piggybacked with the data. [Question 7] Describe how the retransmission timeout (RTO) value is determined in TCP TCP provides a reliable transport layer. One of the ways it provides reliability is for each end to acknowledge the data it receives from. the other end. But data segments and acknowledgments can get lost. TCP handles this by setting a timeout when it sends data, and if the data isn't acknowledged when the timeout expires, it retransmits the data. A critical element of any implementation is the timeout and retransmission strategy. Fundamental to TCP's timeout and retransmission is the measurement of the round-trip time (RTT) experienced on a given connection. We expect this can change over time, as routes might change and as network traffic changes, and TCP should track these changes and modify its timeout accordingly. [Question 8] Answer the following questions on TCP flow control and congestion avoidance in TCP a. Describe the sliding window flow control mechanism used in TCP Sliding Window Flow Control is a method of flow control in which a receiver gives the transmitter permission to transmit data until a window is full. When the window is full, the transmitter must stop transmitting until the receiver advertises a larger window. TCP uses this method of flow control. b. Describe the concepts of slow start and congestion avoidance in TCP Congestion window starts small, at 1 segment size. Each time a transmitted segment is acknowledged, the congestion window is increased by one maximum segment size. Congestion window size grows exponentially (i.e. it keeps on doubling). Packet losses indicate congestion. Packet losses are determined by using timers at the sender. When a timeout occurs, the congestion window is reduced to one maximum segment size and everything starts over. Congestion avoidance in TCP is to establish a threshold at which the rate increase is linear instead of exponential to improve efficiency. c. Explain the concept of fast retransmit and fast recovery in TCP. Fast retransmis is another enhancement to TCP congestion control. The idea is when sender sees 3 duplicate ACKs, it assumes something went wrong. The packet is immediately retransmitted instead of waiting for it to timeout Fast recovery is another enhancement to TCP congestion control. The idea is don't do a slow start after a fast retransmit