Sei sulla pagina 1di 10

Comprehensive Final Exam for Computer Networks

Spring 2006

>>> SOLUTIONS <<<


Welcome to the comprehensive final exam for Computer Networks. Read each problem carefully. There are ten required problems each worth 10 points 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, homework answers, old exam answers, etc.) as handwritten by you on both sides of the sheet. Photocopies, scans, or computer generated text are not allowed on this sheet. You have 120 minutes for the exam. Unless otherwise stated in the problem, start the answer for each new problem on a separate sheet of paper and write only on one side of each sheet. Good luck and be sure to show your work!

Problem #1 Answer the following questions regarding the basics of computer networks and the Internet. a) What are the fundamental measures of interest for a communications system?
Throughput, delay, loss, cost, mobility, robustness, and secrecy

b) Briefly describe circuit switching and packet switching.


Circuit switching uses a dedicated path that is established before communications begins. Packet switching shares a path that need not be established before communications begins.

c) What are the four causes of packet delay?


Processing, transmission, propagation, and queueuing.

d) Roughly, what is the signal propagation delay from here to Atlanta (about 400 miles)?
Speed of light propagation delay is about 1 nanosecond per foot, so 1 mile is about 5 microseconds, and thus the propagation delay from Tampa to Atlanta is about 2 milliseconds (400 miles x 5 microsecond/mile).

e) Define the open concept.


The ability of any two systems conforming to the reference model and associated standards to communicate (and interoperate) with each other.

Problem #2 Describe how email works. Describe the key components and flows. Identify key standards that apply. Use figures as needed. About 150 words should be sufficient.
Email is an asynchronous communications medium based on sent and received text messages (may include non-text attachments). The three major components of email are user agents, mail servers, and the SMTP (Simple Mail Transfer Protocol). SMTP is used to transfer messages between mail servers using TCP/IP (client/server). SMTP uses ASCII commands and headers. Commands are not authenticated. Between a mail server and a user agent, POP (Post Office Protocol), IMAP (Internet Mail Access Protocol), or HTTP (HyperText Transfer Protocol) is used to access received mail stored in inboxes on the mail server. Mail servers have a fixed IP address and are always powered-on. The user agents need not always be powered-on and also need not be fixed in location or IP address. The figure shows a user agent accessing a mail server with POP, two mail servers exchanging messages using SMTP, and another user agent accessing its mail server using IMAP. user agent server server user agent +-----+ POP +-----+ SMTP +-----+ IMAP +-----+ | |---------| |---------| |---------| | | | | | | | | | +-----+ +-----+ +-----+ +-----+ |-------------------------------| The Internet

Problem #3 Attached are server.c and client.c with some bugs. Identify the bugs and explain how to fix them.
Server program: Missing welcome_s = socket() after line 25 Missing htons() in line 28 Missing bind() after line 29 Listen must have more than 0 connections in line 31 Missing addr_len assignment after line 32 Missing +1 for strlen for \0 in line 38 Should recv() on connect_s in line 38 Should send() on connect_s in line 38 Missing closesocket() of welcome_s after line 42 Client program: Type of server_addr should be struct sickaddr_in in line 18 Size of out_buf and in_buf is too small in lines 19 and 20 Should be SOCK_STREAM and not DATAGRAM in line 24 Missing htons() in line 28 Missing +1 for strlen for \0 in line 36

Problem #4 Derive the formula for link utilization (U) for the stop-and-wait protocol. You may assume that a sender always has packets to send and that packets are never lost or in error. If other assumptions are needed to complete a reasonable derivation, state them.
We know U = t_useful / (t_useful + t_overhead).
t_pr data t_fr t_proc ack t_pr t_proc t_ack

For SAW protocol we have the following time components, t_fr for data frame transmission, t_pr for propagation, t_proc for processing, and t_ack for ack frame transmission. We have: t_useful = t_fr t_overhead = 2t_pr + 2t_proc + t_ack. Thus U = t_fr / (t_fr + 2t_pr +2t_proc + t_ack).

Problem #5 Answer the following questions about TCP: a) Describe how TCP sets its retransmission time-out (RTO) value.
The ideal RTO value would be the exact RTT for the current packet sent. TCP uses an algorithm to estimate the RTT value. The algorithm uses exponential smoothing (alpha is the smoothing parameter) to generate an SRTT (smoothed RTT) as a function of the last measured RTT sample and past history as SRTT(k+1) = alpha*SRTT(k) + (1 alpha)*RTT_sample(k+1). RTO(k+1) is then beta*SRTT(k+1). A more recent algorithm also estimates the variability in RTT and uses this variability estimate to add a value to SRTT(k+1) instead of just multiplying it by a fixed beta.

b) Show the packet flows for TCP connection establishment and termination.
Establish SYN SYN-ACK ACK FIN ACK Terminate FIN ACK

Problem #6 Below are the first 60 bytes of a TCP/IP packet captured using Ethereal on an Ethernet network. On the last pages of this exam are packet header templates. Decode the packet for the following fields: - Ethernet MAC source and destination addresses (hexadecimal) - IP source and destination addresses (in standard dotted-decimal format) - TCP source and destination port numbers (decimal) - Type of TCP segment (e.g., SYN, FIN, ACK, etc.) - Application layer protocol (and command, if applicable)
08 02 03 ff 73 6d 00 4b 01 ff 74 6c 20 1f 08 80 65 20 f7 f8 68 d7 6e 48 88 40 00 00 2f 54 7d 00 50 00 63 54 = = = = = = = = 00 80 e0 47 68 50 11 06 5a 45 72 2f 43 ca 79 54 69 31 b7 9b da 20 73 2e 92 83 38 2f 74 31 43 f7 0b 7e 65 0d 08 03 ef 63 6e 0a 00 2a 53 68 2e 48 45 83 50 72 68 6f 00 f7 18 69 74 73 .. ..}..C..C..E. .K..@........*.. ...h.P.Zy.8..SP. ......GET /~chri sten/christen.ht ml HTTP/1.1..Hos

MAC source MAC dest IP source IP dest TCP source port TCP dest port TCP type Application

080020f7887d hex 001143b79243 hex 131.247.3.42 131.247.3.1 2152 80 PUSH, ACK HTTP (this is an HTTP 1.1 GET)

Problem #7 Answer the following questions about LANs (wired and wireless): a) What is a LAN? Define it precisely.
A LAN is a data network optimized for a medium-sized area (10s to 100s of stations and 100s to 1000s of meters). A LAN is owned and operated by a single organization.

b) Describe CSMA/CD and BEB as used in IEEE 802.3 Ethernet.


CSMA/CD is Carrier Sense Multiple Access / Collision Detection and enables the sharing of a wired medium among multiple hosts. A 1-persistent CSMA algorithm is implemented as follows (for when a host has a frame to transmit): 1) if medium is idle then transmit 2) if medium is busy then wait for medium to go idle and then transmit 3) if detect a collision then xmit a brief jam signal, stop transmitting, wait a random period of time, then (1) The "wait a random period of time" is implemented with Binary Exponential Backoff: while (attempts < 16) k = min(attempts, 10) r = rand(0, 2^k) delay = r * slot_time

A slot_time is the time it takes to transmit 64 bytes. This time determines the maximum span of an Ethernet (i.e., tpr <= tfr for frame of 64 bytes and tpr being the end-to-end propagation time).

c) Describe CSMA/CA as used in IEEE 802.11 WiFi.


CSMA/CA is Collision Avoidance and has both a sender and receiver component. sender algorithm is: 1) if sense channel idle for DIFS then transmit entire frame 2) if sense channel busy then start random backoff time timer count down while channel is idle transmit when timer expires if no ack, increase random backoff interval and repeat (2) The receiver algorithm is: 1) if frame received then return ACK after SIFS DIFS is distributed interframe time and SIFS is short interframe time. longer than SIFS. DIFS is The

Problem #8 Answer the following questions bridges and switches: a) What is a bridge? What is a switch? What are the motivations to use bridges and switches?
A bridge is a 2-port layer-2 packet filter. A bridge forwards only non-local frames. A bridge has no knowledge of upper layer protocols. A switch is a multiport bridge. Motivations to uses bridges and switches include increasing performance (by localizing traffic), improving reliability (over a single large LAN), and defining organizational boundaries.

b) Describe (give) the forwarding and learning algorithm for transparent bridges.
receive a frame if (DA is in table) and (DA is local) then not forward else forward if (SA in table) then check/update direction if (SA not in table) then add to table

c) What is media speed or wire speed (in packets per second) for 1500 byte packets on a 1 Gb/s Ethernet link.
10^9 bits/sec / ((1500 + 8 + 12) bytes/frame * 8 bits/byte) = 82345 frames/sec

Problem #9 IEEE 802.11 WiFi uses three address fields in its frame format to forward packets from a host in a hotspot to the Internet and from the Internet to a host in a hotspot. Assume that a WiFi access point (AP) is connected to a router port via an Ethernet link. Describe the packet flow from WiFi host to Internet and from Internet to WiFi host. Carefully identify the contents of all WiFi and Ethernet addresses fields.
From host to AP to router port: Host to AP: WiFi frame has addr1 = AP MAC, addr2 = host MAC, addr3 = router MAC AP to router: Ethernet frame has DA = router MAC and SA = host MAC From router port to AP to host: Router to AP: Ethernet frame has DA = host MAC, SA = router MAC AP to host: WiFi frame has addr1 = host MAC, addr2 =AP MAC, addr3 = router MAC

Problem #10 Answer the following questions about multimedia networking and security: a) What is a jitter buffer? How does it work? Why is it needed?
A jitter buffer is a FIFO queue in a receiving host where prefetched video (or audio) data is played-out. The playout rate is the same as the sender rate. The amount of pre-fetched data is such that it can tolerate delay variability in the network without starving (running out of data). A jitter buffer is needed to guarantee a needed constant playout rate (i.e., the same constant rate as at the sender) to the decoder in the receiver.

b) If we were to design a next generation network that would give QoS guarantees, what are the four basic principles (or pillars) needed for this network?
The four pillars are packet classification, isolation, call admission, and high utilization.

c) What are the three desirable properties of secure communications? Describe each property in one sentence.
The three properties are confidentiality, authentication, and integrity. Confidentiality is that only sender and receiver should be able to understand the message transmitted. Authentication is to confirm or prove the identity of the sender or receiver in the communication. Integrity assures that the message transmitted is not altered maliciously or by accident to achieve non-repudiation.

Extra Credit Give 40 networking-related acronyms (covered in this class, or in the textbook) and define them. For example, TCP = Transmission Control Protocol is good. MCSE = Microsoft Certified Systems Engineering is not good (we did not cover this topic or acronym in class).
No specific solution. related to networking. To be graded individually. Key is that the acronym is

1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45.

//======================================================= file = server.c ===== //= A message "server" program to demonstrate sockets programming = //= - TCP/IP client/server model is implemented = //============================================================================= //----- Include files --------------------------------------------------------#include <stdio.h> // Needed for printf() #include <string.h> // Needed for memcpy() and strcpy() #include <windows.h> // Needed for all Winsock stuff //----- Defines --------------------------------------------------------------#define PORT_NUM 1050 // Arbitrary port number for the server //===== Main program ========================================================== void main(void) { WORD wVersionRequested = MAKEWORD(1,1); // Stuff for WSA functions WSADATA wsaData; // Stuff for WSA functions unsigned int welcome_s; // Welcome socket descriptor struct sockaddr_in server_addr; // Server Internet address unsigned int connect_s; // Connection socket descriptor struct sockaddr_in client_addr; // Client Internet address struct in_addr client_ip_addr; // Client IP address int addr_len; // Internet address length char out_buf[100]; // Output buffer for data char in_buf[100]; // Input buffer for data // This stuff initializes winsock WSAStartup(wVersionRequested, &wsaData); // Fill-in server (my) address information and bind the welcome socket server_addr.sin_family = AF_INET; server_addr.sin_port = PORT_NUM; server_addr.sin_addr.s_addr = htonl(INADDR_ANY); // Listen on welcome socket for a connection listen(welcome_s, 0); // Accept a connection. connect_s = accept(welcome_s, (struct sockaddr *)&client_addr, &addr_len); // Print an informational message that accept completed printf("Accept completed \n); // Send to the client using the connect socket strcpy(out_buf, "Test message from server to client"); send(welcome_s, out_buf, strlen(out_buf), 0); // Receive from the client using the connect socket recv(welcome_s, in_buf, sizeof(in_buf), 0); printf("Received from client... data = '%s' \n", in_buf); // Close sockets and clean-up closesocket(connect_s); WSACleanup(); }

1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40.

//======================================================= file = client.c ===== //= A message "client" program to demonstrate sockets programming = //= - TCP/IP client/server model is implemented = //============================================================================= //----- Include files --------------------------------------------------------#include <stdio.h> // Needed for printf() #include <string.h> // Needed for memcpy() and strcpy() #include <windows.h> // Needed for all Winsock stuff //----- Defines --------------------------------------------------------------#define PORT_NUM 1050 // Port number used at the server #define IP_ADDR "127.0.0.1" // IP address of server (*** HARDWIRED ***) //===== Main program ========================================================== void main(void) { WORD wVersionRequested = MAKEWORD(1,1); // Stuff for WSA functions WSADATA wsaData; // Stuff for WSA functions unsigned int client_s; // Client socket descriptor double server_addr; // Server Internet address char out_buf[10]; // Output buffer for data char in_buf[10]; // Input buffer for data // This stuff initializes winsock WSAStartup(wVersionRequested, &wsaData); // Create a client socket client_s = socket(AF_INET, DATAGRAM, 0); // Fill-in the server's address information and do a connect with the // listening server server_addr.sin_family = AF_INET; server_addr.sin_port = PORT_NUM; server_addr.sin_addr.s_addr = inet_addr(IP_ADDR); connect(client_s, (struct sockaddr *)&server_addr, sizeof(server_addr)); // Receive from the server using the client socket recv(client_s, in_buf, sizeof(in_buf), 0); printf("Received from server... data = '%s' \n", in_buf); // Send to the server using the client socket strcpy(out_buf, "Test message from client to server"); send(client_s, out_buf, strlen(out_buf), 0); // Close and clean-up closesocket(client_s); WSACleanup(); }

NOTE: Ethereal traces do not contain the Preamble or SFD. All LAN addresses are 6 bytes.

From: W. Stevens, TCP/IP Illustrated, Volume 1 The Protocols, Addison-Wesley, Boston, 1994.

Potrebbero piacerti anche