Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

DC Rec Remaining

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 25

IT18511 -Data Communication and Networking Laboratory

SIMULATION OF DYNAMIC HOST CONFIGURATION PROTOCOL

Exercise No: Date:

AIM: To implement the simulation of the dynamic host configuration protocol using cisco
Packet Tracer.
PROCEDURE
1. Run Cisco Packet Tracer Student.

2. Build the network topology by adding devices (Router, Switch, PC etc.) and connect-
ing them with ethernet cables.

Register No: 2127210801074 Page No:


IT18511 -Data Communication and Networking Laboratory

3. Select the Router and click on CLI – Command Line Interface

4. On the router, configure interface fastEthernet 0/0 to act as the default gateway for
our LAN and specify the IP address.

Register No: 2127210801074 Page No:


IT18511 -Data Communication and Networking Laboratory

5. Configure DHCP server on the Router. In the server define a DHCP pool of IP ad-
dresses to be assigned to hosts, a Default gateway for the LAN and a DNS Server.

6. Click PC->Desktop->IP configuration and enable DHCP for every PC in the network.

Register No: 2127210801074 Page No:


IT18511 -Data Communication and Networking Laboratory

7. Every PC should be able to obtain an IP address, default gateway and DNS server, as
defined in step 4. The configuration can be tested by Ping command.

RESULT:
Simulation of the dynamic host configuration protocol was implemented successfully using
cisco packet tracer.

Register No: 2127210801074 Page No:


IT18511 -Data Communication and Networking Laboratory

ESTABLISH LOCAL AREA NETWORK(LAN)

Exercise No: Date:

Aim: To simulate a Cisco Packet Tracer for Establishing a Local Area Network (LAN) with
4 hosts and a switch/Hub.

PROCEDURE :
STEP 1 : Open Cisco packet Tracer student software in your PC after installing.

STEP 2 :Drag and drop four PCs from the bottom list of devices which is highlighted in the
image.

Register No: 2127210801074 Page No:


IT18511 -Data Communication and Networking Laboratory

STEP 3 : Now Drag and Drop a switch from the same list of devices.

STEP 4 : Now connect all the PC s with the common switch in the middle using cable found
in the bottom area.

Register No: 2127210801074 Page No:


IT18511 -Data Communication and Networking Laboratory

STEP 5 : Now as this is static,we have to assign IP address for each and every PC s by
clicking the PC and click desktop and click IP Configuration the a window like this will
appear where you can give the IP address.And after giving IP address the Subnet Mask will
be created automatically by just clicking that column.And we can close this window now.We
have to repeat this process for all the PC s in our network.

Register No: 2127210801074 Page No:


IT18511 -Data Communication and Networking Laboratory

STEP 6 : Now Try sending a packet from one PC to any other PC in the network by clicking
this Message icon in the right side of the window and click on the Source node and
Destination node.If the message tranfers Successfully , you will get the last status as
Successful.

Result:

Register No: 2127210801074 Page No:


IT18511 -Data Communication and Networking Laboratory

Thus ,the simulation of a Cisco Packet Tracer for Establishing a Local Area Network
(LAN) with 4 hosts and a switch/Hub has been implemented successfully.

Simulation of Cisco Packet Tracer

Exercise No: Date:

AIM: To implement Simulation of Cisco Packet Tracer to Connect two LANs using multi-
router topology with static routes.

Procedure:
Steps to Connect two LANs using multi-router topology with static routes
1. Open Cisco Packet tracer software

2. Drag 4 Pc’s using end device icons

3. Drag 2 cisco’s switches using switch icon list

4. Drag 2 cisco’s routers using router icon list

5. Make the connection between the routers and switches using copper straight trough
cables
6. In the same way connect the switches and the routers using the copper straight trough
cables.

Register No: 2127210801074 Page No:


IT18511 -Data Communication and Networking Laboratory

7.To configure one router to another,click one router ,click on WIC-2T,it will show a
physical view device,in that turn the power off and drag The dual-serial port WAN in-
terface cards (WICs) in to the physical device.

8.do the same step second router and configure both the router using Serial DTE ca-
ble.

Register No: 2127210801074 Page No:


IT18511 -Data Communication and Networking Laboratory

9.Click on the first router ,go to config select FASTETHERNET 0/0 and the port status must
be turned on .Select serial 0/0 /0 and the port status must be turned ON.

10.do the same steps for second router.

11.In the the first router ,go to config select FASTETHERNET 0/0 and type the IP address as
192.168.1.1 and subnet mask will be auto generated.repeat this process again in second router
with IP address 192.168.2.1

12.Click on the PC0 and select desktop and go to IP configuration.Give the IP address as
192.168.1.2
And default Gateway as 192.168.1.1

Register No: 2127210801074 Page No:


IT18511 -Data Communication and Networking Laboratory

13. repeat the step 12 for other 3 pc’s. For pc1 the
IP address is 192.168.1.3
Default Gateway is 192.168.1.1
For Pc2 the
IP address is 192.168.2.2
Default Gateway is 192.168.2.1
For PC3 the
IP address is 192.168.2.3
Default Gateway is 192.168.2.1

14.click on to first router again ,click on config and select SERIAL0/0/0 and write the IP
address as 192.168.3.1
15. Repeat the step 14 again for the second router and write the IP address as 192.168.3.2

Register No: 2127210801074 Page No:


IT18511 -Data Communication and Networking Laboratory

16.Click the first router ,select config and select STATIC,The


Network:192.168.2.0
Mask:255.255.255.0
Next Hop:192.168.3.2
Now select RIP ,
Network:192.168.3.0
192.168.2.0
Repeat this step for second router but the
Network:192.168.1.0
Mask:255.255.255.0
Nexthop:192.168.3.1
Now select RIP Routing the
Network:192.168.3.0
192.168.1.0

Register No: 2127210801074 Page No:


IT18511 -Data Communication and Networking Laboratory

17.Now to execute it,select the data packet ,drop one in source and another in the
destination.click on the simulation and click on auto capture /lay to see the visual movement
of the data packets.once the process in complete it will show the process is successful.

Register No: 2127210801074 Page No:


IT18511 -Data Communication and Networking Laboratory

18. to check the connection is correct select a end device select desktop and select command
prompt and write the follwing commands
Ipconfig

Register No: 2127210801074 Page No:


IT18511 -Data Communication and Networking Laboratory

Ping 192.168.2.2

Result:
Thus the implementation of Simulation of Cisco Packet Tracer to Connect two LANs using
multi-router topology with static routes is executed successfully.

Register No: 2127210801074 Page No:


IT18511 -Data Communication and Networking Laboratory

Study of Network Simulator

Exercise No: Date:

Aim: To study about the working of Network Simulator-2.

Introduction to NS-2:

Widely known as NS2, is simply an event driven simulation tool. Useful in studying the
dynamic nature of communication networks. Simulation of wired as well as wireless network
functions and protocols (e.g., routing algorithms, TCP, UDP) can be done using NS2. In
general, NS2 provides users with a way of specifying such network protocols and simulating
their corresponding behaviors.
Basic Architecture:

Tcl (Tool Command Language) scripting :

• Tcl is a general purpose scripting language. [Interpreter]


• Tcl runs on most of the platforms such as Unix, Windows, and Mac.
• The strength of Tcl is its simplicity.
• It is not necessary to declare a data type for variable prior to the usage.

Wired TCL Script Components :

 Create the event scheduler


 Open new files & turn on the tracing
 Create the nodes
 Setup the links
 Configure the traffic type (e.g., TCP, UDP, etc)
 Set the time of traffic generation (e.g., CBR, FTP)
 Terminate the simulation

Register No: 2127210801074 Page No:


IT18511 -Data Communication and Networking Laboratory

NS Simulator Preliminaries:

1. Initialization and termination aspects of the ns simulator.


2. Definition of network nodes, links, queues and topology.
3. Definition of agents and of applications.
4. The nam visualization tool.
5. Tracing and random variables.

Writing the tclscript include the following steps

i) Define simulator.
Creating a simulator is essential for any NS-2 simulation. It is done using the following
simple codes.
set simulator_name[new Simulator]
ii) Define topology.
In this step, define the area (in terms of size) under which the simulation occurs. WE must
define it keeping in view the possible locations of our nodes.
set topography_name[new Topography]
$topography_nameload_flatgridsize_xsize_y
iii) Define output trace files.
Trace files record events that occur during any simulation like node creation and data
transfer, among others. There are several trace formats and choosing one among them would
depend on the results we are looking for and what the files log. A trace file is defined as
follows.
set handler [open filename w]
$simulator_nametrace_type$handler
iv)Create a wired node): set node_name[$simulator_namenode]

v)After creation of nodes ,establish the connection between nodes using the following code.

$simulator_nameduplex-link $node_name$ap_name bandwidth delay queue_type

vi) Define traffic generator agent and attach it to the source and destination node.
To define the traffic flow, we need to designate the nodes as source or destination and decide the type
of application/traffic. The first step is to define the source agent.
set src_agent_name[new Agent/src_agent_type]
Now define the destination agent and attach it.
set dest_agent_name[new Agent/dest_agent_type].
$simulator_nameattach-agent $dest_node_name$dest_agent_name
It must be noted that source and destination agents form a pair, and though many options are available
for a type of agent, not all of them all compatible with each other. Finally, we can connect the agents.
$simulator_nameconnect $src_agent_name$dest_agent_name
It is necessary to tell the simulator when to start and stop the traffic flow. To do so we schedule events
that control the agent‟s activities.

$simulator_nameatstart_time"$traffic_namestart"
$simulator_nameatstop_time"$traffic_namestop"

Register No: 2127210801074 Page No:


IT18511 -Data Communication and Networking Laboratory

vii)Run simulator.

$simulator_name run

It is necessary to clear variables and close files after the simulation ends. It is customary to create a
procedure for that. $simulator_nameatsimulation_stop_time"proc_name"

proc proc_name{ } {
global vaiable_listfile_list
$simulator_nameflush-trace
close $file_name
exit 0
}

Awk- An Advanced

awk is a programmable, pattern-matching, and processing tool available in UNIX. It works equally well
with text and numbers.

awk is not just a command, but a programming language too. In other words, awk utility is a pattern

Register No: 2127210801074 Page No:


IT18511 -Data Communication and Networking Laboratory

scanning and processing language. It searches one or more files to see if they contain lines that match
specified patterns and then perform associated actions, such as writing the line to the standard output or
incrementing a counter each time it finds a match.

Syntax:

awk option ‘selection_criteria {action}’ file(s)

Here, selection_criteria filters input and select lines for the action component to act upon. The
selection_criteria is enclosed within single quotes and the action within the curly braces. Both the
selection_criteria and action forms an awk program.

How to write AWK code?

The syntax of writing AWK code is straightforward. The general way of


writing the code is as follows.

BEGIN { #starting block to define the variables


……………………
……………………
}
{ #central processing block where all the calculations occur
……………………
……………………
}
END { #finishing block to terminate the code and display results
……………………
……………………
}

Program:
//basic.tcl
set ns [new Simulator]
set nf [open PA1.nam w]
$ns namtrace-all $nf
set tf [open PA1.tr w]
$ns trace-all $tf
proc finish { } {
global ns nftf
$ns flush-trace
close $nf
close $tf
exec nam PA1.nam &
exit 0
}
set n0 [$ns node]
set n2 [$ns node]
set n3 [$ns node]
$ns duplex-link $n0 $n2 200Mb 10ms DropTail

Register No: 2127210801074 Page No:


IT18511 -Data Communication and Networking Laboratory

$ns duplex-link $n2 $n3 1Mb 1000ms DropTail


$ns queue-limit $n0 $n2 10
set udp0 [new Agent/UDP]
$ns attach-agent $n0 $udp0
set cbr0 [new Application/Traffic/CBR]
$cbr0 set packetSize_ 500
$cbr0 set interval_ 0.005
$cbr0 attach-agent $udp0
set null0 [new Agent/Null]
$ns attach-agent $n3 $null0
$ns connect $udp0 $null0
$ns at 0.1 "$cbr0 start"
$ns at 1.0 "finish"
$ns run
//recv_packet.awk
BEGIN{ c=0;}{
if($1=="r")
{ c++;
}}
END{ printf("The number of packets received =%d\n",c); }

Steps for execution:


To execute tcl: ns basic.tcl

To execute nam file: nam PA1.nam

To execute awk file: awk -f recv_packet.awk PA1.tr

Output:

RESULT: Thus the Network Simulator 2 is studied in detail.

Register No: 2127210801074 Page No:


IT18511 -Data Communication and Networking Laboratory

LINK STATE ROUTING

Exercise No: Date:

AIM: To simulate Link State Routing and to study its performance.

SOURCE CODE:
1. Define a set of nodes.
2. Establish link between the nodes and define link attributes.
3. Define a UDP agent and attach it with nodes.
4. Define a Constant bit rate type with needed attributes.
5. Define the sink and connect source and sink.
6. Define link state routing protocol .
7. Define the trace and nam file.
8. Define the finish procedure to simulate the working .
9. Write a AWK code to calculate the number of packets received.
OUTPUT:
To Execute TCL: ns basic.tcl
To Execute nam: nam PA1.nam
To Execute tr: start edit PA1.tr

PA1.nam

PA1.tr
+ 0.00017 0 1 rtProtoLS 100 ------- 0 0.2 1.1 -1 0
- 0.00017 0 1 rtProtoLS 100 ------- 0 0.2 1.1 -1 0
+ 0.007102 2 1 rtProtoLS 100 ------- 0 2.2 1.1 -1 1
- 0.007102 2 1 rtProtoLS 100 ------- 0 2.2 1.1 -1 1
r 0.010174 0 1 rtProtoLS 100 ------- 0 0.2 1.1 -1 0

Register No: 2127210801074 Page No:


IT18511 -Data Communication and Networking Laboratory

+ 0.010174 1 0 rtProtoLS 20 ------- 0 1.1 0.2 -1 2


- 0.010174 1 0 rtProtoLS 20 ------- 0 1.1 0.2 -1 2
+ 0.010174 1 2 rtProtoLS 100 ------- 0 1.1 2.2 -1 3
- 0.010174 1 2 rtProtoLS 100 ------- 0 1.1 2.2 -1 3
r 0.020175 1 0 rtProtoLS 20 ------- 0 1.1 0.2 -1 2
+ 0.27794 1 0 rtProtoLS 100 ------- 0 1.1 0.2 -1 40
- 0.27794 1 0 rtProtoLS 100 ------- 0 1.1 0.2 -1 40
+ 0.27794 1 2 rtProtoLS 100 ------- 0 1.1 2.2 -1 41
- 0.27794 1 2 rtProtoLS 100 ------- 0 1.1 2.2 -1 41

OUTPUT:
To execute awk: awk -f drop_packet.awk PA1.tr

RESULT: Thus the Link State Routing Algorithm was Simulated and studied.

Register No: 2127210801074 Page No:


IT18511 -Data Communication and Networking Laboratory

Distance Vector Routing

Exercise No: Date:

AIM: To simulate Distance Vector Routing and to study its performance.

SOURCE CODE:
1. Define a set of nodes.
2. Establish link between the nodes and define link attributes.
3. Define a UDP agent and attach it with nodes.
4. Define a Constant bit rate type with needed attributes.
5. Define the sink and connect source and sink.
6. Define distance vector routing protocol .
7. Define the trace and nam file.
8. Define the finish procedure to simulate the working .
9. Write a AWK code to calculate the number of packets received.

OUTPUT:
To Execute TCL: ns basic.tcl
To Execute nam: nam PA1.nam
To Execute tr: start edit PA1.tr

PA1.nam

Register No: 2127210801074 Page No:


IT18511 -Data Communication and Networking Laboratory

PA1.tr
+ 0.00017 0 1 rtProtoDV 3 ------- 0 0.2 1.1 -1 0
- 0.00017 0 1 rtProtoDV 3 ------- 0 0.2 1.1 -1 0
+ 0.007102 2 1 rtProtoDV 3 ------- 0 2.2 1.1 -1 1
- 0.007102 2 1 rtProtoDV 3 ------- 0 2.2 1.1 -1 1
r 0.01017 0 1 rtProtoDV 3 ------- 0 0.2 1.1 -1 0
+ 0.27794 1 0 rtProtoDV 3 ------- 0 1.1 0.2 -1 38
- 0.27794 1 0 rtProtoDV 3 ------- 0 1.1 0.2 -1 38
+ 0.27794 1 2 rtProtoDV 3 ------- 0 1.1 2.2 -1 39
- 0.27794 1 2 rtProtoDV 3 ------- 0 1.1 2.2 -1 39
r 0.28794 1 0 rtProtoDV 3 ------- 0 1.1 0.2 -1 38
+ 0.28794 0 1 rtProtoDV 3 ------- 0 0.2 1.1 -1 42
- 0.28794 0 1 rtProtoDV 3 ------- 0 0.2 1.1 -1 42
+ 0.29 0 1 cbr500 ------- 0 0.0 2.0 38 43
- 0.29 0 1 cbr 500 ------- 0 0.0 2.0 38 43
+ 0.295 0 1 cbr 500 ------- 0 0.0 2.0 39 44
- 0.295 0 1 cbr 500 ------- 0 0.0 2.0 39 44
r 0.297941 0 1 rtProtoDV 3 ------- 0 0.2 1.1 -1 42

To execute awk: awk -f drop_packet.awk PA1.tr

RESULT: Thus the Distance vector Routing Algorithm was Simulated and studied.

Register No: 2127210801074 Page No:

You might also like