Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

Experiment No: 7a&b Date: 26/09/2022

Simulation of Standard Ethernet (IEEE 802.3) LAN using Bus topology and analyze the performance
impact of multiple loads and, transmitting at same time using NS2

Name : NISHIKANTH REDDY


Reg. No : 20BLC1045
Faculty Name : Dr. Hemanth C

AIM:
a. To Simulate the Ethernet LAN IEEE 802.3 standard using BUS Topology
b. To analyze the performance of the ETHERNET LAN parameters under multiple loads.

SOFTWARE USED:
Network Simulator (NS2), 2.35 version.

Exercise 1:

Simulate the given ETHERNET LAN using bus topology in NS-2

PROGRAM:

set ns [new Simulator]

set tf [open bus.tr w]


$ns trace-all $tf

set nf [open bus.nam w]


$ns namtrace-all $nf

# create an array to hold all the params


# bandwidh
set n(bw) 1Mb

#prop delay
set n(delay) 10ms

# data link layer II class


set n(ll) LL
# MAC superclass IEEE 802.3
set n(mac) Mac/802_3

# network interface
set n(ifq) Queue/DropTail

# channel class
set n(chan) Channel

if {$argc!=2} {
puts "Usage ns csmacd.tcl <Number of nodes> <number of traffic sources>"
puts "Example ns lab8.tcl 15 2"
}

set n(num) [lindex $argv 0]


set n(nn) [lindex $argv 1]
for {set i 0} {$i<$n(num)} {incr i} {
set node($i) [$ns node]
lappend nl $node($i)
}

$ns make-lan -trace on $nl $n(bw) $n(delay) $n(ll) $n(ifq) $n(mac)


$n(chan)

set nodex [$ns node]


$ns duplex-link $nodex $node(0) 1Mb 10ms DropTail
$ns duplex-link-op $nodex $node(0) orient right

set null(0) [new Agent/Null]


$ns attach-agent $node(0) $null(0)

# set up traffic
for {set i 1} {$i <= $n(nn)} {incr i} {
set udp($i) [new Agent/UDP]
$ns attach-agent $node($i) $udp($i)
set cbr($i) [new Application/Traffic/CBR]
$cbr($i) set packetSize_ 1000
$cbr($i) set rate_ 100Kb
$cbr($i) attach-agent $udp($i)
$ns connect $udp($i) $null(0)
$ns at 0.5 "$cbr($i) start"
$ns at 20.0 "$cbr($i) stop"
}

$ns at 20.5 "finish"

proc finish {} {
global ns nf tf
$ns flush-trace
close $nf
close $tf
exec nam out8.nam &
exit 0
}

$ns run

NAM OUTPUT WINDOW

Output for different number of traffics:

1. Traffic = 1
2. Traffic = 2

3. Traffic = 3

4. Traffic = 5
5. Traffic = 7

6. Traffic = 8

7. Traffic = 9
8. Traffic = 10

OBSERVATION TABLE:

Number of Number of Number of Number of Packet Delivery


Traffic Collisions Generated Received Ratio
Packets Packets
1 0 244 244 1
2 828 488 488 1
3 1707 732 732 1
5 4620 1220 1220 1
7 5806 1708 1708 1
8 4489 1952 1940 0.994
9 3768 2196 2101 0.957
10 3712 2440 2163 0.887

RESULT & INFERENCES:


Here we can see, when the number of traffic increases, the collisions start increasing and after a
certain limit, the BEB limit gets exceeded due to which PDR also starts reducing

You might also like