Hallo list,
I've got a very simple nse setup and want nam to visualize some
iperf-generated udp flow. I'm pretty sure I miss something relevant, since
nam does not show any flow.
Can anybody tell me which lines I have to include in order to get some
graphical feedback?
The script simply forwards incomming traffic from eth0 to eth1 and vice
versa.
Thank you,
Michael
################### SCRIPT #####################
set ns [new Simulator]
$ns use-scheduler RealTime
set me [exec hostname]
set nf [open "|nam -r 0.1 -" w]
$ns namtrace-all $nf
proc finish {} {
global ns nf
$ns flush-trace
close $nf
exec nam out.nam &
exit 0
}
# Procedure needed when running nam in real-time
proc NamTime {} {
# Send time to nam periodically
global ns nf
set now [$ns now]
set next [expr $now + 0.05]
puts $nf "T -t $now"
flush $nf
$ns at $next "NamTime"
}
set n0 [$ns node]
set n1 [$ns node]
$ns duplex-link $n0 $n1 1000Mb 0ms DropTail
# Configure the first entry node
set tap0 [new Agent/Tap]; # Create the TCPTap Agent
set bpf0 [new Network/Pcap/Live]; # Create the bpf
set dev [$bpf0 open readonly eth0]
$bpf0 filter "src 192.168.0.1 and dst 10.0.0.1";
$tap0 network $bpf0; # Connect bpf to TCPTap Agent
$ns attach-agent $n0 $tap0; # Attach TCPTap Agent to the node
# Configure the second entry node
set tap1 [new Agent/Tap]; # Create the TCPTap Agent
set bpf1 [new Network/Pcap/Live]; # Create the bpf
set dev [$bpf1 open readonly eth1]
$bpf1 filter "src 10.0.0.1 and dst 192.168.0.1";
$tap1 network $bpf1; # Connect bpf to TCPTap Agent
$ns attach-agent $n1 $tap1; # Attach TCPTap Agent to the node
# Configure the first exit node
set tap2 [new Agent/Tap]; # Create a TCPTap Agent
set ipnet0 [new Network/IP]; # Create a Network agent
$ipnet0 open writeonly
$tap2 network $ipnet0; # Connect network agent to tap agent
$ns attach-agent $n0 $tap2; # Attach agent to the node.
# Configure the second exit node
set tap3 [new Agent/Tap]; # Create a TCPTap Agent
set ipnet1 [new Network/IP]; # Create a Network agent
$ipnet1 open writeonly
$tap3 network $ipnet1; # Connect network agent to tap agent
$ns attach-agent $n1 $tap3; # Attach agent to the node.
# Connect the agents.
$ns simplex-connect $tap0 $tap2
$ns simplex-connect $tap1 $tap3
$ns at 0.5 "NamTime"
$ns at 3600.0 "finish"
$ns run