[ns] Script to emulate network between two hosts
emin.gencpinar at gmail.com
Thu Nov 9 03:30:46 PST 2006
Does anyone have any script to emulate the traffic between two hosts ?
Just for packet losses and bandwidth limitations in this network. Or
would anyone show where we can find such an example script ?
We have tried but we could not connect the two hosts, just we use two
ethernet cards over emulator. We use duplex-link to adjust the
traffic, but we could not work that.
set raw1 [new Network/Raw]
set raw2 [new Network/Raw]
#set raw3 [new Network/Raw]
#set raw4 [new Network/Raw]
$raw1 open eth0 readwrite
$raw2 open eth1 readwrite
#$raw3 open eth0 readwrite
#$raw4 open eth0 readwrite
#Tap Agent for each node
Agent/Tap set maxpkt_ 3100
set a1 [new Agent/Tap/Raw "00:12:45:A5:4F:E8"]
#MAC address of server
set a2 [new Agent/Tap/Raw "00:12:43:A4:5F:A7"]
#MAC address of client
#set a3 [new Agent/Tap/Raw "FE:FD:C0:A8:2F:03"]
#set a4 [new Agent/Tap/Raw "FE:FD:C0:A8:2F:04"]
puts "install nets into taps..."
#Assign network objects to TAP agents
$a1 network $raw1
$a2 network $raw2
#$a3 network $raw3
#$a4 network $raw4
$ns duplex-link $node_(1) $node_(2) 500Kb 100ms DropTail
$ns queue-limit $node_(1) $node_(2) 5
#Assign TAP agents to ns-2 nodes
$ns attach-agent $node_(1) $a1
$ns attach-agent $node_(2) $a2
$ns connect $a1 $a2
$ns connect $a2 $a1
Need an answer as soon as possible.
More information about the Ns-users