绑定失败:使用iperf时已经使用的地址

时间:2017-10-01 21:36:52

标签: shell tcpdump iperf

我想在mininet中模拟5台主机的流量。以这种方式,host2,host 3,host4和host5使用iperf向host1发送tcp流量。我想同时发送iperf流量。 (并行)我写了一个shell代码来做到这一点。这是我的代码:

for Testduration in 10 20
do
for thread in 1 2 4 6
do
#Edit the attaker info here
hostnum=host2
attacker=10.0.0.2

echo “Test performing with $Testduration duration and $thread threads attacker ”
sudo tcpdump -G $Testduration -W 5 -w /tmp/scripttest-duration-$Testduration-thread-$thread -i h1-eth0 &\ 

pksize2=$(($RANDOM%1000+200))
pksize3=$(($RANDOM%1000+200))
pksize4=$(($RANDOM%1000+200))
pksize5=$(($RANDOM%1000+200))

#Attacker Host
iperf -c $attacker -t $Testduration -r -P $thread   >> /media/sf_sharedsaeed/throughtput/iperthroughput-$hostnum-attack-duration-$Testduration-thread-$thread.txt &
P0=$!

iperf -c 10.0.0.2 -t $Testduration -r -l $pksize2  >> /media/sf_sharedsaeed/throughtput/iperthroughput-host2-duration-$Testduration-thread-$thread.txt &
P1=$!

iperf -c 10.0.0.3  -t $Testduration -r -l $pksize3   >> /media/sf_sharedsaeed/throughtput/iperthroughput-host3-duration-$Testduration-thread-$thread.txt &
P2=$!

iperf -c 10.0.0.4 -t $Testduration -r -l $pksize4  >> /media/sf_sharedsaeed/throughtput/iperthroughput-host4-duration-$Testduration-thread-$thread.txt &
P3=$!

iperf -c 10.0.0.5 -t $Testduration -r -l $pksize5  >> /media/sf_sharedsaeed/throughtput/iperthroughput-host5-duration-$Testduration-thread-$thread.txt &
P5=$!

wait $P0 $P1 $P2 $P3 $P4 $P5

sudo tcpdump -r /tmp/scripttest-duration-$Testduration-thread-$thread > /media/sf_sharedsaeed/scripttest-duration-$Testduration-thread-$thread.txt

done
done

但是我收到以下错误:

enter image description here

我应该提一下,当我使用host2作为守护进程主机时,我遇到了这个问题!

你能帮助我吗?

0 个答案:

没有答案