-
Notifications
You must be signed in to change notification settings - Fork 0
/
iperf-parallel-clients.sh
56 lines (45 loc) · 1.42 KB
/
iperf-parallel-clients.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
# https://sandilands.info/sgordon/doc/code/iperf-parallel-clients
# Run multiple parallel instances of iperf client
# Assumes iperf servers have been started, e.g.
# iperf -s -p PORT
# Examples:
# Run 5 clients for 60 seconds to server 1.1.1.1
# iperf-multiple-clients 1.1.1.1 5 60 report
# 5 files will be created, report-1.1.1.1-5001-60.txt, ...
#
# Run 7 clients for 20 seconds with UDP
# iperf-multipleclients 1.1.1.1 7 20 report-udp -u -b 10M
# Assumes the port numbers used by the servers start at 5001 and increase
# e.g. 5001, 5002, 5003, ...
# If you want something different, then change the following parameter value
# to be: firstport - 1
base_port=5000
# Command line input: server IP address
# E.g. 1.1.1.1
server_ip=$1
shift
# Command line input: number of clients to start
# E.g. 5
num_clients=$1
shift
# Command line input: test duration
# E.g. 60
test_duration=$1
shift
# Command line input: base report file name
# E.g. report
report_base=$1
shift
# Optional/Extra command line input: other iperf options
# E.g. -u -b 10M
iperf_options="$*"
# Run iperf multiple times
for i in `seq 1 $num_clients`; do
# Set server port
server_port=$(($base_port+$i));
# Report file includes server ip, server port and test duration
report_file=${report_base}-${server_ip}-${server_port}-${test_duration}.txt
# Run iperf
iperf -c $server_ip -p $server_port -t $test_duration $iperf_options &> $report_file &
done