network lab manual For Computer Science and Information Science Engineering Students, Exams of Computer Networks

lab manual for network lab for 7th sem ISE and CSE students

Typology: Exams

2016/2017

Uploaded on 11/18/2017

nuthan-k-obalareddy
nuthan-k-obalareddy 🇮🇳

1 document

1 / 39

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Computer Networks Lab
PESIT-BSC BE VII Sem CSE 10CSL77
PESIT Bangalore South Campus
1Km before Electronic City, Hosur Road, Bangalore-560100.
DEPARTMENT OF COMPUTER SCIENCE
VII SEMESTER
LAB MANUAL
SUBJECT: Networks Laboratory
Sub Code: 10CSL77
SESSION: JULY 2014 – DECEMBER 2014
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27

Partial preview of the text

Download network lab manual For Computer Science and Information Science Engineering Students and more Exams Computer Networks in PDF only on Docsity!

PESIT Bangalore South Campus

1Km before Electronic City, Hosur Road, Bangalore-560100.

DEPARTMENT OF COMPUTER SCIENCE

VII SEMESTER

LAB MANUAL

SUBJECT: Networks Laboratory

Sub Code: 10CSL

SESSION: JULY 2014 – DECEMBER 2014

PES School

Note: Student is required to solve one problem from PART-A and one problem from PART- B. Both the parts have equal weightage.

PART A – Simulation Exercises

The following experiments shall be conducted using either NS228/OPNET or any other simulators.

  1. Simulate a three nodes point-to-point network with duplex links between them. Set the queue size vary the bandwidth and find the number of packets dropped.
  2. Simulate a four node point-to-point network, and connect the links as follows: n0-n2, n1- n2 and n2-n3. Apply TCP agent between n0-n3 and UDP n1-n3. Apply relevant applications over TCP and UDP agents changing the parameter and determine the number of packets sent by TCP/UDP.
  3. Simulate the transmission of ping messages over a network topology consisting of 6 nodes and find the number of packets dropped due to congestion.
  4. Simulate an Ethernet LAN using N-nodes(6-10), change error rate and data rate and compare the throughput.
  5. Simulate an Ethernet LAN using N nodes and set multiple traffic nodes and plot congestion window for different source/destination.
  6. Simulate simple ESS and with transmitting nodes in wire-less LAN by simulation and determine the performance with respect to transmission of packets.

PART B

The following experiments shall be conducted using C/C++.

  1. Write a program for error detecting code using CRC-CCITT (16-bits).
  2. Write a program for distance vector algorithm to find suitable path for transmission.
  3. Using TCP/IP sockets, write a client-server program to make client sending the file name and the server to send back the contents of the requested file if present.
  4. Implement the above program using as message queues or FIFOs as IPC channels.
  5. Write a program for simple RSA algorithm to encrypt and decrypt the data.
  6. Write a program for congestion control using Leaky bucket algorithm.

PES - 1

PE

The Network Simulator can design and simulate a network with SNMP, TL1, TFTF, FTP, Telnet and IOS devices, in four simple steps:

  1. Add devices to the Device tree: Add devices with the required configuration to the device tree in the Network Designer. Preconfigured devices are also bundled with the toolkit.
  2. Create the Network: Create and add bulk devices to the network, at one shot.
  3. Configure the Network devices: Configure the devices in the network, if required.
    1. Start the Network: Start the network or start individual agents in the network. The MIB Browser and TL1 Craft Interface test tools, can be used as the manager tools for testing.

Network Emulation

Network emulation refers to actual network traffic passing through some software which might do some analysis or perhaps modify the traffic in some way. The Emulation Network in the WAND group is used for testing and evaluation of networking software and hardware. The scale is limited; it is made up 24 emulation machines and one central controlling computer. Setup of such a network is time consuming and expensive: in addition to the aforementioned 25 computers, a Cisco 2950 switch and a Cyclades 32 port terminal server are included in the network. Each emulation machine also has a 4 port network interface controller. The controlling machine includes special capture cards (known as DAG [6] cards) to allow easier capture and processing of network traffic. This network has no easy way of adding latency and bandwidth bottlenecks, which means creating adverse conditions on the network is difficult. It is possible to use Dummynet to

add latency, but this is a lot of work. There is a project to solve this issue; a non blocking crossbar Ethernet switch is being created for the network, but the cost involved is large.

Other network emulation done in the WAND group include validating the WAND simulator. This was done by setting up a physical network with FreeBSD machines using Dummynet to add latency. Dummynet is one example of network emulation software, NIST Net is another, it claims to “allow controlled, reproducible experiments with network performance sensitive/adaptive applications and control protocols in a simple laboratory setting”.

NS-2 also provides some network emulation functionality, it is able to capture packets from the live network and drop, delay, re-order, or duplicate them. Emulation, especially in the case of a network simulator like NS-2, is interesting because it is using real world data from real world network stacks. Emulation offers something simulation never can: it is performed on a real network, using actual equipment and real software. However, it is very limited compared to simulation in other areas; for example scale. The WAND Emulation Network described earlier requires a lot of setup and is expensive, yet only contains 24 emulation machines. There is no theoretical limit to the number of nodes a simulator can handle, and increasing the size of a simulation does not cost anything. The factors to consider are RAM, disk space and the small amount of time taken to change a simulation script. In general, changing the simulation is a simple step, though it would be complex in the case a huge amount of nodes being required (a million, for example).

Also, network emulation must of course be run in real time, where simulation can sometimes simulate large time periods in a small amount of time. In the case of a million nodes, the simulation might run in greater than real time because the hardware it is run on would limit performance.

Introduction to Network Simulators

Network simulators implemented in software are valuable tools for researchers to develop, test, and diagnose network protocols. Simulation is economical because it can

carry out experiments without the actual hardware. It is flexible because it can, for example, simulate a link with any bandwidth and propagation delay. Simulation results

are easier to analyze than experimental results because important information at critical points can be easily logged to help researchers diagnose network protocols.

Network simulators, however, have their limitations. A complete network simulator needs to simulate networking devices (e.g., hosts and routers) and application programs that generate network traffic. It also needs to provide network utility programs to configure, monitor, and gather statistics about a simulated network. Therefore, developing a complete network simulator is a large effort. Due to limited development resources, traditional network simulators usually have the following drawbacks:

  • Simulation results are not as convincing as those produced by real hardware and software equipment. In order to constrain their complexity and development cost, most network simulators

The description of the network topology, protocols workload and control parameters are transmitted to the server using a simple ASCII representation called NetLanguage where the network is modeled as a graph. This latest release now includes a GUI written in Java.

Implementation of the simulator

The NEST code has been rewritten to make it less general, cleaner and faster. REAL is still implemented as a client-server program. The code is freely available to anyone willing to modify it. Node functions implement computation at each node in the network whereas queue management and routing functions manage buffers in nodes and packet switching. Routing is static and is based on Dijkstras's shortest path algorithm. A node could be a source, a router or a sink. Source nodes implement TCP-like transport layer functionality. Routers implement the scheduling disciplines, while the sinks are universal receivers that only acknowledge packets.

Since NEST didn't not allow for timers, REAL sends out a timer packet from a source back to itself to return after some specified time, but timers cannot be reset using this method.

NCTUns

Introduction

NCTUns is open source, high quality, and supports many types of networks.The NCTUns is a high-fidelity and extensible network simulator and emulator capable of simulating various protocols used in both wired and wireless IP networks. Its core technology is based on the novel kernel re-entering methodology invented by Prof. S.Y. Wang [1, 2] when he was pursuing his Ph.D. degree at Harvard University. Due to this novel methodology, NCTUns provides many unique advantages that cannot be easily achieved by traditional network simulators such as ns-2 [3] and OPNET [4].

After obtaining his Ph.D. degree from Harvard University in September 1999, Prof. S.Y. Wang returned to Taiwan and became an assistant professor in the Department of Computer Science and Information Engineering, National Chiao Tung University (NCTU), Taiwan, where he founded his “Network and System Laboratory.” Since that time, Prof. S.Y. Wang has been leading and working with his students to design and implement NCTUns (the NCTU Network Simulator) for more than five years.

Salient features of NCTUns

The NCTUns network simulator and emulator has many useful features listed as follows:

  • It can be used as an emulator. An external host in the real world can exchange packets (e.g., set up a TCP connection) with nodes (e.g., host, router, or mobile station) in a network simulated by NCTUns. Two external hosts in the real world can also exchange their packets via a network simulated by NCTUns. This feature is very useful as the function and performance of real-world devices can be tested under various simulated network conditions.
  • It directly uses the real-life Linux ’s TCP/IP protocol stack to generate high-fidelity simulation results. By using a novel kernel re-entering simulation methodology, a real-life UNIX (e.g., Linux) kernel’s protocol stack can be directly used to generate high-fidelity simulation results.
  • It can use any real-life existing or to-be-developed UNIX application program as a traffic generator program without any modification. Any real-life program can be run on a simulated network to generate network traffic. This enables a researcher to test the functionality and performance of a distributed application or system under various network conditions. Another important advantage of this feature is that application programs developed during simulation studies can be directly moved to and used on real-world UNIX machines after simulation studies are finished. This eliminates the time and effort required to port a simulation prototype to a real-world implementation if traditional network simulators are used.
  • It can use any real-life UNIX network configuration and monitoring tools. For example, the UNIX route, ifconfig, netstat, tcpdump, traceroute commands can be run on a simulated network to configure or monitor the simulated network.
  • In NCTUns, the setup and usage of a simulated network and application programs are exactly the same as those used in real-world IP networks. For example, each layer-3 interface has an IP address assigned to it and application programs directly use these IP addresses to communicate with each other. For this reason, any person who is familiar with real-world IP networks can easily learn and operate NCTUns in a few minutes. For the same reason, NCTUns can be used as an educational tool to teach students how to configure and operate a real-world network.
  • It can simulate fixed Internet, Wireless LANs, mobile ad hoc (sensor) networks, GPRS networks, and optical networks. A wired network is composed of fixed nodes and point- to-point links. Traditional circuit-switching optical networks and more advanced Optical Burst Switching (OBS) networks are also supported. A wireless networks is composed of IEEE 802.11 (b) mobile nodes and access points (both the ad-hoc mode and infra- structure mode are supported). GPRS cellular networks are also supported.
  • It can simulate various networking devices. For example, Ethernet hubs, switches, routers, hosts, IEEE 802.11 (b) wireless stations and access points, WAN (for purposely delaying/dropping/reordering packets), Wall (wireless signal obstacle), GPRS base station, GPRS phone, GPRS GGSN, GPRS SGSN, optical circuit switch, optical burst switch, QoS DiffServ interior and boundary routers, etc.
  • It can simulate various protocols. For example, IEEE 802.3 CSMA/CD MAC, IEEE 802.

(b) CSMA/CA MAC, learning bridge protocol, spanning tree protocol, IP, Mobile IP, Diffserv (QoS), RIP, OSPF, UDP, TCP, RTP/RTCP/SDP, HTTP, FTP, Telnet, etc.

GETTING STARTED

Setting up the environment

A user using the NCTUns in single machine mode, needs to do the following steps before he/she starts the GUI program:

  1. Set up environment variables:

Before the user can run up the dispatcher, coordinator, or NCTUns GUI program he/she must set up the NCTUNSHOME environment variable.

  1. Start up the dispatcher on terminal 1.
  2. Start up the coordinator on terminal 2.
  3. Start up the nctunsclient on terminal 3.

After the above steps are followed, the starting screen of NCTUns disappears and the user is presented with the working window as shown below:

Drawing a Network Topology

To draw a new network topology, a user can perform the following steps:

Choose Menu->File->Operating Mode-> and make sure that the “Draw Topology” mode is checked. This is the default mode of NCTUns when it is launched. It is only in this mode that a user can draw a new network topology or change an existing simulation topology. When a user

switches the mode to the next mode “ Edit Property”, the simulation network topology can no longer be changed.

  1. Move the cursor to the toolbar.
  2. Left-Click the router icon on the toolbar.
  3. Left-Click anywhere in the blank working area to add a router to the current network topology. In the same way we can add switch, hub, WLAN access point, WLAN mobile node, wall (wireless signal obstacle) etc.
  4. Left-Click the host icon on the toolbar. Like in step 4, add the required number of hosts to the current topology.
  5. To add links between the hosts and the router, left-click the link icon on the toolbar to select it.
  6. Left-Click a host and hold the mouse button. Drag this link to the router and then release the mouse left button on top of the router. Now a link between the selected host and the router has been created.
  7. Add the other, required number of links in the same way. This completes the creation of a simple network topology.
  8. Save this network topology by choosing Menu->File->Save. It is saved with a .tpl extension.
  9. Take the snapshot of the above topology.

Editing Node's Properties

  1. A network node (device) may have many parameters to set. For example, we may have to set the maximum bandwidth, maximum queue size etc to be used in a network interface. For another example, we may want to specify that some application programs (traffic generators) should be run on some hosts or routers to generate network traffic.
  2. Before a user can start editing the properties of a node, he/she should switch the mode from the “Draw Topology” to “Edit Property” mode. In this mode, topology changes can no longer be made. That is, a user cannot add or delete nodes or links at this time.
  3. The GUI automatically finds subnets in a network and generates and assigns IP and MAC addresses to layer 3 network interfaces.
  4. A user should be aware that if he/she switches the mode back to the “Draw Topology” mode when he/she again switches the mode back to the “Edit Topology” mode, node's IP and MAC addresses will be regenerated and assigned to layer 3 interfaces. Therefore the application programs now may use wrong IP addresses to communicate with their partners.

P

Post Analysis

  1. When the user wants to review the simulation results of a simulation case that has been finished before, he /she can run up the GUI program again and then open the case's topology file
  2. The user can switch the mode directly to the “Play Back” mode. The GUI program will then automatically reload the results (including the packet animation trace file and performance log file.
  3. After the loading process is finished, the user can use the control buttons located at the bottom of the screen to view the animation.

Simulation Commands

The following explains the meaning of each job control command:

 Run: Start to run the simulation.

 Pause: Pause the currently -running simulation.

 Continue: Continue the simulation that was just paused.

 Stop: Stop the currently -running simulation

 Abort: Abort the currently running simulation. The difference between “stop” and “abort” is that a stopped simulation job's partial results will be transferred back to GUI files.

 Reconnect: The Reconnect command can be executed to reconnect to a simulation job that was previously disconnected. All disconnected jobs that have not finished their simulations or have finished their simulations but the results have not been retrieved back to be a GUI program by the user will appear in a session table next to the “Reconnect” command. When executing the reconnect command, a user can choose a disconnected job to reconnect from this session table.

 Disconnect: Disconnect the GUI from the currently running simulation job. The GUI now can be used to service another simulation job. A disconnected simulation will be given a session name and stored in a session table. 0 - 12

Part A

EXPERIMENT 1

Simulate a three-node point-to-point network with a duplex link between them. Set the queue size and vary the bandwidth and find the number of packets dropped.

STEPS:

Step1: Select the hub icon on the toolbar and drag it onto the working window.

Step2: Select the host icon on the toolbar and drag it onto the working window. Repeat this for another host icon.

Step3: Select the link icon on the toolbar and drag it on the screen from host (node 1) to the hub and again from host(node 2) to the hub. Here the hub acts as node 3 in the point-to-point network. This leads to the creation of the 3-node point-to-point network topology. Save this topology as a .tpl file.

Step4:Double-click on host(node 1), a host dialog box will open up. Click on Node editor and you can see the different layers- interface, ARP, FIFO, MAC, TCPDUMP, Physical layers. Select MAC and then select full-duplex for switches and routers and half duplex for hubs, and in log Statistics, select Number of Drop Packets, Number of Collisions, Throughput of incoming packets and Throughput of outgoing packets. Select FIFO and set the queue size to 50 and press OK. Then click on Add. Another dialog box pops up. Click on the Command box and type the Command according to the following syntax:

stg [-t duration(sec)] [-p port number]HostIPaddr

and click OK.

Step 5: Double-click on host (node 2), and follow the same step as above with only change in command according to the following syntax: rtg [-t] [-w log] [-p port number] and click OK.

Step 6: Double click on the link between node 1 and the hub to set the bandwidth to some initial value say, 10 Mbps. Repeat the same for the other node.

Step 7: Click on the E button (Edit Property) present on the toolbar in order to save the changes made to the topology. Now click on the R button (RunSimulation). By doing so a user can run/pause/continue/stop/abort/disconnect/reconnect/submit a simulation. No simulation settings can be changed in this mode.

Step 8: Now go to Menu->Simulation->Run. Executing this command will submit he current simulation job to one available simulation server managed by the dispatcher. When the simulation

EXPERIMENT 2

Simulate a four-node point-to-point network and connect the link as follows: Apply a TCP agent between n0 to n3 and apply a UDP agent between n1 and n3. Apply relevant applications over TCP and UDP agents changing the parameters and determine the number of packets sent by two agents.

STEPS:

Step 1: Create the topology as specified in the question, in the draw mode of the simulator.

Step 2: Go to edit mode and save the topology.

Step 3: Setup a TCP connection between node 1 and node 3 using the following commands:

stcp [-p port] [-l writesize] hostIPaddr rtcp [-p port] [-l readsize]

Step 4: Setup a UDP connection between node 2 and node 3 using the following commands:

stg [-u payload size duration] [Host address] rtg [-u] [-w log]

Step 5:Set the output throughput log to determine the number of packets sent by TCP/UDP as described in experiment 1.

Step 6:To view the results, go to the filename.results folder.

PESIT-BSC BE VII Sem CSE 10CSL

The screenshot of the topology is shown below:

/ IS 06CSL77 - 19

The screenshot of the topology is shown below:

EXPERIMENT 4

Simulate an Ethernet LAN using N nodes (6-10), change error rate and data rate and compare throughput.

STEPS:

Step 1: Connect one set of hosts with a hub and another set of hosts also through a hub and connect these two hubs through a switch. This forms an Ethernet LAN.

Step 2: Setup a TCP connection between a host on one hub and host on another hub using the following command:

stcp [-p port] [-l writesize] hostIPaddr rtcp [-p port] [-l readsize]

Step 3: Setup the error rate, data rate in the physical layer, input and output throughput in the mac layer as described above.

Step 4: Change error rate and data rate and compare the

throughputs. Step 5: View the results in the filename.results.