[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
ack for TCP (fwd)
Hi, guys,
i got a pretty strange problem. I try to simulate ten tcp conections(start
from node 0 to 9 and target at node 11 in my script) through one RED
gateway(node 10). the matter is that after node 11 get a tcp packet,it
send a ack packet to node 9 no matter from which the packet comes. See the
trace file below:
+ 0 6 10 tcp 1000 ------- 1 6.0 11.0 0 0
- 0 6 10 tcp 1000 ------- 1 6.0 11.0 0 0
+ 0 7 10 tcp 1000 ------- 1 7.0 11.0 0 1
- 0 7 10 tcp 1000 ------- 1 7.0 11.0 0 1
+ 0 8 10 tcp 1000 ------- 1 8.0 11.0 0 2
- 0 8 10 tcp 1000 ------- 1 8.0 11.0 0 2
+ 0 5 10 tcp 1000 ------- 1 5.0 11.0 0 3
- 0 5 10 tcp 1000 ------- 1 5.0 11.0 0 3
+ 0 2 10 tcp 1000 ------- 1 2.0 11.0 0 4
- 0 2 10 tcp 1000 ------- 1 2.0 11.0 0 4
+ 0 1 10 tcp 1000 ------- 1 1.0 11.0 0 5
- 0 1 10 tcp 1000 ------- 1 1.0 11.0 0 5
+ 0 9 10 tcp 1000 ------- 1 9.0 11.0 0 6
- 0 9 10 tcp 1000 ------- 1 9.0 11.0 0 6
+ 0 4 10 tcp 1000 ------- 1 4.0 11.0 0 7
- 0 4 10 tcp 1000 ------- 1 4.0 11.0 0 7
+ 0 3 10 tcp 1000 ------- 1 3.0 11.0 0 8
- 0 3 10 tcp 1000 ------- 1 3.0 11.0 0 8
+ 0 0 10 tcp 1000 ------- 1 0.0 11.0 0 9
- 0 0 10 tcp 1000 ------- 1 0.0 11.0 0 9
r 0.00508 1 10 tcp 1000 ------- 1 1.0 11.0 0 5
+ 0.00508 10 11 tcp 1000 ------- 1 1.0 11.0 0 5
- 0.00508 10 11 tcp 1000 ------- 1 1.0 11.0 0 5
r 0.00508 0 10 tcp 1000 ------- 1 0.0 11.0 0 9
+ 0.00508 10 11 tcp 1000 ------- 1 0.0 11.0 0 9
- 0.00532242 10 11 tcp 1000 ------- 1 0.0 11.0 0 9
r 0.0103224 10 11 tcp 1000 ------- 1 1.0 11.0 0 5
+ 0.0103224 11 10 ack 40 ------- 1 11.0 9.0 0 10
The last two line show the problem. the sink gets a packet from node 1 but
sends ack to node 9. How can this happens?
Here is my script file:
#Create a simulator object
set ns [new Simulator]
#Open the nam trace file
set f [open out.tr w]
$ns trace-all $f
set nf [open out.nam w]
$ns namtrace-all $nf
set flow_stat [open flow.stat w]
set flowmon_10 [$ns makeflowmon Fid]
#Define a 'finish' procedure
proc finish {} {
global ns f nf
$ns flush-trace
#Close the trace file
close $f
close $nf
exec nam out.nam &
exit 0
}
proc set_flowMonitor {flowmon output_chan} {
$flowmon attach $output_chan
set bytesInt_ [new Integrator]
set pktsInt_ [new Integrator]
$flowmon set-bytes-integrator $bytesInt_
$flowmon set-pkts-integrator $pktsInt_
return $flowmon
}
#Create 12 nodes
for {set i 0} {$i < 12} {incr i} {
set n($i) [$ns node]
}
#Create links between the nodes
$ns duplex-link $n(0) $n(10) 100Mb 5ms DropTail
$ns duplex-link $n(1) $n(10) 100Mb 5ms DropTail
$ns duplex-link $n(2) $n(10) 100Mb 15ms DropTail
$ns duplex-link $n(3) $n(10) 100Mb 15ms DropTail
$ns duplex-link $n(4) $n(10) 100Mb 20ms DropTail
$ns duplex-link $n(5) $n(10) 100Mb 20ms DropTail
$ns duplex-link $n(6) $n(10) 100Mb 30ms DropTail
$ns duplex-link $n(7) $n(10) 100Mb 30ms DropTail
$ns duplex-link $n(8) $n(10) 100Mb 45ms DropTail
$ns duplex-link $n(9) $n(10) 100Mb 45ms DropTail
$ns duplex-link $n(10) $n(11) 33Mb 5ms RED
$ns queue-limit $n(10) $n(11) 100
$ns attach-fmon [$ns link $n(10) $n(11)] $flowmon_10 0
set_flowMonitor $flowmon_10 $flow_stat
Queue/RED set thresh_ 10
Queue/RED set maxthresh_ 30
Queue/RED set linterm_ 50
Queue/RED set q_weight_ 0.002
set tcp_snk [new Agent/TCPSink]
$ns attach-agent $n(11) $tcp_snk
#Creat Traffic for 10 nodes
for {set i 0} {$i < 10} {incr i} {
set tcp($i) [new Agent/TCP]
$tcp($i) set fid_ $i
$tcp($i) set class_ 1
$ns attach-agent $n($i) $tcp($i)
set ftp($i) [new Source/FTP]
$ftp($i) set agent_ $tcp($i)
$ns connect $tcp($i) $tcp_snk
}
for {set i 0} {$i < 10} {incr i} {
$ns at 0 "$ftp($i) start"
$ns at 50 "$ftp($i) stop"
}
#Call the finish procedure after 5 seconds of simulation time
$ns at 50 "$flowmon_10 dump"
$ns at 55 "finish"
#Run the simulation
$ns run
Anyone met such problem before? Any hint will be highly appreciated.
James Tong