Name____________ Student ID__________________ Department/Year________ Midterm Examination Network Protocols: Design and Analysis Class#: 921 U4200 Fall 2003 14:30-16:10 Friday November 14, 2003 Prohibited 1. You are not allowed to write down the answers using pencils. Use only black- or blue-inked pens. 2. You are not allowed to read books or any references not on the question sheets. 3. You are not allowed to use calculators or electronic devices in any form. 4. You are not allowed to use extra sheets of papers. 5. You are not allowed to have any oral, visual, gesture exchange about the exam questions or answers during the exam. Cautions 1. Check if you get 10 pages (including this title page), 4 questions. 2. Write your name, student ID, and department/year down on top of every page. 3. You have 100 minutes to answer the questions. Skim through all questions and start from the questions you feel more confident with. 4. Write your name in Chinese and use English only for all other parts of the exam. Misspellings and grammar errors will be tolerated, but you want to make sure your answers would make sense to the grader. 5. If you have any extra-exam emergency or problem regarding the exam questions, raise your hand quietly. The exam administrator will approach you and deal with the problem. 1 Name____________ Student ID__________________ Department/Year________ 1. (Addressing) (1) How does NAT work? (5%) (2) What are the advantages and disadvantages of using NAT? (10%) (3) Is the IP address kept in the IP or TCP header? Is the port number in the IP or TCP header? (5%) (4) Is NAT a network layer, transport layer, application layer, all of the above, or none of the above service? Try to argue for your choice. (5%) Sample solution: 1.NAT (Network Address Translation) service is to enable the use of multiple computers in a local network that are allocated with only one or fewer IP addresses. Computers sitting behind the NAT gateway are assigned with virtual IP addresses that are not identifiable from the Internet. These local computers can initiate communications with computers in the Internet. As the traffic is going through the NAT gateway, the source IP and port ID are changed to the NAT gateway’s IP and a selected port ID. A mapping of the original source IP and port number and the NAT IP and new port number is kept on the NAT machine. As reply traffic is coming back through the NAT gateway, the destination IP and port number will be restored according to the mapping to the local machine using a virtual IP address. 2.The advantages include (not limited to) that: i. A larger local network is possible with a limited number of IP addresses. This in turn alleviates the problem of the Internet running out of Class B addresses. ii. Computers sitting outside the NAT gateway cannot initiate communications to those inside. This conveniently protects the computers behind the NAT gateway from certain network attacks. The disadvantages include (not limited to) that: iii. There are applications, for example FTP, requiring IP addresses and port numbers for the communication. Not knowing that the NAT gateway may change the IP and port number in the middle, these applications might not be able to function correctly without special application proxies installed at the NAT gateway. 2 Name____________ Student ID__________________ Department/Year________ iv. Computers sitting outside the NAT gateway cannot initiate communication to the ones inside due to the fact that the IP addresses of those behind the NAT gateway are virtual ones. There could be legitimate computers allocated with these IP addresses. Or these IP addresses might not exist at all. In other words, the routers on the Internet will not be able to forward packets to the computers behind the NAT gateway using the virtual addresses. Therefore, the computers sitting behind the NAT gateway can only be client machines but not the servers. 3.IP addresses are in the IP header, and port numbers in the TCP (or UDP) header. 4.There’s no standard solution here. Claim your own and argue for it. The more convincing your arguments are to the claim, the better. And here mine: based on the header fields that NAT needs to access, NAT is a ‘network+tranport’ layer service. 3 Name____________ Student ID__________________ Department/Year________ 2. (Routing) (1) Describe how Distance Vector routing works in principle. Name one example of DV routing protocols. (5%) (2) Describe the well-known ‘Count To Infinity’ problem in DV routing. (Hint: easier by an example) (10%) (3) State the main difference between Path Vector and Distance Vector routing. Name one example of PV routing protocols. (5%) (4) Would the ‘Count To Infinity’ problem exist is PV routing? (5%) Sample solution: 1.Each node on the network keeps a vector of best (next hop, distances) to every other node. Whenever a route report is received, the node updates the distance vector if the route report provides a better route to a particular destination via the neighbor from which the report is received. If this results in changes in the route (next hop or distance) to that destination, a route report is sent which might in turn change the distance vector of the node’s neighbors. In principle, each node will tell the neighbors the best information it’s got. RIP is a DV routing protocol. 2. infinity 1 A B 1 C 4 Name____________ Student ID__________________ Department/Year________ Consider the scenario above. A goes to B through link A-B, to C through A-B-C. B goes to A through link A-B, to C through link B-C. C goes to A through C-B-A, to B through link B-C. Suddenly, link A-B breaks down. 1. In B, the distance to go to A via A is set to infinity. Therefore, B decides going via C to A is a better route (distance of 3, B-C-B-A). B reports to C that its route to A is now via C with distance 3. 2. C updates the distance to A via B to 4. C reports to B that its route to A is still via B but with distance 4. 3. B updates the distance to A via C to 5 and reports to C that its route to A is still via C but with distance 5. 4. C updates the distance to A via B to 6 and reports to B that its route to A is via B with new distance 6. 5. The process continues until B updates the distance to A via C to infinity+1 and reports to C that its route to A is now via A with distance infinity. 6. C updates the distance to A via B to infinity+1 and reports to B that its route to A is with distance infinity+1 7. B updates the distance to A via C to infinity+2 and the routing tables finally converge. This phenomenon that the network needs to wait until the routes are counted to infinity before the routing tables stabilize is referred to as the ‘Count to Infinity’ problem. In the process of the routes counting to infinity, there could be a substantial amount of data looping in between without realizing that the destination is no longer reachable. 3.Path Vector routing protocols propagate not only the distance, but also the entire path. BGP is a PV routing protocol. 4.No 5 Name____________ Student ID__________________ Department/Year________ 3. (TCP) Suppose there are M bits of data to be transmitted using a TCP connection. Assume the sender and receiver have infinite buffer space. The MSS is M/6 bits. The initial congestion window size is 1 MSS. The slow start threshold is 2 MSS. And the round-trip time, RTT, is much greater than the segment transmission time. For simplicity, assume the TIMEOUT interval is fixed to a much greater value than the RTT. The TCP connection is initiated and closed by the data source as depicted in the transmission diagram. Try if you can answer the following questions. SYN Beginning ACK & SYN ACK & Segment 1 FIN ACK&FIN End ACK (1) Suppose no segments are lost. Complete the transmission diagram. (5%) (2) Suppose segment number 4 is lost. Redraw the diagram for Van Jacobson’s original TCP and for Tahoe TCP. Assume that 3 duplicate acks means 3 acks for the same sequence number. (10%) (3) Suppose segment number 5 is lost. Redraw the diagram for Tahoe TCP and for Reno TCP. (10%) Sample solution: 6 Name____________ Student ID__________________ Department/Year________ 1. SYN ACK&SYN ACK&Segment 1 FIN ACK&FIN ACK 2.Assuming 3 duplicate acks meant 3 acks with the same sequence number Jacobson Tahoe SYN SYN ACK&SYN ACK&SYN ACK&Segment 1 ACK&Segment 1 TIMEOUT FIN ACK&FIN FIN ACK ACK&FIN ACK 7 Name____________ Student ID__________________ Department/Year________ 3.The transmission is the same for both Tahoe and Reno TCP. SYN ACK&SYN ACK&Segment 1 TIMEOUT FIN ACK&FIN ACK 8 Name____________ Student ID__________________ Department/Year________ 4. (TCP Friendly Congestion Control) Suppose you work for an Internet radio channel. The company is used to transferring audio by UDP until its ISP starts to notice the large amount of bandwidth this Internet radio company is consuming. The ISP warns the Internet radio company. If the company will not send traffic just like everyone else surfing the WWW, the ISP will stop providing the Internet access service. As the Internet technician of the radio channel, you are asked to provide a solution – a transport layer service that does not guarantee reliability but does TCP friendly congestion control. Follow the sub-questions below and try if you get to keep your job. cwnd W W/2 time (1) Assume the audio transfers are long and it will be sufficient for these transfers to be friendly to TCP in the congestion avoidance state (the steady state). Assume also there exist on the Internet only packet drops due to duplicate acknowledgements. The Figure above depicts the congestion window size within an average saw tooth in the steady state. Try if you can derive the average TCP throughput: MSS/RTT * (3/2p)1/2, where MSS is the packet size in bytes, RTT is the round-trip time, and p is the packet drop rate. (10%) (2) Continue from (1). You know from empirical studies that the average TCP packet size is 512 bytes. If you will be able to estimate the value of RTT and p, you will be able to control the rate of the audio transfer to the level of a steady state TCP. Therefore the problem left now is to estimate the RTT and p. Try if you can devise a scheme to obtain the necessary estimates. Be specific about what you would implement at the sender side, as well as the receiver side, to achieve good estimates of RTT and p and how frequent the sending rate will be adjusted. Please take into consideration how you would start the transfer before reliable estimates of RTT and p can be obtained. (15%) Sample solution: 9 Name____________ Student ID__________________ Department/Year________ 1.# of packets: (W/2+W)(W/2)/2 = 3W2/8 = 1/p => W=sqrt(8/3p) Time: (W/2)RTT Throughput (in packet)=(3W2/8) / (W/2)RTT=(3W/4)RTT=sqrt(3/2p)/RTT Throughput (in bytes)=MSS/RTT*sqrt(3/2p) 2.There is again no standard solution for this question. Provided below are a few possible solutions. As long as you can state a reasonable solution, credits will be granted. RTT estimation: There are two main ways of sampling RTT: 1) timestamp the data packets and send the timestamp back in the ack packets and 2) keep the sending time of the data packets and compute the time difference when the corresponding ack packets are received. After getting the samples, take the EWMA of the RTTs and apply the value for the fair rate computation. p estimation: One simple way is to keep a counter for the total number of data packets sent and a counter for the total number of retransmitted data packets sent. Take p as the ratio of the two counter values. Frequency of adjustment: The adjustment interval must be a multiple of RTT in order to be reasonably long for RTT and p estimations Start up: One way is to start with a low rate and tune up as RTT and p estimations are obtained. The other solution is to cache previously estimated fair rate to the destinations and use the cached value as the initial rate. 10