Abdul,

Many thanks for your response and clarification.

When you say that traffic on the LAN is broadcast to all hosts, do you mean 
all nodes receive the traffic BUT the packets are dropped and not logged as 
received if the host is not the intended recipient? If this is correct, am 
I right in thinking that all other nodes on the LAN are performing this 
each time a packet is sent between 2 hosts?

The way I've created the LAN is probably non-standard, but it works! I use 
a for loop rather than having to define each individual node and attach 
them together. Using variables like opt(node) helps me to quickly 
substitute variables to test different topologies.

Regarding the loop, yes, you are correct. A 10th node would be created in 
this instance. However, as you point out, it still doesn't explain why that 
node receives traffic when the UDP sink is explicitly attached to node9. 
Should the labelling of the nodes in the log file completely reflect how 
they are defined in the code (e.g. node0 - node10 rather than starting at 
1?)

Thanks again,

Hayden.


On Jan 23 2010, Abdul Serwadda wrote:

> Although traffic on an ethernet LAN is broadcast to all nodes, only the
> designated recipient actually receives this traffic. The network adaptors
> for the other nodes do not forward this traffic to their attached hosts.
> Hence, effectively, communication is essentially between source and
> designated destination. Although am not so familiar with your technique of
> creating the LAN, i can see that node 10 exists in your code. I dont
> understand why you say that it doesn't exist!
> Chech out below:
> 
> #Create the nodes
> set num $opt(node)
>    for {set i 0} {$i < $num} {incr i} {
>        set node($i) [$ns node]
>        lappend nodelist $node($i)
>    }
> 
> since you set set opt(node) as 10, your loop will still increment i when 
> num=9. hence the final value of num will be 10. I however fail to 
> understand why node 10 receives any traffic!
> 
> On Sat, Jan 23, 2010 at 7:24 PM, Hayden Tomlins 
> <tomli...@cs.man.ac.uk>wrote:
> 
> >
> > Hi All,
> >
> > I'm wondering if someone can confirm this behaviour for me, as it's not
> > quite what I expected.
> >
> > I have built a network in ns-2 consisting of 10 nodes. These are 
> > joined together as a LAN using 'newLan[node0, node1...]'. My aim is to 
> > simulate an equivalent hardware set up using a measured network delay, 
> > varying the number of nodes and with/without channel noise. I have 
> > created a UDP agent, attached it to node0 and attached a CBR source to 
> > it. I've got a sink on node9 to receive the traffic and am monitoring 
> > the queue here to calculate the throughput (I have separate code for 
> > that).
> >
> > In my trace file when everything is logged (trace-all), I only see 
> > communication between nodes 0 and 10 and nodes 9 and 10, even though 
> > node '10' doesn't exist in the code! An I overlooking something 
> > fundamental here? My understanding is that traffic sent to one node in 
> > a LAN is broadcast to all others and this is the behaviour I need. Do I 
> > need to have another node outside the network and connect this to a LAN 
> > node as well?
> >
> > I can't find anything of sufficient detail in the on line resources.
> >
> > My code is listed below:
> >
> >
> > set opt(tr)       "out.tr"
> > set opt(namtr)    "outnam.nam"
> >
> > set opt(node)   10
> > set opt(qsize)  100
> > set opt(bw)     100Mb
> > set opt(delay)  1ms        ;#Channel delay
> > set opt(ll)     LL
> > set opt(ifq)    Queue/DropTail
> > set opt(mac)    Mac/802_3
> > set opt(chan)   Channel
> >
> > set ns [new Simulator]
> >
> > #Define trace file and what to capture
> > set tracefile [open $opt(tr) w]
> > $ns trace-all $tracefile
> >
> > #Define NAM trace
> > set namfile [open $opt(namtr) w]
> > $ns namtrace-all $namfile
> >
> > #Differentiate the packet streams in NAM
> > $ns color 1 Blue
> > $ns color 2 Red
> >
> > #Create the nodes
> > set num $opt(node)
> >    for {set i 0} {$i < $num} {incr i} {
> >        set node($i) [$ns node]
> >        lappend nodelist $node($i)
> >    }
> >
> > #Make the nodes into a LAN set lan0 [$ns newLan $nodelist $opt(bw)
> > $opt(delay) -llType $opt(ll) -ifqType $opt(ifq) -macType $opt(mac)
> > -chanType $opt(chan)]
> >
> > #Set up udp agent i.e. UA
> > set udp0 [new Agent/UDP]
> > $ns attach-agent $node(0) $udp0
> >
> > #Set up udp sink i.e. SA / DA
> > set null0 [new Agent/Null]
> > $ns attach-agent $node(9) $null0
> >
> > #Connect UA to SA / DA
> > $ns connect $udp0 $null0
> > $udp0 set fid_ 2
> > $udp0 set class_ 1
> >
> > #Set up a cbr source over udp to simulate traffic
> > set cbr0 [new Application/Traffic/CBR]
> >
> > #Packet MTU size is 1400
> > $cbr0 set packetSize_ 1400
> > $cbr0 set interval_ 0.005
> > $cbr0 set random_ 1
> > $cbr0 attach-agent $udp0
> > #$cbr0 attach-agent $udp1
> >
> > proc finish {} {
> >      global ns nam namfile tracefile opt
> >        $ns flush-trace
> >      puts "Simulation Completed"
> >      #Close the trace and nam files
> >        close $namfile
> >      close $tracefile
> >      puts "Running nam..."
> >      #Execute nam on trace
> >        exec nam $opt(namtr) &
> >        exit 0
> > }
> >
> > #When does everything happen
> > $ns at 1 "$cbr0 start"
> > $ns at 10 "finish"
> >
> > $ns run
> >
> >
> > Grateful for any advice.
> >
> > Kind regards,
> >
> > Hayden.
> >
> > --
> > Hayden Tomlins
> > MSc Student
> >
> > School of Computer Science
> > The University of Manchester
> >
> >
> 

-- 
Hayden Tomlins,
Modular Student (2006 Entry)
MSc Advanced Computer Science with ICT Management

School of Computer Science
The University of Manchester
E-mail:     tomli...@cs.man.ac.uk
Tel:        +44(0)7837 991310

Reply via email to