[ns] pcap file usage in simulation

mosesw mwoldese at ee.ucl.ac.uk
Wed Jan 21 05:55:06 PST 2009


Hi all, 

I would appreciate it if you could help me. I am having the same problem,
which is importing traced traffic (file) into ns2.31. 
what do I need to make it work Network/File? 
which ns version do i need to use? 

Any solution, link, script or code will be helpful. 

Cheers, 
moses

Larry Brigman wrote:
> 
> 
> I am needing to run a simulation in NS2 that uses
> pcap or tcpdump trace files as the traffic in the test.
> 
> I don't get any errors with this but I also don't get any traffic.
> Do I need to explicitly set routing or is there something else I am
> missing?
> 
> My no-error-non-working example
> #Create a simulator object
> set ns [new Simulator]
> $ns use-scheduler Heap
> 
> #Open the NAM trace file
> set nf [open pcap_ex.nam w]
> $ns namtrace-all $nf
> 
> $ns color 400 Green
> $ns color 500 Yellow
> $ns color 900 Red
> 
> #Define a 'finish' procedure
> proc finish {} {
>         global ns nf
>         $ns flush-trace
>         #Close the NAM trace file
>         close $nf
>         exit 0
> }
> 
> 
> ###### Setup the Network ############################
> set r(0) [ $ns node ]
> set r(1) [ $ns node ]
> 
> ####### Create the network links between nodes ######
> set BANDWIDTH 80Mb
> set DELAY 10us
> $ns simplex-link $r(0) $r(1) $BANDWIDTH $DELAY DropTail
> 
> $ns simplex-link-op $r(0) $r(1) orient right
> 
> ######## Setup the traffic types ########
> set pcap0 [new Network/Pcap/File ]
> ##### open the trace file
> $pcap0 open readonly network.dump
> 
> set null [new Agent/Null]
> set tap0 [new Agent/Tap]
> $ns attach-agent $r(1) $null
> $tap0 network $pcap0
> $ns attach-agent $r(0) $tap0
> 
> ####### Notify that we are starting the run...
> puts "Starting run..."
> 
> ####### Run the above configured simulation
> $ns run
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/pcap-file-usage-in-simulation-tp11018312p21583592.html
Sent from the ns-users mailing list archive at Nabble.com.



More information about the Ns-users mailing list