122midterm2011-key2 - University of California at Berkeley College of Engineering Department of Electrical Engineering and Computer Sciences EE122

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: University of California at Berkeley College of Engineering Department of Electrical Engineering and Computer Sciences EE122 MIDTERM EXAMINATION Monday, 17 October 2011 Scott Shenker INSTRUCTIONS--READ THEM NOW! This examination is CLOSED BOOK/CLOSED NOTES. There is no need for calculations, and so you will not require a calculator, iphone, laptop computer, or other calculation aid. Please put them away right now! You MAY use one 8.5x11 double-sided crib sheet, packed with notes, formulas, and diagrams (but no font smaller than 10pt). All work should be done on the attached pages. Don't be scared off by the number of questions; many of them are simple warm-up exercises. In general, if something is unclear, write down your assumptions as part of your answer. If your assumptions are reasonable, we will endeavor to grade the question based on them. If necessary, of course, you may raise your hand, and a TA or the instructor will come to you. Please try not to disturb the students taking the examination around you. There are two blank sheets at the end of the test. Feel free to rip those off and use them as a place to work out some of the problems. Please show your work as needed on the test itself, but these pages will give you a place to get your thoughts in order. Please write your SID on each page! __________________________________________ (Name--Please Print!) SID: ______________________________________ Question 1 2 3 4 5 6 7 8 Total Extra Fun Possible Points 20 15 18 15 14 16 20 15 133 20 0 0 __________________________________________ (Signature) Discussion Section (Day/Time): ________________ Points Obtained Question 3 was marked as only having 15 points on a few exams. Please check to make sure you were marked with this problem having 18 points. If not, contact us for a regrade. - 1 - SID: _______________________ 1. True or False [20 points] For each of the following, please indicate T or F F T F T T T F F F T T F F i) ii) iii) iv) v) vi) vii) In the Internet, all packets from A to B follow the same path through the network. In circuit switched networks, all bits in the same transmission from A to B follow the same path. The Internet designers picked Best Effort service because it satisfied the needs of all applications, even those with strict delay requirements. Statistical multiplexing means that when you have more flows the overall burstiness is reduced (as in the law of large numbers). Time Division Multiplexing assigns each flow a slot in a frame, and one flow cannot borrow another flow's slot if it isn't being used. IP fragments are reassembled at the destination Performance is often more important than flexibility but typically only in hindsight. Link-state routing scales better than distance-vector. ACK packets can also carry data. There are other transport protocols used in the Internet besides UDP and TCP There are other internetworking protocols used in the Internet besides IPv4 and IPv6. viii) DHCP is a transport level protocol ix) x) xi) xii) xiii) The distributions for most Internet measurements (such as DNS access patterns and flow lengths) are exponential. One need only worry about the low end of the distribution, because the probabilities at the higher end die out so quickly. xiv) CIDR is the addressing scheme currently used in the Internet. xv) A RST message causes TCP to change its sequence numbers to zero and start again. T F T F T F T F xvi) ISPs in North America get their Internet addresses from ARIN. xvii) NAT is used to allocate addresses to hosts on a dynamic basis, while DHCP allows several hosts to use a single IP address. xviii) The Sequence Number in a TCP packet refers to the first byte in the packet payload. xix) The original Internet addressing scheme only supported 256 host addresses. xx) I feel much better now that I've finished the first question on the test. EE122 Midterm - 2 - October 17, 2011 SID: _______________________ 2. Short Questions: Principles/Foundations [15 points] A. [3] We are faced with three basic design decisions a) How to break the overall system into modules b) Where these modules are implemented: c) Where the associated state is stored: We have three general principles to guide us. Which of the above design decisions do the following help clarify: (choose either a, b, or c for principle below) i. ii. iii. Fate Sharing: c End-to-End Principle: b Layering: a B. [2] Your instructor is fond of certain sayings, which he repeats ad nauseum. If you care about your sanity, make him stop by showing that you get it already. Consider the following: Architect for a, engineer for d Fill in each of the blanks with one of the following words (for your answer, put the letter rather than writing out the word itself). You should only use two words, one for each blank. a) b) c) d) Flexibility Robustness Cost Performance Note: There are many combinations that are true (or at least reasonably close to true), but the question here is which does the instructor repeatedly pound into your head. EE122 Midterm - 3 - October 17, 2011 SID: _______________________ C. [4] Consider the five layers of the Internet. a) b) c) d) e) Application Transport (inter)network Link-Layer Physical i) Which is the highest layer implemented in hosts? a ii) Which is the highest layer implemented in routers? c iii) Which is the highest layer implemented in switches? d iv) Application designers want to rely on a reliable byte-stream abstraction; network designers want to build networks that think only about packets (not byte-streams) and best-effort service (not reliable delivery). What layer bridges the gap between what application designers want and what networks provide? b D. [3] Which of the following three choices is a necessary and sufficient condition for successful routing (assuming routing is deterministic): b a) Forward all packets along the shortest path, and never send a packet out along the port it came in on. b) Avoid loops (a packet returning to a node it has already visited) and dead-ends (where a packet is dropped before it reaches the destination). c) Always forward packets to a node closer to the destination. E. [3] Which statement below characterizes a simple invariant that (i) can be implemented in the source and (ii) ensures reliable delivery: b a) Resend packet if and only if the previous transmission was lost or corrupted. b) Always resend packet if the previous transmission was not acknowledged. c) Resend packet once for every packet drop EE122 Midterm - 4 - October 17, 2011 SID: _______________________ 3. Miscellaneous Short Questions: [15 points] A. [3] Consider the following fields in the IP packet header, with the additional answer of none of the above. Checksum is only over packet header, so it does not catch payload corruption. Too a) 16-bit Identification Field busy being proud of devising such a clever b) 8-bit TTL trick question, I then got fooled myself when c) 8-bit Protocol I filled out the answer key, so we marked it d) 16-bit Checksum incorrectly. If you answered f and were e) 4-bit header length marked wrong, ask for a regrade. If you f) none-of-the-above answered d and were marked right (which is most of you), be thankful for my stupidity. i) Which is used for fragmentation? a ii) Which can be used to indicate the presence of options? e iii) Which is used to prevent packets from looping forever? b iv) Which is used to detect corruption of the packet payload? f v) Which is used to instruct the network stack how to handle incoming packets? c vi) Which of these fields (name all of them) were completely removed in IPv6? a, d, e Note: the IPv6 next-header field is similar in spirit to the protocol field, so don't include that header in your answer. Speaking of stupid, some of you listed c in your answer even though we explicitly told you not to. But if you lost credit for this, come ask for a regrade. B. [2] DHCP: When obtaining an IP address through DHCP, the following messages are sent to/from the requesting host. a) b) c) d) DHCP discover DHCP offer DHCP request DHCP ACK Which of these are broadcast? a, b, c, d EE122 Midterm - 5 - October 17, 2011 SID: _______________________ C. [4] Consider the following protocols. a) b) c) d) e) f) g) h) i) DHCP DNS Ethernet FTP HTTP IP TCP UDP WTF You will be asked to describe the set of headers of a packet. This description should be the ordering of the header bits, starting with the bits at the front of the packet. In other words, for a packet that has protocol a's bits before protocol b's bits, write: a b. You can use each protocol as often as you'd like in the answer. i. Host sends an HTTP request (using Ethernet at link-layer). Please list the resulting headers: c f g e If you missed this question, make sure you understand why. Please come to office hours for an explanation. ii. Host sends a DHCP request (using Ethernet at link-layer). Please list the resulting headers: c f h a D. [1] How many bits are there in the host portion of the address 12.34.15.9 with a subnet mask of 255.255.192.0? 14 E. [2] Consider the following routing protocols: a) Distance-vector b) Link-state i) Which involves global state but local computation? b ii) Which involves local state but global computation? a EE122 Midterm - 6 - October 17, 2011 SID: _______________________ F. [6] Consider a node A behind a NAT, sending packets to a node B. We will follow a simple packet exchange of A sending to B, having the packet altered by NAT, and then the response coming back, again altered by NAT, and then arriving at A. You know the following: Packet leaving A: Destination address: 4.3.2.1 Source address: 192.168.2.7 Destination port: 80 Source port: 1067 Packet leaving B: Destination address: 2.2.2.2 Source address: 4.3.2.1 Destination port: 2500 Source port: 80 i) For the packet leaving the NAT towards A, please fill in the blanks: Destination address: 192.168.2.7 Source address: 4.3.2.1 Destination port: 1067 Source port: 80 ii) Fill in the following blanks: IP address of the NAT: 2.2.2.2 IP address of node A: 192.168.2.7 IP address of node B: 4.3.2.1 EE122 Midterm - 7 - October 17, 2011 SID: _______________________ 4. Putting It All Together [15 points] The client on host A is accessing a web page. The following messages are seen traversing the link to A (in either direction). Indicate which order they are in, and whether they are going to, or coming from, A. We ignore ARP (which we did not cover in class yet), we assume that the necessary DNS entry is not in A's cache, and (for clarity) we assume A does not piggyback its HTTP request on a TCP ACK (i.e., that these are two separate packets). a) b) c) d) e) f) g) h) i) TCP SYN DNS Request HTTP Request TCP ACK TCP SYNACK TCP FIN TCP FINACK DNS Reply HTTP Response For the answers below, enter the letter of the packet and circle either From A or To A. We assume that the client initiates closing the TCP connection, and that all responses are a single packet. You can reuse packets as needed. Packet 1: Packet 2: Packet 3: Packet 4: Packet 5: Packet 6: Packet 7: Packet 8: Packet 9: b h a e d c i f g From A To A From A To A From A From A To A From A To A From A Packet 10: : d EE122 Midterm - 8 - October 17, 2011 SID: _______________________ 5. Learning Switch [14 points] Consider a learning switch with five ports. Immediately after being turned on, it receives the following series of packets (these are the only packets the switch sees during this period) which are described using the following notation: port 2: AB denotes packet sent from A to B that arrives on port 2 The packets listed below arrive in sequence, one right after another. For each packet, write down which outgoing ports the packet is forwarded out of. The only acceptable answers are one of the following choices: a) b) c) d) The switch forwards the packet out port 1. The switch forwards the packet out port 2. The switch forwards the packet out port 3. The switch forwards the packet out all ports except the port the packet arrived on. e) The switch drops the packet without forwarding it. List the answers by putting the appropriate letter in the blanks below: i) port 1: AB ii) port 2: BC iii) port 2: BA iv) port 3: CB v) port 3: CD vi) port 3: AD vii) port 2: EB d d a b d d e EE122 Midterm - 9 - October 17, 2011 SID: _______________________ 6. Routing [16 points] A set of routing entries is valid (for a particular destination) if a packet is always forwarded to the destination, no matter where it starts. These entries need not route along the shortest path to be valid. Consider the following routing entries for destination A. This table lists, for each node, the next node it would send a packet to if that packet had a destination address A. You do not need to see the topology to answer this problem! Make sure you don't confuse the first two subproblems (i,ii) with the graph used in (iii). i) Are these entries valid? N (Y or N). If no, why not? Loop (Loop? Deadend? Other?) Node Next Hop Taken To Reach A H G C B A D F B C D E F G H ii) Are these entries valid? Y (Y or N). If no, why not? ___(Loop? Deadend? Other?) Node Next Hop Taken To Reach A E G A G B A E B C D E F G H EE122 Midterm - 10 - October 17, 2011 SID: _______________________ iii) Consider the following graph, with links costs listed, and assume we are using shortest-path (or lowest-cost) routing, and that routing has equilibrated to a constant set of routing tables. The routing algorithm uses poisoned reverse, advertising an infinite weight for the poisoned paths. Consider routing entries with A as the destination. What distance to A does B advertise to C? or 6 What distance does C advertise to B? 5 What path does a packet take from B to A? BCDEA or B-D-E-A If you picked the first route (in the third question), then the answer to the first question is , but if you picked the second route (in the third question) then the answer is 6. A 3 F 1 3 7 E 5 1 B C 1 3 4 D EE122 Midterm - 11 - October 17, 2011 SID: _______________________ 7. Packet Transmission [20 points] A Link 1 D Link 2 C i) Consider two links: link 1 has bandwidth B and latency L, while link 2 has bandwidth 2B and latency L/2 (that is, link 2 is twice as fast as link 1, but has half the latency). Here, and elsewhere on this test, latency refers to the propagation delay of a link; it includes no other delays (such as transmission time, processing time, time on the reverse path, etc.). A sends a data packet of size P to C at time zero (that is when the first bit hits the wire). Assume there is no processing time at the intermediate node D. When does the last bit arrive at C? Express your answer in terms of P, B, and L. Last bit arrives at time = 1.5(P/B + L) ii) Let RTT be the time it takes for the data to go from A to C plus the time it takes for an ACK to return from C to A. If A is using sliding window flow control, what is the throughput it achieves when: It has a window size W = 0.5BRTT Throughput = B/2 It has a window size W = 2BRTT Throughput = B Express your answer in terms of the various variables in the problem. EE122 Midterm - 12 - October 17, 2011 SID: _______________________ iii) Consider a simpler situation with a single link with bandwidth B and latency L, with nodes A and C on either end. Starting at time t=0, node A sends two data packets back to back to C, which then immediately ACKs them (requiring no processing delay). The data packets are 60 bytes, the ACK packets are 40 bytes. The first ACK packet arrives at t=3.8msec, and the second arrives at t=4.28msec. A C What is the value of B (in Mbps): _____ (Note: not bytes/sec or bits/msec) [Mbps is 106 bits/second] What is the value of L (in msec): _____ Please show how you arrived at these answers. Let T1 be the time the first packet arrives (arrives means time the last bit leaves the wire). Let T2 be the time the second packet arrives. P is the size of data packets, A the size of ACK packets. T1 = (P/B + L) + (A/B + L) T2 = (P/B) +T1 Therefore, P/B = T2-T1, so B = (480 bits)/(4.28-3.8msec) = 1Mbps T1 = (P+A)/B + 2L So 2L = T1 (P+A)/B = 3.8msec - 800bits/1Mbps = 3msec Thus, L = 1.5msec EE122 Midterm - 13 - October 17, 2011 SID: _______________________ 8. Addressing and Forwarding [15 points] Consider the following routing table: 56.160.0.0/16 port 1 56.161.0.0/16 port 1 56.162.0.0/16 port 5 56.163.0.0/16 port 1 56.164.0.0/16 port 1 56.165.0.0/16 port 6 56.166.0.0/16 port 6 56.167.0.0/16 port 1 56.168.0.0/16 port 2 56.169.0.0/16 port 2 56.170.0.0/16 port 2 56.171.0.0/16 port 2 56.172.0.0/16 port 1 56.173.0.0/16 port 4 56.174.0.0/16 port 3 56.175.0.0/16 port 3 In the above table, the destination address of each incoming packet will match one and only one prefix. Rewrite the routing table using Longest Prefix Match, using the minimal number of prefixes. Note that the table is listed in order, so any aggregation of prefixes will occur between adjacent prefixes. Hint: start off by expanding these prefixes into bit patterns.... One of your entries should be for the default route (i.e., default port X) and the rest should be written in the prefix notation used above. Write the entries below (you will not need more than eight lines, but may need fewer): Default 56.162.0.0/16 56.173.0.0/16 56.165.0.0/16 56.166.0.0/16 56.174.0.0/15 56.168.0.0/14 port 1 port 5 port 4 port 6 port 6 port 3 port 2 EE122 Midterm - 14 - October 17, 2011 SID: _______________________ Extra Credit (not on curve) [20 points] EC1. Delays: Consider a stream of packets arriving at a switch destined for a single destination, and assume there is no other traffic at the switch. The switch has a buffer in which to store packets while they are waiting for the transmission line to become free (so the packet is buffered before it is transmitted, but during its transmission we don't count that as time in the buffer). Assume the stream has average arrival rate R (measured in packets per second) and average time in the buffer T. i) What is the average number N of packets in the buffer? T R (expressed in terms of R and T) ii) We now change the definitions so that T includes the time while in transmission, and N includes the packet being transmitted. What is the average number N of packets in the buffer? T R (expressed in terms of R and T) EC2. RTT Estimation: Assume we have a TCP implementation that uses an exponential weighting factor of (rather than 7/8) in the update formula for the RTT. Assume that the initial estimate is 20msec, and then the next four samples are: 60msec, 40msec, 20msec, 10msec. What is the RTT estimate after the fourth RTT sample? 20 msec E0 = 20msec E1 = (20+60)/2 = 40msec E2 = (40+40)/2 = 40msec E3 = (40+20)/2 = 30msec E4 = (10+30)/2 = 20msec EE122 Midterm - 15 - October 17, 2011 SID: _______________________ EC3. Open-ended design question: Current routing designs (e.g., Link-State, DistanceVector, Path-Vector) require time to reconverge after a failure. During this interval, loops and deadends can arise which result in packets being dropped. Devise a routing scheme that never has loops or deadends, so it does not drop packets, ever. Feel free to change IP (by including new fields) if that would help, and assume routers can recalculate routes instantaneously. Wait for the lecture on advanced routing..... EE122 Midterm - 16 - October 17, 2011 SID: _______________________ For Fun [No points, just a beanbag] Who said the following quotes? a) Michele Bachmann b) David Clark c) Bill Gates d) Steve Jobs e) Leslie Lamport f) Barbara Liskov g) Ron Paul h) Ru Paul i) Bernie Sanders j) Eric Schmidt k) Scott Shenker i) I don't know where they're going to get all this money because we're running out of rich people in this country. a ii) The Internet is the first thing that humanity has built that humanity doesn't understand, the largest experiment in anarchy that we have ever had. j iii) If you don't love yourself, how in the hell you gonna love somebody else? h iv) Be a yardstick of quality. Some people aren't used to an environment where excellence is expected. d v) Modularity based on abstraction is the way things get done. f vi) Be nice to nerds. Chances are you'll end up working for one. c vii) We reject kings, presidents, and voting. We believe in rough consensus and running code. b viii)A distributed system is one in which the failure of a computer you didn't even know existed can render your own computer unusable. e ix) Our country's founders cherished liberty, not democracy. g x) There is a special place in hell reserved for the designer of Powerpoint's animation package. k xi) I fear very much that for the first time in the modern history of our country the next generation will have a lower standard of living than their parents, and that would be a real tragedy. i EE122 Midterm - 17 - October 17, 2011 ...
View Full Document

This note was uploaded on 01/09/2012 for the course ELECTRICAL 122 taught by Professor Shenker during the Spring '11 term at University of California, Berkeley.

Ask a homework question - tutors are online