0% found this document useful (0 votes)
43 views4 pages

Panimalar Engineering College: Department of Cse

This document describes a simulation of routing protocols using the Network Simulator (ns). It creates 11 nodes connected in a network topology and simulates data transfer between two nodes using Constant Bit Rate (CBR) traffic. The simulation tests the Distance Vector routing protocol and models link failures and recoveries to observe their effects on routing tables and data transfer.

Uploaded by

Navin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views4 pages

Panimalar Engineering College: Department of Cse

This document describes a simulation of routing protocols using the Network Simulator (ns). It creates 11 nodes connected in a network topology and simulates data transfer between two nodes using Constant Bit Rate (CBR) traffic. The simulation tests the Distance Vector routing protocol and models link failures and recoveries to observe their effects on routing tables and data transfer.

Uploaded by

Navin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

PANIMALAR ENGINEERING COLLEGE

DEPARTMENT OF CSE
211416104185

SIMULATION OF ROUTING PROTOCOLS


DISTANCE VECTOR AND LINK STATE ROUTING

Routingprotocol.tcl

set ns [new Simulator]

set nr [open thro.tr w]

$ns trace-all $nr

set nf [open thro.nam w]

$ns namtrace-all $nf

proc finish { } {

global ns nr nf

$ns flush-trace

close $nf

close $nr

exec nam thro.nam &

exit 0

for { set i 0 } { $i < 12} { incr i 1 } {

set n($i) [$ns node]}

for {set i 0} {$i < 8} {incr i} {

$ns duplex-link $n($i) $n([expr $i+1]) 1Mb 10ms DropTail }

$ns duplex-link $n(0) $n(8) 1Mb 10ms DropTail

$ns duplex-link $n(1) $n(10) 1Mb 10ms DropTail


PANIMALAR ENGINEERING COLLEGE
DEPARTMENT OF CSE
211416104185
$ns duplex-link $n(0) $n(9) 1Mb 10ms DropTail

$ns duplex-link $n(9) $n(11) 1Mb 10ms DropTail

$ns duplex-link $n(10) $n(11) 1Mb 10ms DropTail

$ns duplex-link $n(11) $n(5) 1Mb 10ms DropTail

set udp0 [new Agent/UDP]

$ns attach-agent $n(0) $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 $n(5) $null0

$ns connect $udp0 $null0

set udp1 [new Agent/UDP]

$ns attach-agent $n(1) $udp1

set cbr1 [new Application/Traffic/CBR]

$cbr1 set packetSize_ 500

$cbr1 set interval_ 0.005

$cbr1 attach-agent $udp1

set null0 [new Agent/Null]

$ns attach-agent $n(5) $null0

$ns connect $udp1 $null0


PANIMALAR ENGINEERING COLLEGE
DEPARTMENT OF CSE
211416104185
$ns rtproto DV

$ns rtmodel-at 10.0 down $n(11) $n(5)

$ns rtmodel-at 15.0 down $n(7) $n(6)

$ns rtmodel-at 30.0 up $n(11) $n(5)

$ns rtmodel-at 20.0 up $n(7) $n(6)

$udp0 set fid_ 1

$udp1 set fid_ 2

$ns color 1 Red

$ns color 2 Green

$ns at 1.0 "$cbr0 start"

$ns at 2.0 "$cbr1 start"

$ns at 45 "finish"

$ns run
PANIMALAR ENGINEERING COLLEGE
DEPARTMENT OF CSE
211416104185
OUTPUT:

You might also like