EXAM #2 FOR INTRODUCTION TO COMPUTER NETWORKS Fall 2002 NAME: ____________________________ SSN: ___________________ CODENAME: ________________________ Welcome to Exam #2 in Introduction to Networks. Read each problem carefully. There are seven required problems (each worth 14 points - 2 points for writing your name on the exam) and one extra credit problem worth 10 points. You may have with you a calculator, pencils, blank paper, lucky rabbit's foot, and one 8.5 x 11 inch "formula sheet". On this formula sheet you may have anything you want (definitions, formulas, old exam answers, etc.) as hand written by you on both sides of the sheet. Photocopies, scans, or computer generated text are not allowed on this sheet. Good luck and be sure to show your work! PROBLEM #1 Answer the following questions about bridges: a) Precisely define what is a bridge (in the context of networks, obviously). --- A bridge is a MAC layer filter. It filters frames by MAC addresses. Frames on "this side" of a bridge are filtered-out (i.e., not forwarded). --- b) What is the difference between a bridge and a repeater. Describe what a repeater does and what is its purpose. Does a bridge achieve this same purpose? --- A bridge is layer 2 and a repeater is layer 1. A repeater passes through all frames and regenerates the digital signal. When the signal is regenerated it is brought back to the "full" voltage level of the signal (e.g. as sent at the sending host). A bridge also regenerates the digital signal so it achieves the same purpose in this respect. --- c) Ethernet uses a type of bridging called "transparent bridge". This type of bridging also goes by two other names. What are these names? Explain where all three names come from (i.e., what they mean). --- The term TB came into being because this bridge type is totally "transparent" to end stations. No changes to end stations are needed when a TB bridge is installed. A TB bridge is also called a "learning bridge" because it automatically learns its bridge tables. Another name is "spanning tree bridge" because the configuration of the network must be a spanning tree for this type of bridge to work. --- d) Give the transparent bridge forwarding and learning algorithm. --- Receive a frame If (DA is in table) and (DA is local) then not forward else forward If (SA in table) check/update direction if (SA not in table) add to table --- PROBLEM #2 Answer the following questions about bridges: a) Briefly describe source routing. --- In source routing a Routing Information Field (RIF) is included in a frame as part of the LAN header. The RIF contains hop ids for the frame to follow. Each bridge that receive a frame forwards it only if that bridges hop id is in the RIF. --- b) What are advantages of source route bridging? What are advantages of transparent bridging? --- An advantage of source routing is that it simplifies bridge design. Bridging tables and complicated CAMs are not needed. An advantage of transparent bridging is that it requires no changes to the end stations (but, source routing does require that end stations do discovery and otherwise insert RIF fields in all frames). --- PROBLEM #3 Answer the following questions about sockets programming: a) What is the history (the "roots") of the sockets interface? --- Sockets developed with Unix. BSD flavor Unix to be exact. This explains the file I/O paradigm of sockets. --- b) Sketch the flowchart for a sockets client/server model. For each step of the flowchart give the appropriate sockets function name. --- SERVER CLIENT socket() socket() | | V | bind() | | | V V listen() <---------- connect() | | V | accept() | | | V V send()/recv() <--> send()/recv() | | V V close() close() --- c) When we say that some sockets functions "block", what do we mean? Give an example of a sockets function that blocks. --- This means that the function waits on an external event (e.g., a connection establishment) and does not return until this event has occurred. This could take many seconds in some cases. For example, the accept() function will not return until a connection has been established. Other blocking functions include connect(), recv(), and send(). --- PROBLEM #4 Consider the following network consisting of two three-station Ethernets attached via an IP router. Hosts A through F have MAC addresses of aaa, bbb, ccc, ddd, eee, and fff, respectively. Router port 1 has MAC address xxx, port 2 has MAC address yyy. The host id is shown above each host, the netid below the Ethernet. Router +----------+ | | 001 002 003 | 1 2 | 004 005 006 A B C +-+------+-+ D E F | | | | | | | | --+-----+-----+---------+- -+---------+-----+-----+--- 001.128.123 001.128.124 a) Give the ARP cache for station C assuming that C has recently communicated with all other stations. --- IP MAC -------------------------- 001.128.123.001 aaa 001.128.123.002 bbb 001.128.123.004 xxx 001.128.123.005 xxx 001.128.123.006 xxx --- b) Give the routing table for the router. --- net_id port ---------------------- 001.128.123 1 001.128.124 2 --- c) If A sends D a packet, explain what takes place and sketch the packet. In your packet sketch carefully identify the contents of the address fields. --- <-- MAC --> <--------------- IP --------------> +-----+-----+-----------------+-----------------+--- | xxx | aaa | 001.128.123.001 | 001.128.124.004 | ... on LAN #1 +-----+-----+-----------------+-----------------+--- <-- MAC --> <--------------- IP --------------> +-----+-----+-----------------+-----------------+--- | ddd | yyy | 001.128.123.001 | 001.128.124.004 | ... on LAN #2 +-----+-----+-----------------+-----------------+--- --- PROBLEM #5 Answer the following questions about IP and TCP: a) How many bytes in the IP and TCP headers? List the key fields for the IP and TCP headers. --- Each header is 20 bytes (without options). Key fields for the IP header include source and destination IP address. For the TCP header key fields are the source and destination port number, sequence and ack #, window size, and segment checksum. --- b) Sketch the packet flows for a TCP connection establishment. --- SYN -> <- SYN/ACK ACK -> --- c) What is the key difference between TCP and UDP? --- TCP is assured delivery and UDP is not (UDP is datagram service). --- d) Why are IP addresses hierarchal with netid and hostid? --- IP address addresses are hierarchical to reduce the size of routing tables. IP packets are routed only by netid until they reach their destination network where ARP is then used to resolve hostid to MAC address. --- PROBLEM #6 Answer the following questions about TCP a) What is the consequence of having a time-out value (for segment retransmission) that is too short (and define what is "too short")? --- A too short time-out value is one which is shorter than the round trip time of a send packet and its returning ACK. A too short value will result in a double send of the original packet. --- b) What is the consequence of having a time-out value that is too long? --- A too long time-out value will result in a sending host sitting idle where is should be re-sending in the case of a lost packet of ACK. --- c) If RTT_i (the i_th RTT estimate) is not updated on time-outs what can happen? Be precise (describing an example might be easiest and best). --- It the RTT estimate is not updated when time-outs occur the sender can get stuck in a state with a too small RTT estimate. For example, if the current path fails and a new loner path is used for subsequent packets then the new path will have a longer RTT. This longer RTT will cause the sender to always time-out and also never thus be able to update its RTT estimate. Thus, the sender is stuck in "double send" mode for the duration of the connection. --- PROBLEM #7 Answer the following questions about HTTP and web server implementations a) What is HTTP, where does it "fit" in the stack, and at a very high level how does it operate. --- HTTP is the HyperText Transfer Protocol. It fits above TCP. It is a request/response protocol between a client and a server. --- b) Describe the contents of a GET header. --- A GET header contains the GET command and file name requested (something like GET \index.html HTTP\1.1). Optional fields following this command include accept, accept encoding, accept language, host, and others. --- c) Give the flowchart (or steps) for the operation of a simple web server (i.e., a web server that serves only static objects). Identify where parallelism (e.g., as implemented with threads) is typically implemented. --- Wait for a connection Make the connection Receive a command and parse it Respond with requested stuff (i.e., do the command) Drop the connection Typically the last three steps are "spun off" in a thread leaving the main program to wait and make additional connections (and spin off more threads). --- EXTRA CREDIT PROBLEM: Telnet is an application that allows a client to have a console for a remote server run on his or her PC. As the user types on their keyboard, key characters can be sent one at a time to the server. TCP/IP is used for communications. What is the approximate overhead in a telnet session given that each keystroke or character is sent individually to the server (or from the server to the client). Show your calculations. Do you think telnet really works this way? Can you suggest an improvement? What is the approximate reduction in overhead from your improvement? Again, show your calculations. The approach you use to this problem is much more important that any "numbers" you come-up with. --- For each one byte carried there will be 16 bytes of LAN header and trailer, 20 bytes of IP header, and 20 bytes of TCP header. This is an efficiency of 1 / (1 + 16 + 20 + 20) = 1.75% (or overhead of over 98%). If each character typed is ACKed, then the efficiency is approximately cut in half... or less than 1% efficiency (greater than 99% overhead). Telnet actually sends an entire typed line (a command ended by CRLF) and not each character. Assuming 20 bytes per line and ACKs, we get an efficiency of about 20 / (20 + 16 + 20 + 20 + 16 + 20 + 20) = 15.2%. This is still very low efficiency and high overhead (about 85% overhead). ---