### Computer Networks

CS601: Computer Networks lab 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).

We Will Write a Custom Essay Specifically
For You For Only \$13.90/page!

order now

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 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) + (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. . 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 re 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.

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 *), ); 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 *), 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. rite() 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.

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.

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. . 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 o 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.

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. . 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. ) 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. . 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 . 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 ) 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 ou 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.

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.

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 ommunicate 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 Supp

0 Comment
x

Hi!
I'm Crystal!

Would you like to get a custom essay? How about receiving a customized one?

Check it out