EXERCISE - 1 Write a Program in C/ C++ for error detecting code using CRC-CCITT (16 bit)
Objective: To enable the receiver of a message transmitted through noisy channel to check whether the message has been corrupted. The aim of an error detection technique is to enable the receiver of a message transmitted through noisy channel to determine whether the message has been corrupted. To do this, the transmitter constructs a value called a checksum that is the function of message and appends it’s to message. The receiver can then use the same function to calculate the checksum of the received message and compare it with the appended checksum to see if the message was correctly received.
IMPLEMENTATION
Figure: Euclidean division algorithm The message is represented by a information polynomial i(x). i(x) is store as a bit pattern of k length in an integer array. The k information bits are represented by k-1 degree polynomial i(x) = i(k-1)x(k-1) + i(k-2)x(k-2) +……………………………..+i1x+i0 A polynomial code is specified by its generating polynomial g(x). If we assume that we are dealing with a code in which codewords have n bits of which k are information bits and n-k are check bits . The …show more content…
generator polynomial for such a code has degree n-k and has the form g(x) = x(n-k) + g(n-k-1)x(n-k-1) +……………………….+g1x+1 The generator polynomial chosen is CCITT-16 (x16+x12+x5+1). 1
CS601: Computer Networks lab
Encoding Procedure At Sender Steps 1) Multiply i(x) by x(n-k) by putting zeros in n-k low order positions 2) Divide x(n-k)i(x) by g(x) to get r(x). Use Euclidean division algorithm with a feedback shift register as shown in above figure x(n-k)i(x) = g(x) q(x) + r(x) where q(x) is quotient and r(x) is remainder 3) Add remainder r(x) to x(n-k)i(x) by putting check bits in n-k lower order positions 4) Based on randomness, the message can be transmitted with error or without error. 5) For transmission with error, introduce an error at random position to the message x(n-k)i(x) and display the position of the error. 6) Transmitted codeword is b(x) = x(n-k)i(x) + r(x) Decoding Procedure at the Receiver Steps 1) The received message b(x) is divided by g(x) using Euclidean division algorithm 2) If the remainder is 0 then there is no error in the transmission else Error in the transmission.
2
CS601: Computer Networks lab
EXERCISE - 2 Write a Program in C/ C++ for hamming code generation for error detection/correction
Objective: To Detect and Correct Single bit errors using Hamming Code. Hamming Code is used to detect and correct single bit error. The key to Hamming Code is the use of extra parity bits. Hamming code consists of k information bits and n-k check bits, where n is the total number of bits in the codeword. Parity bits are placed in positions having power of 2. IMPLEMENTATION (7,4) HAMMING CODE: The Hamming Code for 4-bits of data uses 3 redundant bits. Hamming Code for 4 data bits d4 is d4 b7 d3 b6 d2 b5 r3 b4 d1 b3 r2 b2 r1 b1...(position of bits in code) d3 d2 d1
where r1 r2 and r3 are redundant bits. PROCEDURE FOR DETERMINING REDUNDANT BITS: The ability of detecting and correcting errors of Hamming Code comes with the cost of redundant bits. These 3-bits are used to take care of all the 8 different possible states of transmitted 7-bits. The r-bits are determined using following equations: d1 = r1 + r2 | d2 = r1 + r3 | modulo-2 arithmetic d3 = r2 + r3 | d4 = r1 + r2 + r3 |
3
CS601: Computer Networks lab
These equations are further solved to calculate r-bits: r1 = d1 + d2 + d4 r2 = d1 + d3 + d4 r3 = d2 + d3 + d4
PROCEDURE FOR ERROR DETECTION AND CORRECTION: On the receiver side 3 position bits(p1-p3) are calculated: p1 = r1 + d1 + d2 + d4 p2 = r2 + d1 + d3 + d4 p3 = r3 + d2 + d3 + d4
These values indicate one of the eight possible states of received code: --------------------------------------------------------p3 p2 p1 state Action for correction --------------------------------------------------------0 0 0 No error -0 0 1 Error in b1 bit Flip b1 0 1 0 Error in b2 bit Flip b2 0 1 1 Error in b3 bit Flip b3 1 0 0 Error in b4 bit Flip b4 1 0 1 Error in b5 bit Flip b5 1 1 0 Error in b6 bit Flip b6 1 1 1 Error in b7 bit Flip b7 --------------------------------------------------------And d4-d1 bits after this operation are the actual transferred data bits.
Steps to execute the program At Sender: Code Formation: 1. 2. 3. 4. Get 4-bit(d4-d1) input Determine r-bits(r3-r1) using above equations Form the 7-bit Code by placing r-bits and d-bits in appropriate positions. Send the Code to Receiver
At receiver: Error Detection and Correction: 1. Determine position bits(p3-p1) using above equations 2. Use the Table to find the position of error(if present) and to take corrective action.
4
CS601: Computer Networks lab
EXERCISE - 3 Write a Program in C/ C++ for client server communication using TCP or IP sockets to make client send the name of the file and server to send back the contents of the requested file if present.
Objective: To Use TCP/IP sockets and write a client server program in which the client sends the file name in request message and the server sends back the contents of the requested file if present.
The Berkeley 4BSD series was an almost unbelievable advance in Unix development. Among the features it added were virtual memory, shared memory, and sockets. Sockets were added in 4.2BSD. Conceptually, Internet sockets on a Unix system look like a numbered array of interprocess communication channels -- so there is a socket 0, socket 1, socket 2, and so forth. They are used in a client-server relationship; a daemon wishing to provide a service creates a socket and listens to it; a client program connects to the socket and makes requests. The daemon is also able to send messages back to the client. Creating a Socket The socket system call is given below: s = socket(domain, type, protocol); The domain is either AF_UNIX or AF_INET. An AF_UNIX socket can only be used for interprocess communications on a single system, while an AF_INET socket can be used for communications between systems. The type specifies the characteristics of communication on the socket. SOCK_STREAM creates a socket that will reliably deliver bytes in-order, but does not respect messages boundaries; SOCK_DGRAM creates a socket that does respect message boundaries, but does not guarantee to deliver data reliably, uniquely or in order. A SOCK_STREAM socket corresponds to TCP; a SOCK_DGRAM socket corresponds to UDP The protocol selects a protocol. Ordinarily this is 0, allowing the call to select a protocol. This is almost always the right thing to do, though in some special cases you may want to select the protocol yourself. Remember that this refers to the underlying network protocol: such well-known protocols as http, ftp, and ssh are all built on top of tcp, so tcp is the right choice for any of those protocols. For example: s = socket(AF_INET, SOCK_STREAM, 0); will create a socket that will use TCP to communicate. The return value (s) is a file descriptor for the socket. 5
CS601: Computer Networks lab
Binding a Socket At this point created a socket, but name is not given to it. To give a name to the socket by using the bind system call: bind(s, name, namelen);
This call gives the socket a name. For an Internet socket, the name is a struct defined as struct sockaddr_in { sa_family_t sin_family; /* address family: AF_INET */ u_int16_t sin_port; /* port in network byte order */ struct in_addr sin_addr; /* internet address */ }; /* Internet address. */ struct in_addr { u_int32_t s_addr; };
/* address in network byte order */
sin_family is always AF_INET; sin_port is the port number, and sin_addr is the IP address. Port numbers below 1024 are reserved - that means only processes with an effective user id of 0 (ie the root) can bind to those ports. Listening to the Socket Once the socket has been created and bound, the daemon needs to indicate that it is ready to listen to it. It does this with the listen system call, as in listen(s, 5); The main thing this does is to set a limit on how many would-be clients can be queued up trying to connect to the socket (the limit in this example is 5). If the limit is exceeded the clients don't actually get refused, instead their connection requests get dumped on the floor. Eventually they will end up retrying. Accepting Connections The server is able to accept connections by calling accept: newsock = accept(s, (struct sockaddr *)&from, &fromlen); For this call, s is, as you'd expect the socket that was returned oh so long ago by the socket call. The accept() call blocks until the client connects to the socket. Connecting to the daemon
6
CS601: Computer Networks lab
A client connects to the socket using the connect call. First it creates a socket using the socket call, then it connects it to the daemon's socket using connect: connect(s, (struct sockaddr *)&server, sizeof(server)); This call returns a new socket. This means the daemon can communicate with the client using the newly created (and unnamed) socket, while continuing to listen on the old one. At this point, the server normally forks a child process to handle the client, and goes back to its accept loop. The child doing the communication can either use standard read and write calls, or it can use send and recv. These calls work like read and write, except that you can also pass flags allowing for some options. Sending Data There are a variety of functions that may be used to send outgoing messages. write() may be used in exactly the same way as it is used to write to files. This call may only be used with SOCK_STREAM type sockets. #include #include int write(int fd, char *msg, int len); fd is the socket descriptor. msg specifies the buffer holding the text of the message, and len specifies the length of the message. write() is similar to write() except that it writes from a set of buffers. This is called a gather write. This call may only be used with SOCK_STREAM type sockets. send() may be used in the same way as write(). The prototype is #include #include int send(int fd, char *msg, int len, int flags); fd is the socket descriptor. msg specifies the buffer holding the text of the message, and len specifies the length of the message. flags may be formed by ORing MSG_OOB and MSG_DONTROUTE. The latter is only useful for debugging. This call may only be used with SOCK_STREAM type sockets.
7
CS601: Computer Networks lab
Receiving Data There are a variety of functions that may be used to receive incoming messages. read() may be used in the exactly the same way as for reading from files. There are some complications with non-blocking reads. This call may only be used with SOCK_STREAM type sockets. #include #include int read(int fd, char *buff, int len) fd is the socket descriptor. buff is the address of a buffer area. len is the size of the buffer. readv() may be used in the same way as read() to read into several separate buffers. This is called a scatter read. This call may only be used with SOCK_STREAM type sockets. recv() may be used in the same way as read(). The prototype is #include #include int recv(int s, char *buff, int len, int flags) buff is the address of a buffer area. len is the size of the buffer. flags is formed by ORing MSG_OOB and MSG_PEEK allowing receipt of out of band data and allowing peeking at the incoming data. This call may only be used with SOCK_STREAM type sockets. Steps to execute the exercise Client side 1) sfd = Create a socket with the socket(….) system call 2) Connect the socket to the address of the server using the connect(sfd, …) system call. The IP address of the server machine and port number of the server service need to be provided. 3) Read file name from standard input by n = read(stdio, buffer, sizeof(buffer)) 4) Write file name to the socket using write (sfd, buffer, n) 5) Read file contents from the socket by m = read(sfd, buffer1, sizeof(buffer1)) 6) Display file contents to standard output by write( stdio, buffer1, m) 7) Go to step 5 if m>0 8) Close socket by close (sfd)
8
CS601: Computer Networks lab
Server side 1) sfd = Create a socket with the socket(…) system call 2) Bind the socket to an address using the bind (sfd, …) system call.
If not sure of machine IP address, keep the structure member s_addr to INADDR_ANY. Assign a port number between 3000 and 5000 to sin_port. 3) Listen for connections with the listen (sfd, …) system call 4) sfd = Accept a connection with the accept (sfd, …) system call. This call typically blocks until a client connects with the server. 5) Read the filename from the socket by n = read(sfd, buffer, sizeof(buffer)) 6) Open the file by fd = open(buffer) 7) Read the contents of the file by m = read(fd, buffer1, sizeof(buffer1)) 8) Write the file content to socket by write( sfd, buffer1, m) 9) Go to step 7 if m>0 10)
Close(sfd)
9
CS601: Computer Networks lab
EXERCISE - 4 Write a Program in C/ C++ for congestion control using Leaky Bucket algorithm
Objective: To demonstrate Congestion Control using Leaky Bucket Leaky bucket is a traffic-shaping algorithm implemented by the sender in a network. The algorithm provides for a steady data transmission rate irrespective of the variation in data generation rate. The program for implementation leaky bucket algorithm can be viewed in two parts 1. Generation of data in variable bursts. 2. Data transmission at a constant rate. Leaky bucket can be implemented using a circular queue to hold data before it can be transmitted. The size of the circular queue is the size of the bucket size. The data generated from the process is inserted into the queue. When the queue is full, the generated data is discarded. Data get removed from the queue in FIFO fashion. By using interval timers, generate data in random bursts and store them to bucket. Using timers data from the bucket can be transmitted at a constant rate periodically. Setitimer API is use to set interval timers to the process to carry out the above functions. The API is defined in sys/time.h header file. Setitimer API prototype: int setitimer (int which, const struct itimerval *val, struct itimerval *old); Setitimer allows up to three timers to be set for a process, and offers a resolution time in microseconds. Expiry of the timer generates signal determined by the ‘which’ argument in the API that can be either TIMER_REAL (SIGALRM) or TIMER_VIRTUAL (SIGVTALRM) or TIMER_PROF (SIGPROF). We can use the API to set two timers, for generating data and for transmitting data. When the timers go off respective actions associated with the signal handler are called to perform the operations. For generating random burst of data we use the random () function when the timer associated with data generation goes off. Socket programming or FIFO files can be use to transmit data to the receiver.
10
CS601: Computer Networks lab
Steps to execute the program: Main function 1. Establish connection from Sender to Receiver using socket programming or FIFO files. 2. Associate Send_data procedure to handle SIGALRM signal 3. Associate Generate_data procedure to handle SIGVTARLM signal. 4. Set the timer values for ITIMER_REAL timer and ITIMER_VIRTUAL timer in microseconds. 5. Set up the two timers using setitimer API. 6. WHILE TRUE DO a. wait for timers to go off periodically
Generate_data function: 1. Generate a packet. 2. IF bucket (queue) is full DO Discard the packet generated. ELSE Insert the generated data into the bucket (queue).
Send_data function: 1. IF bucket (queue) not empty a. Remove data form bucket (queue). b. Send the removed data to the receiver. ELSE Display ‘Bucket empty’.
11
CS601: Computer Networks lab
OPNET Introduction
Basics of OPNET IT Guru Academic Edition Objective OPNET stands for Optimized Network Engineering Tools. OPNET IT Guru Academic Edition enables students to better understand the core concepts of networking and equips them to effectively troubleshoot and manage realworld network infrastructures. Overview OPNET’s IT Guru provides a Virtual Network Environment that models the behavior of your entire network, including its routers, switches, protocols, servers, and individual applications. By working in the Virtual Network Environment, IT managers, network and system planners, and operations staff are empowered to diagnose difficult problems more effectively, validate changes before they are implemented, and plan for future scenarios including growth and failure. OPNET's Application Characterization Environment (ACE) module for IT Guru enables enterprises to identify the root cause of end-to-end application performance problems and to solve them cost-effectively by understanding the impact of changes. The labs in this manual are implemented with OPNET IT Guru Academic Edition release 9.1. OPNET software can be downloaded from www.opnet.com/itguru-academic/mk-setup.html Start OPNET IT Guru Academic Edition To start OPNET IT Guru Academic Edition: 1. Click on Start ⇒ Programs ⇒ OPNET IT Guru Academic Edition 9.1. 2. Read the Restricted Use Agreement and if you agree, click I have read this SOFTWARE AGREEMENT and I understand and accept the terms and conditions described herein. Now you should see the starting window of OPNET IT Guru Academic Edition as shown:
12
CS601: Computer Networks lab
OPNET IT Guru: IT Guru is a product which is sold with OPNET modules to provide solutions in the areas of application performance analysis, network configuration analysis, and predictive capacity planning with network, application, server, and mainframe models. System Requirements: Intel Pentium III, 4 or compatible (500 MHz or better) 256 MB RAM 400 MB disk space Display: 1024x768 or higher resolution, 256 or more colors The English language versions of the following operating systems are supported: Microsoft Windows NT (Service Pack 3, 5, or 6a (Service Packs 4 and 6 are not supported)), Windows 2000 (Service Pack 1 and 2 are supported but not required), Windows XP (Service Pack 1 is required).
13
CS601: Computer Networks lab
How to install OPNET IT Guru Academic Edition? 1. If your computer meets the system requirements, shown above, then download the software from: a. https://enterprise37.opnet.com/4dcgi/SIGNUP_NewUserOther 2. Complete the form. 3. You will get an email containing a username and password and a link for downloading the software ( http://www.opnet.com/itguruacademic/download.html). Follow the instructions on the website for downloading the software. 4. After downloading the software, double-click on the file, ITG_Academic_Edition_v1992, which you just downloaded. 5. Follow the on screen instructions to install the software. Check the OPNET Preferences The OPNET Preferences let you display and edit environment attributes, which control program operations. 1. After starting OPNET, from the Edit menu, choose Preferences. 2. The list of environment attributes is sorted alphabetically according to name. You can locate attributes faster by typing any part of the attribute’s name in the Find field. 3. Check the value of the license_server attribute. It has the name of the License Server’s host. If IT Guru is getting its license from the local host (i.e., the computer on which the software was installed), the value of license_server should be localhost as shown in the following figure.
14
CS601: Computer Networks lab
4. Set the license_server_standalone attribute to TRUE. This attribute specifies whether the program acts as its own license server. 5. A model directory is a directory that contains OPNET model files. If the directory is listed in the mod_dirs environment attribute, then OPNET programs will use the models in that directory. Check the value of the mod_dirs attribute. The first directory in the list is where your own models will be saved. In the future you might need to access that directory to back up, copy, or move your models. IT Guru saves numerous files for every single project you create. 6. Click OK to close the dialog box. Workflow model of IT Guru
Overview
The steps you use to build a network model and run simulations centers around the Project Editor. In this editor, you can create a network model, choose statistics to collect from each network object or from the whole network, execute a simulation, and view results.
Guru Fig:- Workflow of OPNET IT Guru 6 The Project Editor The Project Editor is the main staging area for creating a network simulation. From this editor, you can build a network model using models from the standard library, choose statistics about the network, run a simulation, and view the results. 15
CS601: Computer Networks lab
Fig:- A Network Model in the Project Editor The Project Editor Window There are several areas in the Project Editor window that are important for building and executing a model. 7 When you open an existing project, your screen should look similar to the following figure.
About IT Guru 8 16
CS601: Computer Networks lab
The Menu Bar The menu bar is at the top of the editor window. It organizes all the non-context-sensitive editor operations into a set of topical menus. The number of menus and menu operations available change according to the product modules that are enabled. Context-sensitive editor operations are available by right-clicking on an object or on the background of the workspace. About IT Guru Tool Buttons Several of the more commonly used menu bar selections can also be activated through tool buttons. The buttons shown in the following figure appear in the Project Editor: 3 4 5 6 7 8 9 10 About IT G
The Workspace The central, scrollable region of the editor window is the workspace. The network model appears in the workspace, where you can select and drag network objects, and choose context-sensitive menu operations by right-clicking on the background. The Message Area The message area is located at the bottom of the editor window. It provides information about the status of the tool. Message Area You can left-click on the icon next to the message area to open the message buffer window. The message buffer window shows a list of messages that have appeared in the message area. You can open the message buffer window if part of the message line is truncated in the message area or if you think a later message has replaced an important alert or notification. About IT Guru
17
CS601: Computer Networks lab
Tooltips If you rest the cursor over a tool button or a network object in the workspace, a help balloon appears. The tooltip describes one of the following: • The action that occurs if the button is pressed • Information about the network object
18
CS601: Computer Networks lab
EXERCISE - 5 OPNET- Small Internetworks.
Objective : To plan for the expansion of a small company’s intranet ( i.e to ensure that the load added by the second network will not cause the existing network to fail) by analyzing the packet dropped and load on the Server. In this exercise, you plan for the expansion of a small company’s intranet. Currently, the company has a star topology network on the first floor of its office building and plans to add an additional star topology network on another floor. You will build and test this “what-if” scenario to ensure that the load added by the second network will not cause the network to fail.
19
CS601: Computer Networks lab
Getting Started When creating a new network model, you must first create a new project and scenario. A project is a group of related scenarios that each explore a different aspect of the network. Projects can contain multiple scenarios. After you create a new project, you use the Startup Wizard to set up a new scenario. The options in the Wizard let you • Define the initial topology of the network • Define the scale and size of the network • Select a background map for the network. • Associate an object palette with the scenario Startup Wizard automatically appears each time you create a new project. The Startup Wizard allows you to define certain aspects of the network environment. To use the Startup Wizard to set up a new scenario, do the following: 1. If IT Guru is not already running, start it. 2. Select File > New.... 3. Select Project from the pull-down menu and click OK. 4. Name the project and scenario, as follows: a. Name the project _Sm_Int Include your initials in the project name to distinguish it from other versions of this project. b. Name the scenario first_floor. c. Click OK. The Startup Wizard opens. 5. Enter the values shown in the following table in the dialog boxes of the Startup Wizard:
20
CS601: Computer Networks lab
A workspace of the size you specified is created. The object palette you specified opens in a separate window.
Creating the Network Network models are created in the Project Editor using nodes and links from the object palette. Node - A representation of a real-world network object that can transmit and receive information.
Link - A communication medium that connects nodes to one another. Links can represent electrical or fiber optic cables.
These objects are found in the object palette, a dialog box that contains graphical representations of node and link models. Creating the Network 7 You can use any of three methods to create a network topology, or a combination of all three. One method is to import the topology. Another is to place individual nodes from the object palette into the workspace. The third method is to use Rapid Configuration. Rapid Configuration creates a network in one action after you select a network configuration, the types of nodes within the network, and the types of links that connect the nodes.
21
CS601: Computer Networks lab
Rapid Configuration creates a network in one action after you select a network configuration, the types of nodes within the network, and the types of links that connect the nodes. To create the first-floor network using Rapid Configuration: 1. Select Topology > Rapid Configuration. 2. Select Star from the drop-down menu of available configurations, then click OK....
Specify the node models and link models in the network. Models follow this naming scheme: _...___ where: • specifies the specific protocol(s) supported by the model • is an abbreviation of the general function of the model • indicates the level of derivation of the model For example: ethernet2_bridge_int specifies the intermediate (int) derivation of a 2-port Ethernet (ethernet2) bridge (bridge). Vendor models have an additional prefix that specifies the vendor and the vendor product number for that particular network object. For example, the 3Com switch used is named: 3C_SSII_1100_3300_4s_ae52_e48_ge3 This node is a stack of two 3Com SuperStack II 1100 and two Superstack II 3300 chassis (3C_SSII_1100_3300) with four slots (4s), 52 auto-sensing Ethernet ports (ae52), 48 Ethernet ports (e48), and 3 Gigabit Ethernet ports (ge3). To specify the nodes and links to use to build the network: 1. Set the Center Node Model to 3C_SSII_1100_3300_4s_ae52_e48_ge3. This is a 3Com switch. 22
CS601: Computer Networks lab
2. Set the Periphery Node Model to Sm_Int_wkstn, and change the Number of periphery nodes to 30. This provides 30 Ethernet workstations as the peripheral nodes. 3. Set the Link Model to 10BaseT Specify where the new network will be placed: 1. Set the X center and Y center to 25. 2. Set the Radius to 20.
3. Click OK. ➥ The network is drawn in the Project Editor:
23
CS601: Computer Networks lab
Now that the general network topology has been built, you need to add a server. You will use the second method of creating network objects: dragging them from the object palette into the workspace. 1. If it is not already open, open the object palette by clicking on the Object Palette action button. 2. Find the Sm_Int_server object in the palette and drag it into the workspace. By default, you can create additional instances of the same object by left-clicking after the initial “drag-and-drop” from the palette. 3. Because you do not need additional copies of this model, right-click to turn off node creation.
You also need to connect the server to the star network. 1. Find the 10BaseT link object in the palette and click on it. 2. Click on the server object, then click on the switch object in the center of the star. ➥ A link is drawn, connecting the two objects. 3. Right-click to turn off link creation. Finally, you need to add configuration objects to specify the application traffic that will exist on the network. For this exercise there is: an application definition object with the default configurations of the standard applications, and a profile definition object with a profile that models light database access Creating the Network 14 You need only drag the objects into your network. Doing so means that the traffic caused by workstations accessing a database at a low rate will be modeled. 1. Find the Sm_Application_Config object in the palette and drag it into the workspace 2. Right-click to turn off object creation. 3. Find the Sm_Profile_Config object in the palette, drag it into the workspace, and right- click. 4. Close the object palette. The network is now built and should look similar to the following figure. 24
CS601: Computer Networks lab
You are now ready to begin collecting statistics. Collecting Statistics Collecting Statistics You can collect statistics from individual nodes in your network (object statistics) or from the entire network (global statistics). You should get a snapshot of current performance for comparison. To get this baseline, you will collect one object statistic, Server Load, and one global statistic, Ethernet Delay. Server load is a key statistic that reflects the performance of the entire network. To collect statistics related to the server’s load, do the following steps: 1. Right-click on the server node (node_31) and select Choose Individual Statistics from the server’s Object pop-up menu. ➥ The Choose Results dialog box for node_31 appears. The Choose Results dialog box hierarchically organizes the statistics you may collect. To collect the Ethernet load on the server: 2. Click the plus sign next to Ethernet in the Choose Results dialog box to expand the Ethernet statistic hierarchy.
25
CS601: Computer Networks lab
a. 3. Click the checkbox next to Load (bits/sec) to enable collection for that statistic. 4. Click OK to close the dialog box. 5. Collecting Statistics 19 Global statistics can be used to gather information about the network as a whole. For example, you can find out the delay for the entire network by collecting the global Delay statistic: 1. Right-click in the workspace (but not on an object) and select Choose Individual Statistics from the Workspace pop-up menu.
26
CS601: Computer Networks lab
2. 3. 4. 5.
Expand the Global Statistics hierarchy. Expand the Ethernet hierarchy.0 Click the checkbox next to Delay (sec) to enable data collection. Click OK to close the Choose Results dialog box.
To save the project: Choose File > Save, then click OK (the project already has a name, so you don’t need to rename it). Now that you have specified which statistics to collect and saved the project, you are almost ready to run your simulation. First, though, verify that your repositories preference is set. Repositories contain userdefined components such as process models and pipeline stages that are saved so that simulations will take less time to begin execution. 1. Choose Edit > Preferences. 2. Type repositories in the Find field and click on the Find button. 3. If the value for repositories is not stdmod, click on the field and enter stdmod in the dialog box. 4. Click OK to close the repositories and Preferences dialog boxes 5. To run a simulation:
1. Select Simulation > Configure Discrete Event Simulation…. You can also
open the Configure Discrete Event Simulation dialog box by clicking on the
configure/run simulation action button.
2. Type 0.5 in the Duration: field to simulate one-half hour of network activity.
27
CS601: Computer Networks lab
3. Click the Run button to begin the simulation. 4. While the simulation runs, a dialog box appears showing the simulation’s
progress.
The dialog box above shows that, in 5 seconds of elapsed (actual) time, IT Guru has simulated 15 minutes and 19 seconds of network time. The entire simulation should take less than one minute to complete—the elapsed time varies according to the speed of your computer. When the simulation finishes, the contents of the Messages tab appears. Click the Close button in the Simulation Sequence dialog box. Elapsed Time: Number of seconds the simulation has run Simulated Time: Minutes of network time
5.
If your simulation does not complete, if no results were collected, or if the results vary significantly from those shown.
Viewing Results You can view results graphically in the Project Editor by selecting View Results from the Workspace pop-up menu. After your simulation has executed, you will want to see the information collected for each statistic. There are several ways to view results; in this lesson you will use the View Results option in the Workspace pop-up menu. 28
CS601: Computer Networks lab
To view the server Ethernet load for the simulation: 1. Right-click on the server node (node_31) choose View Results from the server’s Object pop-up menu. ➥ The node’s View Results dialog box opens. 2. Expand the Office network.node_31 > Ethernet hierarchy. 3. Click on the checkbox next to Load (bits/sec) to indicate that you want to view that result. 4. Click the Show button in the View Results dialog box. ➥ The graph of the server load appears in the Project Editor, as shown in the following figure. The graph of the server load should resemble the following graph.
Note that at its peak, the load on the server is well below 6,000 bits/second. You will need this baseline for comparison after you add the second network. When you finish viewing the server load graph, close this dialog box and the View Results dialog box. (If the system prompts you, choose to delete the graph panel.) You also should look at the Global Ethernet Delay on the network. To view this statistic: 1. Right-click in the workspace, then select View Results from the pop-up menu. 29
CS601: Computer Networks lab
2. Check the box next to Global Statistics > Ethernet > Delay, then click the Show button to view the Ethernet delay for the whole network.
The Ethernet delay graph appears in the Project Editor. The graph should resemble the following figure.
30
CS601: Computer Networks lab
Note that after the network reaches steady state the maximum delay is around 0.4 milliseconds. When you are finished viewing the graph, close it and the View Results dialog box. Simulation time, in minutes Seconds Expanding the Network 29 Expanding the Network You have created a baseline network and gathered statistics about it. Now you are ready to expand the network and verify that it still operates sufficiently well with the additional load. When performing a “what-if” comparison, it is convenient to store the baseline network as one scenario and create the experimental network as a different scenario. You will duplicate the existing scenario and make changes to it instead of building the new topology from the beginning. To duplicate a scenario: 1. Choose Scenarios > Duplicate Scenario... 2. Enter expansion as the name for the new scenario. 3. Click OK.➥ The scenario, with all the nodes, links, statistics, and the simulation configuration, is duplicated and named expansion.The second-floor segment will resemble the first-floor segment, but will not have a server of its own. To build the new segment: Select Topology > Rapid Configuration. Choose Star for the topology and click OK... Complete the Rapid Configuration dialog box with these values: Center Node Model: 3C_SSII_1100_3300_4s_ae52_e48_ge3 Periphery Node Model: Sm_Int_wkstn Number: 15 Link model: 10BaseT X: 75, Y: 62.5, Radius: 20
31
CS601: Computer Networks lab
4. Click OK to create the network.
Join the two networks: 1. If it is not already open, click the action button to open the object palette. 2. Drag the Cisco 2514 router icon into the workspace between the two networks. Right-click to turn off node creation. 3. Click on the 10BaseT link icon in the object palette. 4. Create 10BaseT links between the Cisco router (node_50) and the 3Com switches at the center of each star. 5. Right-click to turn off link creation. 6. Close the object palette.Select File > Save. The final network should look like this:
32
CS601: Computer Networks lab
To run the expansion scenario: 1. Select Simulation > Configure Discrete Event Simulation…. 2. Verify that the Duration is set to 0.5 hours.33 3. Click the Run button to begin the simulation.
As before, a window appears showing the simulation’s progress. When the Simulation Speed tab is selected, an animated graph shows both the current and average speed in events per second. 4. When the simulation is done, close the Simulation Sequence dialog box. Comparing Results 34 Comparing Results To answer the questions posed about the addition of a second network to the existing LAN, you need to compare the results from both of the simulations you ran. You will use the Compare Results menu item in the Object and Workspace pop-up menus to combine statistics from different scenarios in the same graph. To look at the server load from both scenarios at once: 1. Right-click on the server node (node_31) to bring up its Object pop-up menu. 2. Choose Compare Results (you can do this from either scenario in the project). 33
CS601: Computer Networks lab
A View Results dialog box appears containing a hierarchical representation of statistics collected for the server node. When comparing results, choosing a statistic in one scenario produces a graph showing the value of that statistic in all scenarios. To view the results: Select the Office Network.node_31 > Ethernet > Load (bits/sec) statistic and click the Show button. Your results should resemble those in the following figure (but may not be identical):
The following graph is the time average of the Ethernet load between the baseline (first_floor) scenario and the expansion scenario. .
34
CS601: Computer Networks lab
Note that while the average load for the expansion scenario is higher (as expected), the load as a whole appears to be leveling off (that is, not monotonically increasing), indicating a stable network. Comparing Results The last step is to see how much the network’s delay is affected by adding a second floor. To compare Ethernet delay for the two scenarios: 1. Close the graph and the Compare Results dialog box for the server. 2. Right-click in the workspace, then select Compare Results from the Workspace pop-up menu. 3. Select the Global Statistics > Ethernet > Delay (sec) statistic. 4. Click Show to display the graph. ➥ The graph of the Global Ethernet Delay appears. Your graph of Ethernet Delay should resemble the following:
35
CS601: Computer Networks lab
This graph shows that there is no significant change in Ethernet delay on the network. Although server load has increased, delay has not. 5. Select File > Close and save changes before closing.
36
CS601: Computer Networks lab
EXERCISE - 6 OPNET- Simulate three nodes point-to-point networks with duplex links between them. Set the queue size and vary the bandwidth and find the number of packets dropped.
Objective: To Simulate a 3 node point to point network with duplex links between them. Set the Queue size and vary the bandwidth and find the number of packets dropped.
Solution:
Step 1: Create a New Project Step 2: Create the Network Select Object Palette box. Select Client_server from drop down menu.
Choose eth4_slip4_multihomed_client objects (3 numbers). Choose Application Config, and Profile Config objects. Select ethernet from Object Palette. Choose 10baseT link and connect the client nodes. (as shown in Fig 2.) Close the Object Palette box.
37
CS601: Computer Networks lab
Fig 2. Point-to-Point Network Step 3: Configure the Network Application Select Application config object. Right click and select Edit Attributes.
38
CS601: Computer Networks lab
Select Application Definitions => set row = 1. In row go to row0 => set Name = video. Select description => set Video Conferencing = High Resolution Video. Click Ok.
Step 4: Configure the Profile Select Profile config object. Right click and select Edit Attributes. Select Profile Configuration. Set row = 1. In row0, set Profile Name = video profile. Select Applications. Set row=1.Go to row0 set Name = video, Start Time Offset to constant(1), in Repeatability, Inter Repetition Time to exponential(0.1) and Number of Repetition to unlimited and Repitation Pattern to concurrent. In Repeatability, Inter Repetition Time to constant (1) and Number of Repetition to exponential (0.1) and Repitation Pattern to concurrent. Click Ok. For any ambiguity in the above steps, please refer to the diagram below.
39
CS601: Computer Networks lab
Step 5: Configure Network Objects Select any eth4_slip4_multihomed_client. Right click and Select Similar Nodes. Right click and select Edit Attributes. Select Application Support Profiles => set rows to 1. In rows => go to row0 => set Profile Name = video profile. Select Application Support Services. Select edit => set rows =1. Set Name = video for that row.
Select IP Processing Information => set Memory Size to 8MB => set Datagram Forwarding Rate to 5000. 40
CS601: Computer Networks lab
Check Apply Changes to Selected Objects. Click Ok.
Step 6: Selecting Statistics for viewing results Right click on the work space and select choose individual statistics => in Global Statistics go to IP, select traffic dropped. In Node Statistics => select IP =>Traffic Dropped (Packets/Sec), Traffic Received (Packets/Sec) and Traffic Sent (Packets/Sec). Click Ok. Step 7: Run the simulation Click run simulation icon from the toolbar. Set the Duration to 10 seconds. Click Run. Step 8: View Results Right click on the work space and select View Results. Select the statistics from the View Results. Select Sample Sum instead of As Is. Click Show button to view the graphs.
41
CS601: Computer Networks lab
42
CS601: Computer Networks lab
To Vary Bandwidth and Queue Size:
1. Select Duplicate Scenario from Scenario menu. Name the scenario. 2. You can vary the queue size and bandwidth by changing the values of Memory size and Datagram Forwarding Rate as in Step 5 of the procedure above. Change it to 16 Mb and 10000 respectively. 3. Run the Simulation. You can compare the results by clicking on Compare Results from the Results menu. Ideally the number of packets dropped must be less and should resemble this graph.
43
CS601: Computer Networks lab
EXERCISE - 7 OPNET - Switched LANs -A Set of Local Area Networks interconnected by Switches Objective
Objective: To examine the performance of different implementations of local area networks connected by switches and hubs using OPNET. Overview To set up switched LANs using two different switching devices: hubs and switches. To study how the throughput and collision of packets in a switched network are affected by the configuration of the network and the types of switching devices that are used.
Create a New Project 1. Start the OPNET IT Guru Academic Edition. Choose New from the File menu. 2. Select Project and click OK. Name the project _SwitchedLAN, and the scenario OnlyHub. Click OK. 3. In the Startup Wizard: Initial Topology dialog box, make sure that Create Empty Scenario is selected .Click Next. Choose Office from the Network Scale list Click Next three times. Click OK. 4. Close the Object Palette dialog box. Create the Network To create our switched LAN: 1. Select Topology Rapid Configuration. From the drop-down menu choose Star and click OK. 2. Click the Select Models button in the Rapid Configuration dialog box. From the Model List drop-down menu choose ethernet and click OK. 3. In the Rapid Configuration dialog box, set the following five values: Center Node Model = ethernet16_hub, Periphery Node Model = ethernet_station, LinkModel = 10BaseT, Number=16, X=50, Y=50, and Radius = 42 ⇒ Click OK.
44
CS601: Computer Networks lab
Note: 1. 2. The 10BaseT link represents an Ethernet connection operating at 10 Mbps. The prefix ethernet16 indicates that the device supports up to 16 Ethernet connections.
1. Right-click on node_16, which is the hub ⇒ Edit Attributes ⇒ Change the name attribute to Hub1 and click OK. 2. Now that you have created the network, it should look like the following one.
3. Make sure to save your project.
45
CS601: Computer Networks lab
Configure the Network Nodes Here you will configure the traffic generated by the stations. 1. Right-click on any of the 16 stations (node_0 to node_15) ⇒ Select Similar Nodes. Now all stations in the network are selected. 2. Right-click on any of the 16 stations ⇒ Edit Attributes. a. Check the Apply Changes to Selected Objects check box. This is important to avoid reconfiguring each node individually. 3. Expand the hierarchies of the Traffic Generation Parameters attribute and the Packet Generation Arguments attribute ⇒ Set the following four values:
4. Click OK to close the attribute editing window(s). Save your project. Choose Statistics To choose the statistics to be collected during the simulation: 1. Right-click anywhere in the project workspace and select Choose Individual Statistics from the pop-up menu. 2. In the Choose Results dialog box, choose the following four statistics:
46
CS601: Computer Networks lab
3. Click OK. Configure the Simulation Here we need to configure the duration of the simulation: 1. Click on the Configure/Run Simulation button: 2. Set the duration to be 2.0 minutes. 3. Click OK. Duplicate the Scenario The network we just created utilizes only one hub to connect the 16 stations. We need to create another network that utilizes a switch and see how this will affect the performance of the network. To do that we will create a duplicate of the current network: 1. Select Duplicate Scenario from the Scenarios menu and give it the name HubAndSwitch ⇒ Click OK. 2. Open the Object Palette by clicking on . Make sure that Ethernet is selected in the pull-down menu on the object palette. 3. We need to place a hub and a switch in the new scenario. (They are circled in the following figure.)
47
CS601: Computer Networks lab
4. To add the Hub, click its icon in the object palette ⇒ Move your mouse to the workspace ⇒ Click to drop the hub at a location you select. Right-click to indicate you are done deploying hub objects. 5. Similarly, add the Switch 6. Close the Object Palette. 7. Right-click on the new hub ⇒ Edit Attributes ⇒ Change the name attribute to Hub2 and click OK. 8. Right-click on the switch ⇒ Edit Attributes ⇒ Change the name attribute to Switch and click OK. 9. Reconfigure the network of the HubAndSwitch scenario so that it looks like the following one.
Hints: a. b. To remove a link, select it and choose Cut from the Edit menu (or simply hit the Delete key). You can select multiple links and delete all of them at once. To add a new link, use the 10BaseT link available in the Object Palette.
48
CS601: Computer Networks lab
10. Save your project. Run the Simulation To run the simulation for both scenarios simultaneously: 1. Select Manage Scenarios from the Scenarios menu.
2. Change the values under the Results column to (or ) for both scenarios. Compare to the following figure.
3. Click OK to run the two simulations. Depending on the speed of your processor, this may take several minutes to complete. 4. After the two simulation runs complete, one for each scenario, click Close. 5. Save your project. View the Results To view and analyze the results: 1. Select Compare Results from the Results menu. 49
CS601: Computer Networks lab
2. Change the drop-down menu in the lower-right part of the Compare Results dialog box from As Is to time_average, as shown.
3. Select the Traffic Sent (packets/sec) statistic and click Show. The resulting graph should resemble the one below. As you can see, the traffic sent in both scenarios is almost identical.
50
CS601: Computer Networks lab
4. Select the Traffic Received (packets/sec) statistic and click Show. The resulting graph should resemble the one below. As you see, the traffic received with the second scenario, HubAndSwitch, is higher than that of the OnlyHub scenario.
5. Select the Delay (sec) statistic and click Show. The resulting graph should resemble the one below. (Note: Result may vary slightly due to different node placement.) 51
CS601: Computer Networks lab
6. Select the Collision Count statistic for Hub1 and click Show. 7. On the resulting graph right-click anywhere on the graph area ⇒ Choose Add Statistic ⇒ Expand the hierarchies as shown below ⇒ Select the Collision Count statistic for Hub2 ⇒ Change As Is to time_average ⇒ Click Add.
8. The resulting graph should resemble the one below. 52
CS601: Computer Networks lab
9. Save your project.
Exercise Questions
1) Explain why adding a switch makes the network perform better in terms of throughput and delay. 2) We analyzed the collision counts of the hubs. Can you analyze the collision count of the “Switch”? Explain your answer. 3) Create two new scenarios. The first one is the same as the OnlyHub scenario but replace the hub with a switch. The second new scenario is the same as the HubAndSwitch scenario but replace both hubs with two switches, remove theold switch, and connect the two switches you just added together with a 10BaseT link. Compare the performance of the four scenarios in terms of delay, throughput, and collision count. Analyze the results. ( Note: To replace a hub with a switch, right-click on the hub and assign ethernet16_switch to its model attribute.)
53
CS601: Computer Networks lab
EXERCISE - 8
OPNET Simulate a Ethernet LAN using N nodes and set multiple traffic nodes and determine the collisions across different nodes. Solution: Step 1: Create a New Project Step 2: Create the Network Select Object Palette box. Select Intenet toolbox from drop down menu. Choose Application config, profile Config, four ethernet_wkstn, one ethernet_server, and one ethernet16 hub(from Ethernet menu). Connect the Ethernet workstation and the Ethernet server to the Ethernet16 hub using bidirectional 10Base_T links as shown below.
Step 3: Configure the Network Application Select Application config object. Right click and select Edit Attributes.
54
CS601: Computer Networks lab
Step 4: Configure the Profile Select Profile config node. Right click and select Edit Attributes.
Please Note: Be careful to set Start Time as Constant 1, otherwise you would get a blank graph. 55
CS601: Computer Networks lab
Step 5: Configure Network Objects Configuring the Ethernet work station for supporting profiles:
Configuring the node 2 for voice service support
Configuring the server to support the FTP service 56
CS601: Computer Networks lab
Step 6: Selecting Statistics for viewing Right click on the work space and select choose individual statistics => in Node Statistics go to Ethernet select Collision Count Click Ok. Step 7: Run the simulation Click run simulation icon from the toolbar. Set the Duration to 20 seconds. Click Run.
Step 8: View Results Right click on the work space and select View Results.
57
CS601: Computer Networks lab
58
CS601: Computer Networks lab
Choose Overlaid Statistics instead of Stacked Statistics. Select the collision counts of all nodes. Choose Histogram( Sample distribution) instead of As Is. Press Show you will be prompted for sampling interval. Enter 50.
You should get a graph similar to this.
F r e q u e n c y
Result Interpretation: This shows that for all other nodes the collision count is less compared to the server. This is because the FTP application uses TCP and therefore demands retransmission whereas the voice application uses UDP and retransmission is not required. This graph shows that less than 50 collisions were recorded around 80 times for the nodes (except node 4). However around 150-200 collisions was recorded around 50 times for node 4. Hence we can say that TCP traffic faces high collision per packet in a n/w compared to UDP per packet.
59
CS601: Computer Networks lab
EXERCISE - 9 OPNET - RIP - Routing Information Protocol - A Routing Protocol Based on the Distance-Vector Algorithm Objective
Objective: To configure and analyze the performance of the Routing Information Protocol (RIP) model. Overview To set up a network that utilizes RIP as its routing protocol. You will analyze the routing tables generated in the routers, and you will observe how RIP is affected by link failures.
Create a New Project
1. Start OPNET IT Guru Academic Edition ⇒ Choose New from the File menu. 2. Select Project and click OK ⇒ Name the project _RIP, and the scenario NO_Failure ⇒ Click OK. 3. In the Startup Wizard: Initial Topology dialog box, make sure that Create Empty Scenario is selected ⇒ Click Next ⇒ Select Campus from the Network Scale list ⇒ Click Next three times ⇒ Click OK. Create and Configure the Network Initialize the Network: 1. The Object Palette dialog box should now be on top of your project workspace. If it is not there, open it by clicking . Make sure that the internet_toolbox is selected from the pull-down menu on the object palette. 2. Add to the project workspace the following objects from the palette: one ethernet4_slip8_gtwy router and two 100BaseT_LAN objects. a. To add an object from a palette, click its icon in the object palette ⇒ Move your mouse to the workspace ⇒ Click to place the object ⇒ Rightclick to stop creating objects of that type.
60
CS601: Computer Networks lab
3. Use bidirectional 100BaseT links to connect the objects you just added as in the following figure. Also, rename the objects as shown (right-click on the node ⇒ Set Name). 4. Close the Object Palette dialog box. 5. Save your project.
Note The ethernet4_slip8_gtwy node model represents an IP-based gateway supporting four Ethernet hub interfaces and eight serial line interfaces. IP packets arriving on any interface are routed to the appropriate output interface based on their destination IP address. The Routing Information Protocol (RIP) or the Open Shortest Path First (OSPF) protocol may be used to dynamically and automatically create the gateway's routing tables and select routes in an adaptive manner.
Configure the Router: 1. Right-click on Router1 ⇒ Edit Attributes ⇒ Expand the IP Routing Parameters hierarchy and set the following: i. Routing Table Export = Once at End of Simulation. This asks the router to export its routing table at the end of the simulation to the simulation log.
2. Click OK and then save your project. Add the Remaining LANs: 1. Highlight or select simultaneously (using shift and left-click) all five objects that you currently have in the project workspace (one router, two LANs, and two links). You can click-and-drag a box around the objects to do this. 2. Press Ctrl+C to copy the selected objects and then press Ctrl+V to paste them. 3. Repeat step 2 three times to generate three new copies of the objects and arrange them in a way similar to the following figure. Rename all objects as shown. 4. Connect routers, as shown, using PPP_DS3 links. 61
CS601: Computer Networks lab
Choose the Statistics To test the performance of the RIP protocol, we will collect the following statistics: 1. Right-click anywhere in the project workspace and select Choose Individual Statistics from the pop-up menu. 2. In the Choose Results dialog box, check the following statistics: a. Global Statistics ⇒ RIP ⇒ Traffic Sent (bits/sec). b. Global Statistics ⇒ RIP ⇒ Traffic Received (bits/sec). c. Nodes Statistics ⇒ Route Table ⇒ Total Number of Updates. 3. Click OK and then save your project. Note :
RIP traffic is the total amount of RIP update traffic (in bits) sent/received per second by all the nodes using RIP as the routing protocol in the IP interfaces in the node. Total Number of Updates is the number of times the routing table at this node gets updated (e.g., due to a new route addition, an existing route deletion, and/or a next hop update). The PP_DS3 link has a data rate of 44.736 Mbps.
Configure the Simulation Here we need to configure some of the simulation parameters: 1. Click on and the Configure Simulation window should appear. 62
CS601: Computer Networks lab
2. Set the duration to be 10.0 minutes. 3. Click on the Global Attributes tab and change the following attributes: a. IP Dynamic Routing Protocol = RIP. This sets the RIP protocol to be the routing protocol of all routers in the network. b. IP Interface Addressing Mode = Auto Addressed/Export. c. RIP Sim Efficiency = Disabled. If this attribute is enabled, RIP will stop after the "RIP Stop Time." But we need the RIP to keep updating the routing table in case there is any change in the network (as we will see in the second scenario). 4. Click OK and then save the project.
Note: Auto Addressed means that all IP interfaces are assigned IP addresses automatically during simulation. The class of address (e.g., A, B, or C) is determined based on the number of hosts in the designed network. Subnet masks assigned to these interfaces are the default subnet masks for that class. Export causes the autoassigned IP interface to be exported to a file (name of the file is ip_addresses.gdf and gets saved in the primary model directory).
Duplicate the Scenario In the network we just created, the routers will build their routing tables, and then they will not need to update them further because we didn’t simulate any node or link failures. In this scenario we will simulate failures so that we can compare the behavior of the routers in both cases. 63
CS601: Computer Networks lab
1. Select Duplicate Scenario from the Scenarios menu and name it Failure ⇒Click OK. 2. Open Object Palette by clicking dropdown menu. . Select the Utilities palette from the
3. Add a Failure Recovery object to your workspace and name it Failure as shown ⇒ Close the Object Palette dialog box.
4. Right-click on the Failure object ⇒ Edit Attributes ⇒ Expand the Link Failure/Recovery Specification hierarchy ⇒ Set rows to 1 ⇒ Set the attributes of the added row, row 0, as follows:
64
CS601: Computer Networks lab
This will “fail” the link between Router1 and Router2 200 seconds into the simulation. 5. Click OK and then save the project. Run the Simulation To run the simulation for both scenarios simultaneously: 1. Go to the Scenarios menu Select Manage Scenarios. 2. Change the values under the Results column to (or ) for both scenarios. Compare to the following figure.
3. Click OK to run the two simulations. Depending on the speed of your processor, this may take several seconds to complete. 4. After the two simulation runs complete, one for each scenario, click Close your project. View the Results Compare the Number of Updates: 1. Select Compare Results from the Results menu. 2. Change the drop-down menu in the right-lower part of the dialog box to Stacked Statistics as shown. Save
65
CS601: Computer Networks lab
3. Select the Total Number of Updates statistic for Router1 and click Show. 4. You should get two graphs, one for each scenario. Right-click on each graph and select Draw Style Bar. 5. The resulting graphs should resemble the following (you can zoom in on the graphs by clicking-and-dragging a box over the region of interest):
66
CS601: Computer Networks lab
Obtain the IP Addresses of the Interface: Before checking the contents of the routing tables, we need to determine the IP address information for all interfaces in the current network. Recall that these IP addresses are assigned automatically during simulation, and we set the global attribute IP Interface Addressing Mode to export this information to a file. 1. From the File menu choose Model Files Refresh Model Directories. This causes OPNET IT Guru to search the model directories and update its list of files. 2. From the File menu choose Open From the drop-down menu choose Generic Data File. Select the _RIP-NO_Failure-ip_addresses file (the other file created from the Failure scenario should contain the same information) Click OK. 3. The following is a part of the gdf file content. It shows the IP addresses assigned to the interfaces of Router1 in our network. For example the interface of Router1 that is connected to Net11 has the IP address 192.0.0.1 (Note: Your result may vary due to different nodes placement.) The Subnet Mask associated with that interface indicates that the address of the subnetwork, to which the interface is connected, is 192.0.0.0 (i.e., the logical AND of the interface IP address and the subnet mask).
4. Print out the layout of the network you implemented in this lab. On this layout, from the information included in the gdf file, write down the IP addresses associated with Router1 as well as the addresses assigned to each subnetwork as shown in the following two figures (Note: Your IP addresses may vary due to different nodes placement.)
67
CS601: Computer Networks lab
Compare the Routing Tables Content: 1. To check the content of the routing tables in Router1 for both scenarios: i. Go to the Results menu Open Simulation Log Expand the hierarchy on the left as shown below Click on the field COMMON ROUTE TABLE.
2. Carry out the previous step for both scenarios. The following are partial contents of Router1’s routing table for both scenarios (Note: Your results may vary due to different nodes placement): Routing table of Router1 (NO_Failure scenario):
68
CS601: Computer Networks lab
Note: Loopback interface allows a client and a server on the same host to communicate with each other using TCP/IP
Routing table of Router1 (Failure scenario):
69
CS601: Computer Networks lab
Exercise - Questions
1. Obtain and analyze the graphs that compare the sent RIP traffic for both scenarios. Make sure to change the draw style for the graphs to Bar. 2. Describe and explain the effect of the failure of the link connecting Router1 to Router2 on the routing tables. 3. Create another scenario as a duplicate of the Failure scenario. Name the new scenario Q3_Recover. In this new scenario have the link connecting Router1 to Router2 recover after 400 seconds. Generate and analyze the graph that shows the effect of this recovery on the Total Number of Updates in the routing table of Router1. Check the contents of Router1‘s routing table. Compare this table with the corresponding routing tables generated in the NO_Failure and Failure scenarios.
Lab Report
70
CS601: Computer Networks lab
EXERCISE - 10
OPNET - TCP / UDP Simulate a four-node point-to-point network, and connect the links as follows: n0->n2, n1->n2 and n2->n3. Apply TCP agent changing the parameters and determine the number of packets sent/received by TCP/UDP. Objective: To simulate a four-node point-to-point network( n0->n2, n1->n2 and n2->n3) and determine the number of packets sent/received by TCP/UDP by changing the parameters in TCP agent.
Step 1: Create a New Project Step 2: Creating network topology: Select eth4_slip4_multihomed_client (4 numbers) from the client_server tool in Object Palette. Select an ethernet_server. Select ethernet from Object Palette. Connect them using the 10BaseT links. Select Application Config and Profile config objects.
Step 3: Configuring network application Right click on the Application definition object. Select Edit Attributes. 71
CS601: Computer Networks lab
Select 2 rows for applications Select the FTP application for TCP traffic and set the traffic to High Load. Select the Video Conferencing application for UDP traffic and set the traffic to High-Resolution Video. Check Apply Changes to Selected Objects and click Ok.
Step 4: Configure profile Right click on Profile Definition object and select Edit Attributes. TCP profile: Assign the values for the various fields as shown in the Fig. below. Click on Apply Changes to Selected Objects and click on OK.
72
CS601: Computer Networks lab
Step 5: Configure the network objects
73
CS601: Computer Networks lab
Right click on the appropriate object i.e. client node or ethernet server. Select Edit Attributes. Click on Application Supported Profiles and choose edit. Apply both the profiles to the client nodes. Click Ok. Click on Application Supported Services and choose edit. Apply the FTP application in case of Ethernet server object and for client nodes select the Video application. This is to simulate FTP-TCP-IP for Server and Video-UDP-IP for client nodes. Click Ok. Check Apply Changes to Selected Objects and click on Ok.
Step 6: Choose statistics: Right click on the workspace and Select Choose Individual Statistics from Node Statistics as shown below.
Step 7: Run the simulation Click run simulation icon from the toolbar. Set the Duration to 15 seconds. Click Run. 74
CS601: Computer Networks lab
Step 8: View Results Right click on the work space and select View Results. Select the statistics from the View Results. Click Show button to view the graphs.
75
CS601: Computer Networks lab
Result Interpretation: Notice the difference in scale in the Y-Axis. For TCP the range is in 1000s and in UDP in 10000s. This means the amount of data sent and received in UDP is much higher than that in UDP, which implies a higher data rate and therefore a higher data loss. These graphs show that for UDP the loss rate is high especially since this is a video conferencing application with high data rate. However for TCP, since congestion control is applied the loss rate is less and we see a more even graph with less loss.
76
CS601: Computer Networks lab
EXERCISE - 11
OPNET - WIRELESS LAN : Simulate simple BSS and with transmitting nodes in wireless LAN by simulation and determine the performance with respect to transmission of packets. Objective: To simulate simple ESS with transmitting nodes in WIRELESS LAN and determine the performance with respect to transmission of packets. Please Note: Make sure to choose Meters while creating the Topology. If not, the messages will be sent by the Wireless LAN (Adhoc Network)nodes, but not received by other nodes as the physical geographic range of wireless transmission by the nodes in the adhoc network via Bluetooth is limited. Step 1: Create a New Project Step 2: Create the Network Select Object Palette box. Select wireless_lan_adv from drop down menu.
Choose wlan_station_adv(fix) object (4 numbers).
77
CS601: Computer Networks lab
Step 3: Configure the Network Application (Select Topology icon ->open Annotation Palette ->(choose circle) and include all 4 nodes in a circle annotation.) Select any wlan_station_adv object in the workspace. Right click on the selected object and Select Similar Nodes. Right click and select Edit Attributes. Select Traffic Generation Parameters => set Start Time to constant (1) => set ON State to constant (100) => set OFF State to constant (0). Please Note: If the field to set Start Time to constant(1) is disabled for some reason, please change the value from ‘Never’ to ‘Not Used’. Select Packet Generation Arguments =>set Interarrival Time to exponential(1). Check Apply Changes to Selected Objects. Click Ok.
78
CS601: Computer Networks lab
Step 4: Selecting Statistics for viewing: Right click on the workspace and select Choose Individual Statistics. In Node Statistics => select Wireless LAN => select Data Traffic Rcvd (packets/sec) and select Data Traffic send (packets/sec).
Step 5: Run the simulation Click run simulation icon from the toolbar. Set the Duration to 100 seconds. Click Run.
Step 6: View Results Right click on the work space and select View Results. Change As Is to Sample_Sum.
79
CS601: Computer Networks lab
Result Interpretation: In the result panel change As Is to Average.
We see that on an average 1 packet is sent per second and around 2.5 packets are received per second. This is because the transmissions of the other 3 stations are also being received by this station. There are some losses as well which can be seen by including global statistics (bit/sec). 80
CS601: Computer Networks lab
WIRESHARK Introduction
Objective: To learn the basics of operating Wireshark packet sniffer. Wireshark Lab: Getting Started Download and install the Wireshark software: Go to http://w\vw.wireshark.org/download.html and download and install the Wireshark binary for your computer. Taking Wireshark for a Test Run Assuming that your computer is connected to the Internet via a wired Ethernet interface. Do the following 1. Start up your favorite web browser . 2. Start up the Wireshark software. You will initially see a window similar to that shown in Figure below.
3. To begin packet capture, select the Capture pull down menu and select Options. This will cause the "Wireshark: Capture Options" window to be displayed, as shown in Figure below. You can use most of the default values in this window, but uncheck "Hide capture info dialog"
81
CS601: Computer Networks lab
4. Under Display Options. The network interfaces (i.e., the physical connections) that your computer has to the network will be shown in the Interface pull down menu at the top of the Capture Options window. In case your computer has more than one active network interface (e.g., if you have both a wireless and a wired Ethernet connection), you will need to select an interface that is being used to send and receive packets (mostly likely the wired interface). After selecting the network interface, click Start. Packet capture will now begin - all packets being sent/received from/by your computer are now being captured by Wireshark! 5. Once you begin packet capture, a packet capture summary window will appear, as shown in Figure shown below. This window summarizes the number of packets of various types that are being captured, and (importantly!) contains the Stop button that will allow you to stop packet capture.
82
CS601: Computer Networks lab
6. While Wireshark is running, enter the URL: http:// gaia.cs. umass.edulwireshark -labs/INTRO-wireshark- file1.html and have that page displayed in your browser. In order to display this page, your browser will contact the HTTP server at gaia.cs.umass.edu and exchange HTTP messages with the server in order to download this page, The Ethernet frames containing these HTTP messages will be captured by Wireshark. 7. After your browser has displayed the INTRO-wireshark-file1.html page, stop Wireshark packet capture by selecting stop in the Wireshark capture window. This will cause the Wireshark capture window to disappear and the main Wireshark window to display all packets captured since you began packet capture. The main Wireshark window should now look similar to Figure shown below. You now have live packet data that contains all protocol messages exchanged between your computer and other network entities! The HTTP message exchanges with the gaia.cs.umass.edu web server should appear somewhere in the listing of packets captured. But there will be many other types of packets displayed as well (see, e.g., the many different protocol types shown in the Protocol column in the Figure ).
8. Type in "http" (without the quotes, and in lower case - all protocol names are in lower case in Wireshark) into the display filter specification window at the top of the main Wireshark window. Then select Apply (to the right of where you entered "http"). This will cause only HTTP message to be displayed in the packet-listing 83
CS601: Computer Networks lab window. 9. Select the first http message shown in the packet-listing window. This should be the HTTP GET message that was sent from your computer to the gaia.cs.umass.edu HTTP server. When you select the HTTP GET message, the Ethernet frame, IP datagram, TCP segment, and HTTP message header information will be displayed in the packet-header window3. By clicking plus and-minus boxes to the left side of the packet details window, minimize the amount of Frame, Ethernet, Internet Protocol, and Transmission Control Protocol information displayed. Maximize the amount information displayed about the HTTP protocol. Your Wireshark display should now look roughly as shown below.
10. Exit Wireshark Congratulations! You've now completed the first lab
EXERCISE QUESTIONS :-
1. List up to 10 different protocols that appear in the protocol column in the unfiltered packet-listing window in step 7 above.
84
CS601: Computer Networks lab
2. How long did it take from when the HTTP GET message was sent until the HTTP OK reply was received? (By default, the value of the Time column in the packet listing window is the amount of time, in seconds, since Wireshark tracing began. To display the Time field in time-of-day format, select the Wireshark View pull down menu, then select Time Display Format, then select Time-of-day.) 3. What is the Internet address of the gaia.cs.umass.edu (also known as www.net.cs.umass.edu)? What is the Internet address of your computer?
85
CS601: Computer Networks lab
EXERCISE - 12
Wireshark Lab: HTTP
The Basic HTTP GET/response interaction Let’s begin our exploration of HTTP by downloading a very simple HTML file - one that is very short, and contains no embedded objects. Do the following: 1. Start up your web browser. 2. Start up the Wireshark packet sniffer, as described in the Introductory lab (but don’t yet begin packet capture). Enter “http in the display-filter-specification window 3. Wait a bit more than one minute (we’ll see why shortly), and then begin Wireshark packet capture. 4. Enter the following to your browser http://gaia.cs.umass.edu/wireshark-labs/HTTPwireshark-file1.html Your browser should display the very simple, one-line HTML file. 5. Stop Wireshark packet capture.
EXERCISE QUESTIONS :1. Is your browser running HTTP version 1.0 or 1.1? What version of HTTP is the server running? 2. What languages (if any) does your browser indicate that it can accept to the server? 3. What is the IP address of your computer? Of the gaia.cs.umass.edu server? 4. What is the status code returned from the server to your browser? 5. When was the HTML file that you are retrieving last modified at the server? 6. How many bytes of content are being returned to your browser? 7. By inspecting the raw data in the packet content window, do you see any headers within the data that are not displayed in the packet-listing window? If so, name them
86
CS601: Computer Networks lab
The HTTP CONDITIONAL GET/response interaction Make sure your browser’s cache is empty. For Internet Explorer, select Tools>Internet Options->Delete File; these actions will remove cached files from your browser’s cache. Now do the following: 1. Start up your web browser, and make sure your browser’s cache is cleared, as discussed above. Start up the Wireshark packet sniffer Enter the following URL into your browser http://gaia.cs.umass.edu/wireshark-labs/HTTP-wireshark-file2.html
2. 3.
4. Your browser should display a very simple five-line HTML file. 5. Quickly enter the same URL into your browser again (or simply select the refresh button on your browser)
6. Stop Wireshark packet capture, and enter “http” in the display-filter-specification window, so that only captured HTTP messages will be displayed later in the packet-listing window.
EXERCISE QUESTIONS :1. Inspect the contents of the first HTTP GET request from your browser to the
server. Do you see an “IF-MODIFIED-SINCE” line in the HTTP GET?
2. Inspect the contents of the server response. Did the server explicitly return the
contents of the file? How can you tell?
3. Now inspect the contents of the second HTTP GET request from your browser to
the server. Do you see an “IF-MODIFIED-SINCE:” line in the HTTP GET? If so, what information follows the “IF-MODIFIED-SINCE:” header?
4. What is the HTTP status code and phrase returned from the server in response to
this second HTTP GET? Did the server explicitly return the contents of the file? Explain.
87
CS601: Computer Networks lab
Retrieving Long Documents 1. Start up your web browser, and make sure your browser’s cache is cleared, as discussed above. Start up the Wireshark packet sniffer Enter the following URL into your browser http://gaia.cs.umass.edu/wireshark-labs/HTTP-wireshark-file3.html Your browser should display the rather lengthy US Bill of Rights.
2. 3.
4. Stop Wireshark packet capture, and enter “http” in the display-filter-specification window, so that only captured HTTP messages will be displayed.
EXERCISE QUESTIONS :1. 2. How many HTTP GET request messages were sent by your browser? How many data-containing TCP segments were needed to carry the single HTTP response? What is the status code and phrase associated with the response to the HTTP GET request? Are there any HTTP status lines in the transmitted data associated with a TCPinduced “Continuation”?
3.
4.
88
CS601: Computer Networks lab
HTML Documents with Embedded Objects • Start up your web browser, and make sure your browser’s cache is cleared, as discussed above. • Start up the Wireshark packet sniffer • Enter the following URL into your browser http://gaia.cs.umass.edu/wireshark-labs/HTTP-wireshark-file4.html
Note: Your browser should display a short HTML file with two images. These two images are referenced in the base HTML file. That is, the images themselves are not contained in the HTML; instead the URLs for the images are contained in the downloaded HTML file. As discussed in the textbook, your browser will have to retrieve these logos from the indicated web sites. Our publisher’s logo is retrieved from the www.aw-bc.com web site. The image of our book’s cover is stored at the manic.cs.umass.edu server.
• Stop Wireshark packet capture, and enter “http” in the display-filter-specification window, so that only captured HTTP messages will be displayed. EXERCISE QUESTIONS : 1. How many HTTP GET request messages were sent by your browser? To which Internet addresses were these GET requests sent? 2. Can you tell whether your browser downloaded the two images serially, or whether they were downloaded from the two web sites in parallel? Explain.
89
CS601: Computer Networks lab
HTTP Authentication Finally, let’s try visiting a web site that is password-protected and examine the sequence of HTTP message exchanged for such a site. The url http://gaia.cs.umass.edu/wiresharklabs/protected_pages/HTTP-wireshark-file5.html is password protected. The username is “wireshark-students” (without the quotes), and the password is “network” (again, without the quotes). So let’s access this “secure” password-protected site. Do the following: 1. Make sure your browser’s cache is cleared, as discussed above, and close down your browser. Then, start up your browser 2. 3. Start up the Wireshark packet sniffer Enter the following URL into your browser http://gaia.cs.umass.edu/wireshark-labs/protected_pages/HTTP-wiresharkfile5. Html Type the requested user name and password into the pop up box. Stop Wireshark packet capture, and enter “http” in the display-filter-specification window, so that only captured HTTP messages will be displayed later in the packet-listing window.
4.
EXERCISE QUESTIONS : 1. What is the server’s response (status code and phrase) in response to the initial HTTP GET message from your browser? 2. When your browser’s sends the HTTP GET message for the second time, what new field is included in the HTTP GET message?
90
CS601: Computer Networks lab
EXERCISE - 13 Wireshark Lab: DNS
Objective: To understand the working of Directory Name Service nslookup To run it in Windows, open the Command Prompt and run nslookup on the command line. In it is most basic operation, nslookup tool allows the host running the tool to query any specified DNS server for a DNS record. The queried DNS server can be a root DNS server, a top-level-domain DNS server, an authoritative DNS server, or an intermediate DNS server (see the textbook for definitions of these terms). To accomplish this task, nslookup sends a DNS query to the specified DNS server, receives a DNS reply from that same DNS server, and displays the result. Do the following commands nslookup www.mit.edu nslookup –type=NS mit.edu nslookup www.aiit.or.kr bitsy.mit.edu general syntax of nslookup commands. The syntax is: nslookup –option1 –option2 host-to-find dns-server In general, nslookup can be run with zero, one, two or more options. Ipconfig ipconfig can be used to show your current TCP/IP information, including your address, DNS server addresses, adapter type and so on. For example, if you want to see all this information about your host, simply enter: ipconfig \all we learned that a host can cache DNS records it recently obtained. To see these cached records, after the prompt C:\> provide the following command: ipconfig /displaydns Each entry shows the remaining Time to Live (TTL) in seconds. To clear the cache, enter ipconfig /flushdns Flushing the DNS cache clears all entries and reloads the entries from the hosts file. 91
CS601: Computer Networks lab
Tracing DNS with Wireshark Now that we are familiar with nslookup and ipconfig, we’re ready to get down to some serious business. Let’s first capture the DNS packets that are generated by ordinary Websurfing 1. 2. Use ipconfig to empty the DNS cache in your host. Open your browser and empty your browser cache. (With Internet Explorer, go to Tools menu and select Internet Options; then in the General tab select Delete Files.)
3. Open Wireshark and enter “ip.addr == your_IP_address” into the filter, where you obtain your_IP_address (the IP address for the computer on which you are running Wireshark) with ipconfig. This filter removes all packets that neither originate nor are destined to your host. 4. Start packet capture in Wireshark. 5. With your browser, visit the Web page: http://www.ietf.org 6. Stop packet capture. EXERCISE QUESTIONS : 1. Locate the DNS query and response messages. Are they sent over UDP or TCP? 2. What is the destination port for the DNS query message? What is the source port of DNS response message? 3. To what IP address is the DNS query message sent? Use ipconfig to determine the IP address of your local DNS server. Are these two IP addresses the same? Examine the DNS query message. What “Type” of DNS query is it? Does the query message contain any “answers”? Examine the DNS response message. How many “answers” are provided? Whatdoes each of these answers contain?
4.
5.
6. Consider the subsequent TCP SYN packet sent by your host. Does the destination IP address of the SYN packet correspond to any of the IP addresses provided in the DNS response message? 7. This web page contains images. Before retrieving each image, does your host issue new DNS queries?
92
CS601: Computer Networks lab nslookup 1. Start packet capture. 2. Do an nslookup on www.mit.edu 3. Stop packet capture Note: We see for the above experiment that nslookup actually sent three DNS queries and received three DNS responses. For the purpose of this assignment, in answering the following questions, ignore the first two sets of queries/responses, as they are specific to nslookup and are not normally generated by standard Internet applications. You should instead focus on the last query and response messages. Now repeat the previous experiment, but instead issue the command: nslookup –type=NS mit.edu EXERCISE QUESTIONS : 8. To what IP address is the DNS query message sent? Is this the IP address of your default local DNS server? 9. Examine the DNS query message. What “Type” of DNS query is it? Does the query message contain any “answers”? 10. Examine the DNS response message. What MIT name servers does the response message provide? Does this response message also provide the IP addresses of the MIT name servers? Now repeat the previous experiment, but instead issue the command: nslookup www.aiit.or.kr bitsy.mit.edu EXERCISE QUESTIONS : 11. To what IP address is the DNS query message sent? Is this the IP address of your default local DNS server? If not, what does the IP address correspond to? 12. Examine the DNS query message. What “Type” of DNS query is it? Does the query message contain any “answers”? 13. Examine the DNS response message. How many “answers” are provided? What does each of these answers contain?
. 93
CS601: Computer Networks lab
EXERCISE – 14
Wireshark Lab: Transmission Control Protocol Objective: To understand the working of Transfer Control Protocol 1. Start up your web browser. Go the http://gaia.cs.umass.edu/wiresharklabs/ alice.txt and retrieve an ASCII copy of Alice in Wonderland. Store this file somewhere on your computer. 2. Next go to http://gaia.cs.umass.edu/wireshark-labs/TCP-wireshark-file1.html. You should see a screen that looks like:
3. Use the Browse button in this form to enter the name of the file (full path name) on your computer containing Alice in Wonderland (or do so manually). Don’t yet press the “Upload alice.txt file” button. 4. Now start up Wireshark and begin packet capture (Capture->Options) and then press OK on the Wireshark Packet Capture Options screen (we’ll not need to select any options here). 5. Returning to your browser, press the “Upload alice.txt file” button to upload the file to the gaia.cs.umass.edu server. Once the file has been uploaded, a short congratulations message will be displayed in your browser window. 6. Stop Wireshark packet capture. Your Wireshark window should look similar to 94
CS601: Computer Networks lab the window shown below.
A first look at the captured trace Before analyzing the behavior of the TCP connection in detail, let’s take a high level view of the trace. First, filter the packets displayed in the Wireshark window by entering “tcp”. into the display filter specification window towards the top of the Wireshark window. What you should see is series of TCP and HTTP messages between your computer and gaia.cs.umass.edu. You should see the initial three-way handshake containing a SYN message. You should see an HTTP POST message and a series of “HTTP Continuation” messages being sent from your computer to gaia.cs.umass.edu. Recall from our discussion in the earlier HTTP Wireshark lab, that is no such thing as an HTTP Continuation message – this is Wireshark’s way of indicating that there are multiple TCP segments being used to carry a single HTTP message. You should also see TCP ACK segments being returned from gaia.cs.umass.edu to your computer. EXERCISE QUESTIONS : 1. What is the IP address and TCP port number used by the client computer (source) that is transferring the file to gaia.cs.umass.edu? 95
CS601: Computer Networks lab
Hint: To answer this question, it’s probably easiest to select an HTTP message and explore the details of the TCP packet used to carry this HTTP message, using the “details of the selected packet header window” (refer to Figure 2 in the “Getting Started with Wireshark” Lab if you’re uncertain about the Wireshark windows).
2. What is the IP address of gaia.cs.umass.edu? On what port number is it sending and receiving TCP segments for this connection? If you have been able to create your own trace, answer the following question: 3. What is the IP address and TCP port number used by your client computer (source) to transfer the file to gaia.cs.umass.edu? Since this lab is about TCP rather than HTTP, let’s change Wireshark’s “listing of captured packets” window so that it shows information about the TCP segments containing the HTTP messages, rather than about the HTTP messages. To have Wireshark do this, select Analyze->Enabled Protocols. Then uncheck the HTTP box and select OK. You should now see an Wireshark window that looks like:
EXERCISE QUESTIONS : 1. What is the sequence number of the TCP SYN segment that is used to initiate the TCP connection between the client computer and gaia.cs.umass.edu? What is it in the segment that identifies the segment as a SYN segment? 96
CS601: Computer Networks lab
2. What is the sequence number of the SYNACK segment sent by gaia.cs.umass.edu to the client computer in reply to the SYN? What is the value of the ACKnowledgement field in the SYNACK segment? How did gaia.cs.umass.edu determine that value? What is it in the segment that identifies the segment as a SYNACK segment? 3. What is the sequence number of the TCP segment containing the HTTP POST command? Note that in order to find the POST command, you’ll need to dig into the packet content field at the bottom of the Wireshark window, looking for a segment with a “POST” within its DATA field. TCP congestion control in action Select a TCP segment in the Wireshark’s “listing of captured-packets” window. Then select the menu : Statistics->TCP Stream Graph-> Time-SequenceGraph(Stevens). You should see a plot that looks similar to the following plot,
Note: Here, each dot represents a TCP segment sent, plotting the sequence number of the segment versus the time at which it was sent. Note that a set of dots stacked above each other represents a series of packets that were sent back-to-back by the sender.
EXERCISE QUESTIONS : 1. Use the Time-Sequence-Graph(Stevens) plotting tool to view the sequence number versus time plot of segments being sent from the client to the gaia.cs.umass.edu server. Can you identify where TCP’s slowstart phase begins and ends, and where congestion avoidance takes over? 97
CS601: Computer Networks lab
EXERCISE - 15
Wireshark Lab: IP, ICMP and DHCP Objective: To understand the working of Internet Protocol, Internet Control Message Protocol, Dynamic Host Configuration Protocol.
1. Start up Wireshark and begin packet capture (Capture->Option) and then press OK on the Wireshark Packet Capture Options screen (we’ll not need to select any options here). 2. If you are using a Windows platform, start up pingplotter and enter the name of a target destination in the “Address to Trace Window.” Enter 3 in the “# of times to Trace” field, so you don’t gather too much data. Select the menu item Edit>Advanced Options->Packet Options and enter a value of 84 in the Packet Size field and then press OK. Then press the Trace button. You should see a pingplotter window that looks something like this:
Next, send a set of datagrams with a longer length, by selecting Edit->Advanced Options->Packet Options and enter a value of 2028 in the Packet Size field and then press OK. Then press the Resume button. Finally, send a set of datagrams with a longer length, by selecting Edit>Advanced Options->Packet Options and enter a value of 3528 in the Packet Size 98
CS601: Computer Networks lab field and then press OK. Then press the Resume button. Stop Wireshark tracing.
Note 1Download the zip file http://gaia.cs.umass.edu/wireshark-labs/wireshark-traces.zip and extract the file ipethereal-trace-1. The traces in this zip file were collected by Wireshark running on one of the uthor’s computers, while performing the steps indicated in the Wireshark lab. Once you have downloaded the trace, you can load it into Wireshark and view the trace using the File pull down menu, choosing Open, and then selecting the ip-ethereal-trace-1 trace file.
EXERCISE QUESTIONS : 1. Select the first ICMP Echo Request message sent by your computer, and expand the Internet Protocol part of the packet in the packet details window. What is the IP address of your computer? 2. Within the IP packet header, what is the value in the upper layer protocol field? 3. How many bytes are in the IP header? How many bytes are in the payload of the IP datagram? Explain how you determined the number of payload bytes. 3. Has this IP datagram been fragmented? Explain how you determined whether or not the datagram has been fragmented.
Note: Next, sort the traced packets according to IP source address by clicking on the Source column header; a small downward pointing arrow should appear next to the word Source. If the arrow points up, click on the Source column header again. Select the first ICMP Echo Request message sent by your computer, and expand the Internet Protocol portion in the “details of selected packet header” window. In the “listing of captured packets” window, you should see all of the subsequent ICMP messages (perhaps with additional interspersed packets sent by other protocols running on your computer) below this first ICMP. Use the down arrow on your keyboard to move through the ICMP messages sent by your computer.
4. Which fields in the IP datagram always change from one datagram to the next within this series of ICMP messages sent by your computer? 5. Which fields stay constant? Sort the packet listing according to time again by clicking on the Time column. 6. Find the first ICMP Echo Request message that was sent by your computer after you changed the Packet Size in pingplotter to be 2000. Has that message been fragmented across more than one IP datagram 7. Print out the first fragment of the fragmented IP datagram. What information in the IP header indicates that the datagram been fragmented? What information in 99
CS601: Computer Networks lab the IP header indicates whether this is the first fragment versus a latter fragment? How long is this IP datagram? 8. What information in the IP header indicates that this is not the first datagram fragment? Are the more fragments? How can you tell? 9. What fields change in the IP header between the first and second fragment? Wireshark Lab: DHCP
1.
Begin by opening the Windows Command Prompt application (which can be found in your Accessories folder). Enter “ipconfig /release”. The executable for ipconfig is in C:\windows\system32. This command releases your current IP address, so that your host’s IP address becomes 0.0.0.0.
2. Start up the Wireshark packet sniffer, as described in the introductory Wireshark lab and begin Wireshark packet capture. 3. Now go back to the Windows Command Prompt and enter “ipconfig /renew”. This instructs your host to obtain a network configuration, including a new IP address. In Figure 1, the host obtains the IP address 192.168.1.108. 4. Wait until the “ipconfig /renew” has terminated. Then enter the same command “ipconfig /renew” again. 5. When the second “ipconfig /renew” terminates, enter the command “ipconfig/release” to release the previously-allocated IP address to your computer. 6. Finally, enter “ipconfig /renew” to again be allocated an IP address for your computer.
7.
Stop Wireshark packet capture.
100
CS601: Computer Networks lab
Command Prompt window showing sequence of ipconfig commands that you should enter.
Now let’s take a look at the resulting Wireshark window. To see only the DHCP packets, enter into the filter field “bootp”.
101
CS601: Computer Networks lab
Wireshark window with first DHCP packet – the DHCP Discover packet –expanded. EXERCISE QUESTIONS : 1. Are DHCP messages sent over UDP or TCP? 2. What is the link-layer (e.g., Ethernet) address of your host? 3. What values in the DHCP discover message differentiate this message from the DHCP request message? 4. What is the value of the Transaction-ID in each of the first four discover/Offer/Request/ACK) DHCP messages? What are the values of the Transaction-ID in the second set (Request/ACK) set of DHCP messages? What is the purpose of the Transaction-ID field? 5. A host uses DHCP to obtain an IP address, among other things. But a host’s IP address is not confirmed until the end of the four-message exchange! If the IP address is not set until the end of the four-message exchange, then what values are used in the IP datagrams in the four-message exchange? For each of the four DHCP messages (Discover/Offer/Request/ACK DHCP), indicate the source and destination IP addresses that are carried in the encapsulating IP datagram. 102
CS601: Computer Networks lab
6. What is the IP address of your DHCP server? 7. What IP address is the DHCP server offering to your host in the DHCP Offer message? Indicate which DHCP message contains the offered DHCP address. 8. In the example screenshot in this assignment, there is no relay agent between the host and the DHCP server. What values in the trace indicate the absence of a relay agent? Is there a relay agent in your experiment? If so what is the IP address of the agent? 9. Explain the purpose of the lease time. How long is the lease time in your experiment? 10. What is the purpose of the DHCP release message? Does the DHCP server issue an acknowledgment of receipt of the client’s DHCP request?
103
CS601: Computer Networks lab
EXERCISE - 16 Wireshark Lab: ARP
Objective: To understand the working of Address Resolution Protocol Let’s take a look at the contents of the ARP cache on your computer: MS-DOS. The arp command is in c:\windows\system32, so type either “arp” or “c:\windows\system32\arp” in the MS-DOS command line (without quotation marks). The arp command with no arguments will display the contents of the ARP cache on your computer. Run the arp command. The MS-DOS arp –d * command will clear your ARP cache. The –d flag indicates a deletion operation, and the * is the wildcard that says to delete all table entries Observing ARP in action Do the following: 1. Clear your ARP cache, as described above. 2. Next, make sure your browser’s cache is empty. (To do this under Netscape 7.0, select Edit->Preferences->Advanced->Cache and clear the memory and disk cache. For Internet Explorer, select Tools->Internet Options->Delete Files.) 3. Start up the Wireshark packet sniffer
4. Enter the following URL into your browser http://gaia.cs.umass.edu/wiresharklabs/ HTTP-wireshark-lab-file3.html 5. Your browser should again display the rather lengthy US Bill of Rights. 6. Stop Wireshark packet capture. Again, we’re not interested in IP or higher-layer protocols, so change Wireshark’s “listing of captured packets” window so that it shows information only about protocols below IP. To have Wireshark do this, select Analyze->Enabled Protocols. Then uncheck the IP box and select OK.
7. You should now see an Wireshark window that looks like:
104
CS601: Computer Networks lab
In the example above, the first two frames in the trace contain ARP messages (as does the 6th message). The screen shot above corresponds to the trace referenced in footnote 1. EXERCISE QUESTIONS : 1. What are the hexadecimal values for the source and destination addresses in the Ethernet frame containing the ARP request message? 2. Give the hexadecimal value for the two-byte Ethernet Frame type field. What do the bit(s) whose value is 1 mean within the flag field? 3. Does the ARP message contain the IP address of the sender? Where in the ARP request does the “question” appear – the Ethernet address of the machine whose corresponding IP address is being queried? 4. What are the hexadecimal values for the source and destination addresses in the Ethernet frame containing the ARP reply message? 105