15-441: Computer Networks Homework 1



Similar documents
Carnegie Mellon Computer Science Department Spring 2007 Theory Problem Set 2

Homework 2 assignment for ECE374 Posted: 02/21/14 Due: 02/28/14

Homework 2 assignment for ECE374 Posted: 02/20/15 Due: 02/27/15

First Midterm for ECE374 02/25/15 Solution!!

CS3250 Distributed Systems

Using IPM to Measure Network Performance

The exam has 110 possible points, 10 of which are extra credit. There is a Word Bank on Page 8. Pages 7-8 can be removed from the exam.

Technical Support Information Belkin internal use only

Fundamentals of UNIX Lab Networking Commands (Estimated time: 45 min.)

Lab - Observing DNS Resolution

Lab - Observing DNS Resolution

Communications and Networking

First Midterm for ECE374 03/09/12 Solution!!

Troubleshooting Tools

File transfer and login using IPv6, plus What to do when things don t work

Computer Networks - CS132/EECS148 - Spring

1. The Web: HTTP; file transfer: FTP; remote login: Telnet; Network News: NNTP; SMTP.

Tutorial on Socket Programming

Introduction to Socket Programming Part I : TCP Clients, Servers; Host information

Wireshark DNS. Introduction. nslookup

Internet Protocol: IP packet headers. vendredi 18 octobre 13

Overview of TCP/IP. TCP/IP and Internet

architecture: what the pieces are and how they fit together names and addresses: what's your name and number?

Hands On Activities: TCP/IP Network Monitoring and Management

DNS Resolving using nslookup

Understanding TCP/IP. Introduction. What is an Architectural Model? APPENDIX

Tools for penetration tests 1. Carlo U. Nicola, HT FHNW With extracts from documents of : Google; Wireshark; nmap; Nessus.

Wireshark Lab: DNS. 1. nslookup

Procedure: You can find the problem sheet on Drive D: of the lab PCs. 1. IP address for this host computer 2. Subnet mask 3. Default gateway address

CS 5480/6480: Computer Networks Spring 2012 Homework 1 Solutions Due by 9:00 AM MT on January 31 st 2012

Unix System Administration

Remote login (Telnet):

idatafax Troubleshooting

First Workshop on Open Source and Internet Technology for Scientific Environment: with case studies from Environmental Monitoring

>>> SOLUTIONS <<< c) The OSI Reference Model has two additional layers. Where are these layers in the stack and what services do they provide?

Glossary of Technical Terms Related to IPv6

LAB THREE STATIC ROUTING

3. The Domain Name Service

Lab 2. CS-335a. Fall 2012 Computer Science Department. Manolis Surligas

Overview. Securing TCP/IP. Introduction to TCP/IP (cont d) Introduction to TCP/IP

How do I get to

Linux MDS Firewall Supplement

TCP/IP Protocol Suite. Marshal Miller Chris Chase

ARP and DNS. ARP entries are cached by network devices to save time, these cached entries make up a table

Connecting with Computer Science, 2e. Chapter 5 The Internet

THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering

1 Introduction: Network Applications

Computer Networks Network architecture

Wireshark Lab: DNS v6.01

Objectives of Lecture. Network Architecture. Protocols. Contents

UNIX Sockets. COS 461 Precept 1

Cross-platform TCP/IP Socket Programming in REXX

Virtual Server and DDNS. Virtual Server and DDNS. For BIPAC 741/743GE

Subnetting,Supernetting, VLSM & CIDR

Internet Security [1] VU Engin Kirda

Lecture 2-ter. 2. A communication example Managing a HTTP v1.0 connection. G.Bianchi, G.Neglia, V.Mancuso

Packet Sniffing and Spoofing Lab

Network Management and Debugging. Jing Zhou

EECS 489 Winter 2010 Midterm Exam

LESSON Networking Fundamentals. Understand TCP/IP

Sage ERP Accpac Online

COMP 361 Computer Communications Networks. Fall Semester Midterm Examination

Sage 300 ERP Online. Mac Resource Guide. (Formerly Sage ERP Accpac Online) Updated June 1, Page 1

Computer Networks: DNS a2acks CS 1951e - Computer Systems Security: Principles and Prac>ce. Domain Name System

Internet Control Protocols Reading: Chapter 3

Napster and Gnutella: a Comparison of two Popular Peer-to-Peer Protocols. Anthony J. Howe Supervisor: Dr. Mantis Cheng University of Victoria

IP addressing and forwarding Network layer

- Basic Router Security -

Protocols. Packets. What's in an IP packet

Transparent Identification of Users

Cisco Configuring Commonly Used IP ACLs

Additional Information: A link to the conference website is available at:

Application Layer. CMPT Application Layer 1. Required Reading: Chapter 2 of the text book. Outline of Chapter 2

Laboration, Ping, Traceroute, etc

NQA Technology White Paper

Linux MPS Firewall Supplement

Port Scanning and Vulnerability Assessment. ECE4893 Internetwork Security Georgia Institute of Technology

Motivation. Domain Name System (DNS) Flat Namespace. Hierarchical Namespace

EE 7376: Introduction to Computer Networks. Homework #3: Network Security, , Web, DNS, and Network Management. Maximum Points: 60

How To Design A Layered Network In A Computer Network

Homework 3 TCP/IP Network Monitoring and Management

Lab 4: Socket Programming: netcat part

Firewall Stateful Inspection of ICMP

FILE TRANSFER PROTOCOL INTRODUCTION TO FTP, THE INTERNET'S STANDARD FILE TRANSFER PROTOCOL

TCP/IP Networking An Example

Application Layer -1- Network Tools

Network Pop Quiz 5 Brought to you by please visit our site!

3.1 RS-232/422/485 Pinout:PORT1-4(RJ-45) RJ-45 RS-232 RS-422 RS-485 PIN1 TXD PIN2 RXD PIN3 GND PIN4 PIN5 T PIN6 T PIN7 R+ PIN8 R-

Agenda. Distributed System Structures. Why Distributed Systems? Motivation

Layered Architectures and Applications

Assignment #3 Routing and Network Analysis. CIS3210 Computer Networks. University of Guelph

Applications & Application-Layer Protocols: The Domain Name System and Peerto-Peer

Introduction to Socket programming using C

Socket = an interface connection between two (dissimilar) pipes. OS provides this API to connect applications to networks. home.comcast.

Transcription:

15-441: Computer Networks Homework 1 Assigned: September 9 / 2002. Due: September 18 / 2002 in class. In this homework you will run various useful network tools that are available in the Sun/Solaris machines in the Andrew cluster. You can issue the commands from the command prompt. If your default path name does not include the locations of these commands, use the whereis command to find the location of the command, e.g., whereis ping. To know more about the commands, use the Unix man pages, e.g., man ping. The options and argument format may differ in different versions of Unix. You must solve the homework individually. For full credit, show your work. 1 Transmission overheads Consider sending a file of Kbytes in the following settings. Setting 1 consists of two computers A and B, each equipped with a modem that is capable of sending/receiving at 33.3 kbps. For A to send a file to B, it must first establish a dial-up connection with B, which takes 30 seconds. It can then send the file in 128-byte packets, with a one-byte checksum attached to each packet. The propagation delay of the phone line is negligible. Assume that A and B are directly connected, i.e., there are no intermediate routers. Setting 2 consists of two computers C and D, connected by an established wireless connection that can transmit at 8 kbps through a satellite, with a quarter-second (0.25 second) total propagation delay from C to D. In setting 2, files are transmitted without being split into packets. You may assume there are no errors during each transmission and you may ignore acknowledgments, i.e., consider only bits flowing from the sending computer to the receiving computer. Also note that 1 K byte = 1024 bytes and 1 kbps = 1000 bit/second and most people agree that 1 byte = 8 bits. 1. If ½, how long does it take to send the file from A to B? 2. How long does it take to send the file from C to D? 3. For, how long does it take to send the file from A to B? 4. For, how long does it take to send the file from C to D? 5. Which link is better with respect to total time? Briefly justify your answer. 2 Caching Help Harry Bovik analyze the effects of caching in the context of DNS. Our friend Harry finished setting up the DNS server for his Web site, www.harrybovik.com. His web site became very popular, and both his web server and DNS server became quickly overloaded. He decided to add more web servers and distribute the load among these servers. He also came up with the following scheme to distribute the load among two DNS servers ns1 and ns2. A typical query occurs as follows:

1. When a client makes a request for www.harrybovik.com, the.com name server is contacted first. It returns the name server (NS) record for ns-main.harrybovik.com along with a corresponding A record. The TTL of these records is set to 1 day. 2. The ns-main.harrybovik is then queried for the address. It tosses a coin and returns an NS record for one of ns1, ns2.harrybovik.com. 3. Finally, the host in the NS record from step 2 is contacted and it returns an address (A) for the most lightly loaded web server. The following TTLs are assigned to the different records: NS record for ns-main.harrybovik.com: 1 day. NS record for ns1,ns2.harrybovik.com: 1 day. A record for ns1,ns2.harrybovik.com: 1 day. A record for the actual web server: 1 minute. Harry s Web site is especially popular among CMU students. The CMU network administrators estimate that there is one access from CMU every 6 minutes. Each access results in the application resolving the name www.harrybovik.com. Assume the following: No other queries are made from CMU. All CMU clients use the same local name server. Web browsers do no do any caching of names on their own. Question: How many accesses will be made to the following name servers every DAY to resolve these queries? Fill in the table with your results and explain your calculations. Name server ROOT (.com) ns-main.harrybovik.com ns1.harrybovik.com # access/day 3 Sockets Close semantics: Network protocols are typically very specific about which party first closes the network connection. Some application protocols include primitives to indicate the end of connection. However, the sockets API allows applications to specify the end of connection through the close() system call, and various application protocols rely on this feature. For example, in HTTP 1.0, the server calls close() to indicate to the client that it has finished transmitting a file. In general, when an application is finished with a socket, it calls close(), passing the descriptor for the socket that it no longer needs. The close() system call tells the underlying protocol stack to initiate any actions required to shut down communications and deallocate any resources associated with the socket. To answer the questions below, you will need to carefully read the UNIX man pages for the following system calls: send(), shutdown(), socket(), close(), ip, setsockopt() and getsockopt(), among others. The socket close semantics are also explained in [1, 2]. For the following questions, assume that an application is using a SOCK STREAM type socket (i.e., TCP). See the fragment of source code below. 2

int send_data(char* buf, size_t size, char* ip_addr, u_short port) struct sockaddr_in peer_addr; /* peer s internet address */ int to_send = size; /* size of the data to send */ int total_sent = 0; /* total number of bytes sent */ int sent = 0; int sd = socket(pf_inet, SOCK_STREAM, IPPROTO_TCP); /* initialize peer s address struct */ memset(&peer_addr, 0, sizeof(peer_addr)); peer_addr.sin_family = AF_INET; peer_addr.sin_addr.s_addr = inet_addr(ip_addr); peer_addr.sin_port = htons(port); if (sd < 0) die_with_error("socket() failed"); if (connect(sd, (struct sockaddr*)peer_addr, sizeof(peer_addr)) < 0) die_with_error("connect() failed"); /* send loop */ while (total_sent < to_send && sent >= 0) sent = send(sd, buff + total_sent, to_send - total_sent, 0); if (send > 0) total_sent += sent; else die_with_error("send(...) failed"); close(sd); return total_sent; 1. In the program above, assume the send() call returns with no error. Where is the data after the send() call returns? In other words, What assumptions can the programmer make after send() returns? 2. Again, assume send() returns with no error. Then the program calls close(), which returns immediately with no error. What assumption can the programmer make about the data sent? Is there any guarantee that the data reached the other end point of the connection? 3. If your answer to the previous question is no, is there a mechanism, other than application level confirmation, to be sure that the data reached the other end point when close() returns? 4. The connect() call establishes a duplex (i.e., two-way) communication channel with the other party. Now suppose that in the program above, after completing the send loop we want to be able to notify the other party that we are done sending the data and still be able to receive data from the other party on the same socket. How can we notify the other party that we are done sending data without using an application-level mechanism? 4 HTTP persistent connections The HTTP 1.1 standard defines, and encourages, the use of persistent connections. With persistent connections the client (i.e., Web browser) opens Ò connections and requests all the objects (e.g., an image) of a page through these connections as opposed to opening a new connection for each object in the page. Typically, Ò. 1. Why is it difficult to implement persistent connections for CGI scripts and dynamic content in general? 3

2. Suppose you are downloading a page with Ñ large objects, ÑÒ, and a large number of small objects. The large objects appear first in the page and the client requests the objects in the order it finds them in the page. What problem does the persistent connections scheme pose in this situation? 3. Describe a simple client-side (i.e, in the browser) solution to avoid this problem. 5 telnet The telnet command is used to communicate with another host using the TELNET protocol. The TELNET protocol supports a virtual terminal and remote login service. Telnet is also an useful tool to test and debug services that use ASCII based protocols (e.g., HTTP, SMTP, FTP, etc). With telnet you can open a TCP connection to the port where the server is listening to and type in the corresponding protocol sequences or commands. To establish a session to a port other than the default TELNET port (i.e., 23), specify the port number after the host name of the machine you want to connect to. For example, to connect to the school s web server type: telnet www.cs.cmu.edu 80 Question: Use telnet to find the HTTP version and server-type of the following sites: Site HTTP version Server type www.cs.cmu.edu www.google.com www.cnn.com Alternatively, you could use a tool like netcat (nc). Unfortunately, netcat is not available in the Unix Andrew machines, for more information on netcat visit: www.atstake.com/research/tools 6 ifconfig ifconfig is used to configure the network interfaces. If no arguments are given, ifconfig displays the status of the currently active interfaces in some operating systems, in others it displays a help message. If a single interface argument is given, it displays the status of the given interface only. If a single -a argument is given, it displays the status of all interfaces, even those that are down. Question: Log on to unix4.andrew.cmu.edu, this is a Solaris machine. Run ifconfig -a. 1. How many network interfaces does ifconfig -a report? 2. What are the names of those interfaces? 3. What are the IP addresses of those interfaces? 7 nslookup The nslookup command is a program that is used to query Internet domain name servers (DNS). DNS is a distributed database that provides mappings between domain names and IP addresses. Use man nslookup to obtain more information about nslookup. Other tools to query DNS databases are dig and hosts. dig is a replacement tool for nslookup. hosts is a simpler tool to query the DNS databases. Refer to their respective man pages for information on how to use these tools. The following questions can be answered using either nslookup, dig or hosts. Log onto any UNIX Andrew machine and enter the command nslookup (If you are not sure of the path for this command, just type whereis nslookup ). The program will respond with the name of the name server it knows about and its IP address. The list of name servers used by the UNIX machine can usually be found by looking at the file /etc/resolve.conf. 4

1. Enter ux9.sp.cs.cmu.edu at the prompt. What is the IP address of ux9? 2. What is another name for the machine www-2.cs.cmu.edu? 3. How many IP addresses does www-2.cs.cmu.edu have? 4. List the IP addresses for www-2.cs.cmu.edu. 5. What does it mean that www-2.cs.cmu.edu has more than one address? 6. DNS also provides reverses mappings. What is the domain name for 128.2.185.143? 7. What are the names and IP addresses of the name servers in the andrew.cmu.edu domain? (Hint: you can change the record type of the query using the command set type=ns to tell nslookup that you want information on name servers). 8. When you send mail to somebody@acm.org, which machine does the mail go to? 9. What are the machines used to process mail sent to somebody@cmu.edu? 10. It is possible to query the default name server to ask it to display all the records it contains for a particular domain using the ls command. At the nslookup prompt, enter ls cs.cmu.edu. Approximately how many DNS entries (i.e., registered machines) are there in the cs.cmu.edu domain? (Hint: It is possible to redirect the output of the nslookup ls command by typing ls cs.cmu.edu > filename. Warning: For no good reason, when you redirect the output there must be a space after the character. That is, you must type ls... > filename and not ls... >file. Also, use the Unix command wc to count the number of lines in your output). 11. How many of the domain names from the previous question are Linux machines? (Hint: you need the HINFO records. Also, use grep). 8 dig The Andrew Solaris machines provide a program, dig, that also allows you to query DNS servers. For the purposes of this question, you should use the following format to invoke dig: dig +norecurse @<name.of.dns.server> <record-type> <domain-name> where <name.of.dns.server> is the host name of the DNS server you wish to query such as A.ROOT-SERVERS.NET. <record-type> is the type of DNS record you wish to retrieve, such as ANY, MX, HINFO, A,orSOA. <domain-name> is the name of the host or domain you seek information on. The DNS is a distributed architecture that uses hierarchical delegation. At the top of the system are the root name servers, who know which DNS server is responsible for each second-level domain (such as CMU.EDU). If you send a root server a query for a particular machine, you will receive a reply listing the servers that have been delegated authority for that machine s second-level domain. It is common for a large domain such as CMU.EDU to further delegate to departmental or workgroup DNS servers, which you discover by querying the second level servers. In order to discover the chain of delegation in use at AKAMAI, run a series of NS queries for A212G.AKAMAI.NET. You may wish to start with any of the root servers, and you should continue your sequence of queries until you stop getting new delegations (in some domains, this is indicated by a DNS server returning a delegation pointing to itself, and in other domains this is indicated by a DNS server returning a SOA record instead). The delegation chain for AOL.COM is shown in Figure 1. This was produced by running the following commands: 5

Server Queried B.ROOT-SERVERS.NET A.GTLD-SERVERS.NET DNS-01.NS.AOL.COM NS delegates to A.GTLD-SERVERS.NET DNS-01.NS.AOL.COM, DNS-02.NS.AOL.COM DNS-01.NS.AOL.COM, DNS-02.NS.AOL.COM Figure 1: Delegation chain for AOL.COM. dig +norecurse @b.root-servers.net NS aol.com dig +norecurse @a.gtld-servers.net NS aol.com dig +norecurse @dns-01.ns.aol.com NS aol.com Question: Generate the delegation chain for A212G.AKAMAI.NET. Fill in the table with your results. Each NS query will typically return two or more answers: choose among them at random. If you query a server and get a timeout, choose an alternate server. Server Queried NS delegates to 9 traceroute The program traceroute allows you to find out the path (i.e., sequence of routers) that a packet will follow to a specific destination. The routers along the path are often identified by name. For more information check traceroute s man page. You will be using traceroute again in a future homework. Question: use traceroute to find the number of hops from unix4.andrew.cmu.edu to the following destinations: Destination www.yahoo.com www.psc.edu www.upenn.edu # of hops 10 ping Unix ping utility sends ICMP (Internet Control Message Protocol) ECHO REQUEST packet to some network host and shows information about the host and the route between source and destination. There are two versions of ping program in the Andrew machines. Use /bin/ping on unix45.andrew.cmu.edu to answer the following questions. To obtain information about the parameters the tool accepts, type ping -h. Warning: The man page for ping on unix45 corresponds to the tool located in /usr/local/bin/ping. 1. What does the output mean? 2. Why does ping report RTT, instead of one-way delay? Using ping to characterize a link. It is possible to estimate the propagation delay and transmission rate of a link by sending packets of different sizes. Small packets are good to estimate the propagation delay. Large packets are good to estimate the transmission rate given that you have some information about the propagation delay. Ping has command line arguments to specify the size of the packets the tool sends. Use ping to estimate the propagation delay and transmission rate between the following routers: Router A with IP address 192.88.115.3 and Router B with IP address 12.124.235.73. You may assume that there are no processing or queuing delays. 6

3. Fill in the table below with the parameters you use and the output you get from ping. Packet Router Packet size # of packets RTT(ms) type (bytes) min avg max Small A B Large A B 4. What is the propagation delay of the link between Router A and Router B? 5. What is the transmission rate of the link between Router A and Router B? References [1] Michael J. Donahoo and Kenneth L. Calvert. TCP/IP sockets in C, Practical guide for programmers. Morgan Kaufmann, London, United Kingdom, 2001. [2] W. Richard Stevens. Networking APIs: Sockets and XTI, volume 1 of UNIX Network Programming. Prentice Hall, second edition, 1998. 7