[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ns] emulation problems



Hi��all

I installed FreeBSD in a PC. I wrote a tcl file and run it on NSE. 
Following figure is the topology.


	   +--------------+       +---------------+           +--------------+
	   | 192.168.0.47 |	<---->| 192.168.0.139 |	 <---->   | 192.168.0.53 |
	   +--------------+	      +---------------+           +--------------+
			client												server
			win2000              FreeBSD						win2000


I want to use 192.168.0.139 to emulate RAW IP package drop, delay and reorder.
I added static route in both client and server as: (1) route add 192.168.0.53 mask 255.255.255.255 192.168.0.139; (2) route add 192.168.0.47 mask 255.255.255.255 192.168.0.139, respectively. 

Now client and server can ping each other. The tcl file is:
############### start
set owdelay 10ms

set clientaddr "192.168.0.47"
set serveraddr "192.168.0.53"
set ns [new Simulator] 

$ns use-scheduler RealTime

set ipforw [exec sysctl -n net.inet.ip.forwarding]
if { $ipforw } 
{
	puts "can not run with ip forwarding enabled"
	exit 1
}

set card0 [new Network/Pcap/Live]
$card0 set promisc_ true
$card0 open readonly rl0; #r10 is the net interface

set IPout [new Network/IP]
$IPout open writeonly

$card0 filter "dst $clientaddr or dst $serveraddr"; # only packets for client and server

set AgentCard [new Agent/Tap]
set AgentOut [new Agent/Tap]

$AgentCard network $card0 
$AgentOut network $IPout

set node0 [$ns node]
set node1 [$ns node]

$ns simplex-link $node0 $node1 100Mb $owdelay DropTail

$ns attach-agent $node0 $AgentCard
$ns attach-agent $node1 $AgentOut

$AgentCard target $AgentOut;  #???_(1)
$ns simplex-connect $AgentCard $AgentOut

puts "start..."
puts "The MAC address is: [$card0 linkaddr]"
$ns run ; # start emulation
############### end
                                           
My question is: 
1.	I deem one net card is enough for my application in 192.168.0.139. Is that right?
2.  If I delete the line marked with "???_(1)", when client pings server, nse will complain:

ns: scheduler going backwards in time from 10.671681 to 10.669548
ns: scheduler going backwards in time from 10.675796 to 10.671762
ns: scheduler going backwards in time from 10.680889 to 10.677453
.....

at the same time, client(win2000) prints:

Reply from 192.168.0.47: bytes=32 time=20ms TTL=128
Reply from 192.168.0.47: bytes=32 time=30ms TTL=128
Reply from 192.168.0.47: bytes=32 time=50ms TTL=128
Reply from 192.168.0.47: bytes=32 time=60ms TTL=128
Reply from 192.168.0.47: bytes=32 time=130ms TTL=128
Reply from 192.168.0.47: bytes=32 time=130ms TTL=128
Reply from 192.168.0.47: bytes=32 time=401ms TTL=128
Reply from 192.168.0.47: bytes=32 time=130ms TTL=128
Reply from 192.168.0.47: bytes=32 time=130ms TTL=128
Reply from 192.168.0.47: bytes=32 time=120ms TTL=128
Reply from 192.168.0.47: bytes=32 time=130ms TTL=128
......

I want to know where the bug is and why I cannot control the delay time.

3. If I do not delete the line "$AgentCard target $AgentOut;  #???_(1)", NSE will not complain but the delay 
will remain as 50ms:

C:\>PING 192.168.0.47 -t
Pinging 192.168.0.47 with 32 bytes of data:

Reply from 192.168.0.47: bytes=32 time<10ms TTL=128
Reply from 192.168.0.47: bytes=32 time=20ms TTL=128
Reply from 192.168.0.47: bytes=32 time=30ms TTL=128
Reply from 192.168.0.47: bytes=32 time=50ms TTL=128
Reply from 192.168.0.47: bytes=32 time=51ms TTL=128
Reply from 192.168.0.47: bytes=32 time=50ms TTL=128
Reply from 192.168.0.47: bytes=32 time=50ms TTL=128
Reply from 192.168.0.47: bytes=32 time=50ms TTL=128
Reply from 192.168.0.47: bytes=32 time=50ms TTL=128


I found nse duplicated every package thousands times and sent them. Why? And how to amend the tcl file to realize the RAW IP delay and drop emulation.?
These problems are harassing me for weeks.  :(
Any help will be appreciated. Thank you.
 
            zhi guo
            fetus_box@yahoo.com


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com