Midterm Exam for Computer Networks (CNT 4004) Fall 2013 >>> SOLUTIONS <<< Welcome to the Mid-Term Exam for Computer Networks. Read each problem carefully. There are eight required problems (each worth 12 points you get 4 points just for submitting the exam). There is also an additional extra credit question worth 10 points. You may have with you a calculator, pencils and/or pens, erasers, and one 8.5 x 11 inch formula sheet. On this formula sheet you may have anything you want (definitions, formulas, homework answers, old exam answers, etc.) as handwritten by you in pencil or ink on both sides of the sheet. Photocopies, scans, or computer generated and/or printed text are not allowed on this sheet. Note to tablet (ipad, etc.) users you may not print-out your handwritten text for the formula sheet. Please answer the problems on the available sheets. If you need extra space, use the back side of the page of the problem that you are answering. You have 75 minutes for this exam. Good luck and be sure to show your work! Problem #1 4 points for each sub-problem. a) Sketch the five-layer Internet protocol stack and describe in one sentence (for each layer) the services that each layer provides. Application -- Where network application and application protocols reside Transport -- Transports appl layer messages between appl endpoints (end to end) Network -- Moves network layer packets from host to host (point to point) Link -- Actually moves packets from node to node (point to point) Physical -- Moves the individual bits from node to node (point to point) b) Sketch a packet (i.e., show the headers and trailers) that would result from this five-layer model. Be sure to show all header and trailers that could be present (even if you know that they are not present in a real Internet packet). -------------- PHY hdr Link hdr Network hdr Transport hdr Application hdr... -------------- --... data Appl trlr Transport trlr Network trlr Link trlr Phy trlr -- c) The OSI Reference Model has two additional layers. Where are these layers in the stack and what services do they provide? The two additional layers are the Session layer (layer 5 above the Transport layer and below the Presentation layer) and the Presentation layer (layer 6 above the Session layer and below the Application layer the Application layer is now layer 7). From the textbook (age 53), The role of the presentation layer is to provide services that allow communicating applications to interpret the meaning of data exchanged. And, The session layer provide for delimiting and synchronization of data exchange, including the means to build a checkpointing and recovery scheme.
Problem #2 3 points for each sub-problem. Answer the following questions regarding the Application Layer. a) An application layer protocol typically defines four things. What are these four things? Types of messages, syntax of messages, semantics of messages, and timing (when and how). b) What are ping and traceroute used for? Describe the output from each program. Ping is used to determine the presence (liveliness) of a remote host and the RTT to this host. The output is host not found (if the host is not there) or a list of RTTs for each ping packet sent. Traceroute is used to determine the hops (by IP address) from a source to a destination. For each hop listed, three sample RTTs are reported. c) What is the key difference between HTTP 1.0 and HTTP 1.1? HTTP uses a single TCP connection for each GET. HTTP 1.1 has the notion of persistent connections when multiple GETs (to a single server) can take place over a single TCP connection. d) What is DNS and what is it used for? If all DNS servers could be crashed (taken offline), what would happen to the Internet (be precise). DNS is Domain Name Service and is used to associate host names (as in say, www.yahoo.com or christen@csee.usf.edu) with IP addresses. If all DNS servers were to be crashed one would be unable to use hostnames and could only use IP addresses when using Internet services. Problem #3 6 points for each sub-problem. Answer the following questions about sockets a) Sketch the paired flowcharts for a streams (TCP) server and client showing the key sockets function calls (you need not give the arguments to each sockets function call, just identify it by name such as connect(), socket(), and so on). You need not include Winsock-specific calls (such as WSAStartup()). socket() socket() bind() listen() accept() <- - - - - - - - - connect() send() / recv() <- - - - -> send() / recv() close() close()
b) In the following sockets function call identify which arguments are passed-in and which arguments return values on successful completion of the below function. Describe the contents of each argument. connect_s = accept(welcome_s, (struct sockaddr *)&client_addr, &addr_len); The socket handle welcome_s is passed in, also passed in is a pointer to the size of the client_addr structure as &addr_len. On successful completion, the client_addr structure is returned filled-in with the connecting client address. Problem #4 6 points for each sub-problem. Answer the following questions about RDT protocols. a) For the rdt3.0 sender from the textbook (see Appendix A), what will the effect be if the isack(rcvpkt,1) condition in the Wait for ACK0 state is changed to isack(rcvpkt,0) and the isack(rcvpkt,0) condition in the Wait for ACK1 state is changed to isack(rcvpkt,1)? The matching rdt2.2 receiver is also shown in Appendix A for your reference. These two states will now have two transitions that trigger on the same condition, namely receiving the expected (and non-corrupted) ACK from the receiver. The FSM is thus not valid (or legal ). So, either the FSM will get stuck if the self-loop is taken in these states, or it will work correctly if the transition to next state is taken. However, it is unclear/unpredictable which transition will be taken. b) Assume a channel where data packets may be lost or corrupted, but ACKs are never lost and never corrupted. Give the simplest possible FSMs for an RDT sender and receiver for this channel. Use the notation and functions from the book (hint: the above FSMs contain the notation and most, if not all, of the functions you will need). Here is the FSM for the sender: SEND WAIT_ACK ------- ------- call from above send(data) ------------> ---------> make(packet, data), start_timer, udt_send(packet) time-out occurred <--------- recv(rcvpkt) && isack(rcvpkt) <-------- return success message to above Here is the FSM for the receiver. LISTEN ------- call from below rcv(rcvpkt) && notcorrupt(recvpkt) ---------> -----+ data = parsepkt(recvpkt), return data to above packet = makepkt(ack), udt_send(packet) <----+
Problem #5 6 points for formulas, 4 points for set-up, and 2 points for correct numerical answers. Assume a 24,000 mile long link (this is the distance to a geosynchronous orbit satellite) with data rate of 1 Mb/s. Assume 1250 byte packets (or frames). Assume that processing time and transmission time of ACKs are both negligible. What is the maximum throughput (in b/s) that the sender can achieve given a Stop-and-Wait protocol? Consider two cases 1) no packet loss, and 2) packet loss probability of 0.01. We know that U = t_fr / (t_fr + (2 * t_prop)) for the case of no errors and, U = ((1 p) * t_fr) / (t_fr + (2 * t_prop)) for p = probability of frame error. The throughput for the sender is then simply the utilization of the link multiplied by the line data rate. Solving for t_fr and t_prop: t_fr = (1250 * 8) / 1000000 = 10 ms t_pr = 24000 * 5*10^-6 = 120 ms (for 5 microseconds per mile prop delay) Thus, U = 10 / (10 + (2 * 120)) = 4.00% for no errors (packet loss probability = 0), and U = ((1 0.01) * 10) / (10 + (2 * 120)) = 3.96% for packet loss probability = 0.01 The throughput is then 0.04 * 1 Mb/s = 40 kb/s for the no error case and 0.0396 * 1 Mb/s = 39.6 kb/s for the error case. Problem #6 3 points for each sub-problem Answer the following questions regarding routing: a) What are the criteria for a good routing algorithm? Give at least four major criteria. Fast, simple, not generate much traffic, not create loops, stable, converges to an optimum solution b) Give a one sentence description of Dijkstra s algorithm. Find the shortest path from a given node to all other nodes by developing paths by adding edges in order of increasing path lengths c) Name a routing protocol that uses Dijkstra s algorithm. Name a routing protocol that uses Bellman-Ford algorithm. OSPF uses Dijkstra s algorithm. RIP uses Bellman-Ford. d) Using Dijkstra s algorithm, find the shortest path between nodes A and E. List the hops or links (node tuples) in the order that they are added by the algorithm. A 1 B 3 2 2 2 3 C D E Links are added in the following order: AB, AC, BD, and BE. The shortest path is then ABE
Problem #7 4 points for each sub-problem. Consider the following simplified network with a single router connecting networks 11.11.11 and 22.22.22 (here netid is 24 bits and host id is 8 bits). For a MAC address simply state (for example) MAC address of host A. The router has two ports identified as port 1 and port 2. hostid = 01 02 03 Router 01 02 03 +-+ +-+ +_+ +----------+ +-+ +-+ +-+ ABC 1 2 DEF +++ +++ +++ +-+------+-+ +++ +++ +++ ---+------+------+------+- -+------+------+------+--- netid = 11.11.11 22.22.22 a) Give the routing table in the router. The routing table is quite simple: netid port +----------+----+ 11.11.11 1 22.22.22 2 +----------+----+ b) Give the MAC and IP packet headers (address fields only) for a packet destined from host A to host F as sniffed on network 11.11.11 and network 22.22.22 (so, you are to give two sets of packet headers). On the 11.11.11 network: MAC destination = MAC address of Router port 1 MAC source = MAC address of host A IP source = 11.11.11.01 IP destination = 22.22.222.03 On the 22.22.22 network: MAC destination = MAC address of host F MAC source = MAC address of Router port 2 IP source = 11.11.11.01 IP destination = 22.22.222.03 c) Explain exactly how host A knows to which MAC address it should send a packet destined for a host on network 22.22.22. The ARP protocol in host A will resolve any IP address with netid 22.22.22 to the Router port 1 MAC address. Router port 1 is the MAC address destination that routes (via port 2) to all hosts on network 22.22.22. Problem #8 4 points for each sub-problem. Answer the following questions about Ethernet. a) Give the CSMA algorithm as used in IEEE 802.3 Ethernet. (1) If medium is idle then xmit (2) If medium is busy then wait until idle and then xmit immediately (3) If detect a collision then xmit a brief jam signal, stop xmitting, wait a random period of time, then (1)
b) Give the BEB algorithm as used in IEEE 802.3 Ethernet. while attempts < backoff_limit k := min(attempts, 10) r := rand(0, 2**k) delay := r * slot_time c) Explain how a collision is detected in Ethernet. There are two cases. For old fashioned coax-based Ethernet a collision is detected with a voltage circuit as an over-voltage condition. Two (or more) hosts transmitting at the same time causes a higher voltage on the shared coax that a single host transmitting. For newer UTP based Ethernet with separate TX and RX wires, receiving on the RX wire while transmitting on the TX wire is indication of a collision. Extra Credit History is 2 points, four way message flow is 8 points. Give the history of DHCP and describe how it works at a message flow level. DHCP is the Dynamic Host Configuration Protocol and is used to automatically grant an IP address and other configuration settings to a host. DHCP leases IP addresses to hosts. DHCP is an extension to the BOOTP protocol DHCP was standardized in 1993. DHCP is based on a four-way message exchange as follows. A host needing an IP address broadcasts a DHCP discover message to find all reachable DHCP servers. All DHCP servers receiving the discover message reply with a broadcast DHCP offer message. The host chooses a DHCP server from the, possibly, multiple DHCP offer messages received and broadcasts a DHCP request with a selected server specified. The selected server broadcasts a DHCP acknowledgement containing the IP address (and other configuration settings) for the host to use. The host effectively leases the IP address from the DHCP server and must periodically renew is lease with the DHCP server.
Appendix A RDT FSMs from the textbook