Hello,
I want to simulate a LAN with CSMA/CD. Since the Mac/Csma/Cd Class seems
to be not supported anymore (and I never managed to get it running), I
use Mac/802_3. I attached the script at the end of the mail.
This I can get it to work, but I don't understand the results. When I
watch the NAM animation, every packet sent on the LAN seems to be sent
twice and only the second one is taken by the receiver. Also, the first
of these duplicate messages appears in the trace-file only as an event
type 'h' - no enqueue, no dequeue and no receive-event. Here are the
first few lines of the trace:
+ 0.1 0 1 tcp 40 ------- 1 0.0 4.0 0 0
- 0.1 0 1 tcp 40 ------- 1 0.0 4.0 0 0
r 0.1516 0 1 tcp 40 ------- 1 0.0 4.0 0 0
h 0.1516 1 6 tcp 40 ------- 1 0.0 4.0 0 0
+ 0.1916 1 6 tcp 40 ------- 1 0.0 4.0 0 0
- 0.1916 1 6 tcp 40 ------- 1 0.0 4.0 0 0
r 0.232628 6 4 tcp 40 ------- 1 0.0 4.0 0 0
h 0.232628 4 6 ack 40 ------- 1 4.0 0.0 0 1
+ 0.272628 4 6 ack 40 ------- 1 4.0 0.0 0 1
- 0.272628 4 6 ack 40 ------- 1 4.0 0.0 0 1
r 0.313656 6 1 ack 40 ------- 1 4.0 0.0 0 1
...
It looks a bit like this is some kind of channel-reservation message,
but I have never heard that 802.3 with CSMA/CD uses a reservation mechanism.
Can anyone explain this behaviour? And what do the 'h'-events in the
trace mean?
Thank you very much for all kinds of help!
Georg
set ns [new Simulator]
#Tracing
set tracefile1 [open out.tr w]
$ns trace-all $tracefile1
set namfile [open out.nam w]
$ns namtrace-all $namfile
#Define a 'finish' procedure
proc finish {} {
global ns tracefile1 namfile
$ns flush-trace
close $tracefile1
close $namfile
exec nam out.nam &
exit 0
}
#Create 6 nodes
set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]
set n4 [$ns node]
set n5 [$ns node]
# LAN
set lan [$ns make-lan -trace on "$n1 $n2 $n3 $n4 $n5" 0.5Mb 40ms LL
Queue/DropTail Mac/802_3]
$ns duplex-link $n0 $n1 0.2Mb 50ms DropTail
$ns duplex-link-op $n0 $n1 orient right
#Setup a TCP connection
set tcp [new Agent/TCP/Newreno]
$ns attach-agent $n0 $tcp
set sink [new Agent/TCPSink]
$ns attach-agent $n4 $sink
$ns connect $tcp $sink
#Setup a FTP over TCP connection
set ftp [new Application/FTP]
$ftp attach-agent $tcp
$ns at 0.1 "$ftp start"
$ns at 5.0 "$ftp stop"
$ns at 5.5 "finish"
$ns run