2017-10-01 5 views
0

mininet에서 5 개의 호스트 트래픽을 시뮬레이트하고 싶습니다. 그런 식으로 host2, host 3, host4 및 host5는 iperf를 사용하여 tcp 트래픽을 host1에 보냅니다. 같은 시간에 iperf 트래픽을 보내려고합니다. (병렬로) 나는 그렇게하기 위해 쉘 코드를 작성했다. 여기 내 코드는 다음과 같습니다 바인드 실패 : iperf 사용 중 주소가 이미 사용 중입니다.

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에 사용할 때이 문제가!

도와 주시겠습니까?

답변

1

어떤 iperf 버전을 사용하고 있습니까? iperf -v가 이것을 줄 것이다.

+0

답장을 보내 주셔서 감사합니다. 그것은 iperf 버전 2.0.5 (2010 년 7 월 8 일) pthreads입니다. – Reza

+1

코드의이 영역에 버그가 있습니다. 최신 버전을 사용해 볼 수 있습니까? 2.0.10? https://sourceforge.net/projects/iperf2/ – rjmcmahon

+0

또한 파이썬으로 작성된 플로우 코드를 사용해보십시오. 그것은 파이썬 3.5 이상, ssh 암호없는 명령 및 asyncio를 요구합니다. 이 시점에서 매우 초기 단계 코드입니다. https://sourceforge.net/p/iperf2/code/ci/master/tree/flows/tcp_basic.py – rjmcmahon

관련 문제