2016年4月5日 星期二

iperf使用範例

iperf是用來產生網路流量,可以用來測試網路設備,
# iperf -h
Usage: iperf [-s|-c host] [options]
       iperf [-h|--help] [-v|--version]

Client/Server:
  -f, --format    [kmKM]   format to report: Kbits, Mbits, KBytes, MBytes
  -i, --interval  #        seconds between periodic bandwidth reports
  -l, --len       #[KM]    length of buffer to read or write (default 8 KB)
  -m, --print_mss          print TCP maximum segment size (MTU - TCP/IP header)
  -o, --output     output the report or error message to this specified file
  -p, --port      #        server port to listen on/connect to
  -u, --udp                use UDP rather than TCP
  -w, --window    #[KM]    TCP window size (socket buffer size)
  -B, --bind         bind to , an interface or multicast address
  -C, --compatibility      for use with older versions does not sent extra msgs
  -M, --mss       #        set TCP maximum segment size (MTU - 40 bytes)
  -N, --nodelay            set TCP no delay, disabling Nagle's Algorithm
  -V, --IPv6Version        Set the domain to IPv6

Server specific:
  -s, --server             run in server mode
  -U, --single_udp         run in single threaded UDP mode
  -D, --daemon             run the server as a daemon

Client specific:
  -b, --bandwidth #[KM]    for UDP, bandwidth to send at in bits/sec
                           (default 1 Mbit/sec, implies -u)
  -c, --client       run in client mode, connecting to 
  -d, --dualtest           Do a bidirectional test simultaneously
  -n, --num       #[KM]    number of bytes to transmit (instead of -t)
  -r, --tradeoff           Do a bidirectional test individually
  -t, --time      #        time in seconds to transmit for (default 10 secs)
  -F, --fileinput    input the data to be transmitted from a file
  -I, --stdin              input the data to be transmitted from stdin
  -L, --listenport #       port to receive bidirectional tests back on
  -P, --parallel  #        number of parallel client threads to run
  -T, --ttl       #        time-to-live, for multicast (default 1)
  -Z, --linux-congestion   set TCP congestion control algorithm (Linux only)

Miscellaneous:
  -x, --reportexclude [CDMSV]   exclude C(connection) D(data) M(multicast) S(settings) V(server) reports
  -y, --reportstyle C      report as a Comma-Separated Values
  -h, --help               print this message and quit
  -v, --version            print version information and quit


產生IPv6的封包: -V, --IPv6Version Set the domain to IPv6
Server:
$ iperf -V -s -i 5

Client
$ iperf -V -c 2001:2222::2 -t 172800 -i 5 -u


產生TCP的封包: 預設為TCP封包
Server
$ iperf -s -i 5

Client
$ iperf -c 192.168.1.100 -t 172800 -i 5


產生UDP的封包: -u, --udp use UDP rather than TCP
Server
$ iperf -s -i 5 -u

Client
$ iperf -c 192.168.1.100 -t 172800 -i 5 -u


產生指定Port number的封包: -p, --port # server port to listen on/connect to
Server
$ iperf -s -i 5 -p 100 -u

Client
$ iperf -c 192.168.1.100 -t 172800 -i 5 -p 100 -u


產生指定Bandwidth的流量: -b, --bandwidth #[KM] for UDP, bandwidth to send at in bits/sec
Server
$ iperf -s -i 5 -u

Client
$ iperf -c 192.168.1.100 -t 172800 -i 5 -b 10M -u


產生DSCP的封包: 7 (28/ 4)的封包
Server
$ iperf -s -i 5 -u

Client
$ iperf -c 192.168.1.100 -t 172800 -i 5 -S 28 -u


產生指定Payload size的封包: 1200 bytes的封包
Server
$ iperf -s -i 5 -u

Client
$ iperf -c 20.1.1.100 -t 20 -i 5 -u -l 1200
參考來源
https://iperf.fr/
https://iperf.fr/iperf-doc.php

沒有留言:

張貼留言