UNIX/Redhat

[스크랩] 네트워크 속도체크 (iperf - network bandwidth check 옵션)

99iberty 2014. 1. 7. 17:06

http://sfixer.tistory.com/87

 

TCP 를 통해서 Newwrok Throughput 을 확인하는 툴이다. (UDP도 가능)

영어로 된 옵션들 보기 좋으라고 간단하게 한글로 썼다.

클라이어트 모드 -c 옵션 주면 된다

#iperf -c 10.1.1.1

------------------------------------------------------------

Client connecting to 10.1.1.1, TCP port 5001

TCP window size: 16384 Byte (default)

------------------------------------------------------------

[ 3] local 10.6.2.5 port 33453 connected with 10.1.1.1 port 5001

[ 3] 0.0-10.2 sec 1.26 MBytes 1.05 Mbits/sec

서버모드 -s 옵션 주면된다.

#iperf -s

------------------------------------------------------------

Server listening on TCP port 5001

TCP window size: 8.00 KByte (default)

------------------------------------------------------------

[852] local 10.1.1.1 port 5001 connected with 10.6.2.5 port 33453

[ ID] Interval Transfer Bandwidth

[852] 0.0-10.6 sec 1.26 MBytes 1.03 Mbits/sec

클라이언트모드에 -f 옵션 주면

결과 값을 설정 가능하다. 아래와 같이 -f b 로 하면 bits로 나오는데

bits(b), bytes(B), kilobits(k), kilobytes(K), megabits(m), megabytes(M), gigabits(g) or gigabytes(G).

이런식으로 볼 수 있다.

#iperf -c 10.1.1.1 -f b

------------------------------------------------------------

Client connecting to 10.1.1.1, TCP port 5001

TCP window size: 16384 Byte (default)

------------------------------------------------------------

[ 3] local 10.6.2.5 port 54953 connected with 10.1.1.1 port 5001

[ 3] 0.0-10.2 sec 1359872 Bytes 1064272 bits/sec

#iperf -s

------------------------------------------------------------

Server listening on TCP port 5001

TCP window size: 8.00 KByte (default)

------------------------------------------------------------

[852] local 10.1.1.1 port 5001 connected with 10.6.2.5 port 33453

[ ID] Interval Transfer Bandwidth

[852] 0.0-10.6 sec 920 KBytes 711 Kbits/sec

윈도우 사이즈옵션 주려면 -w 하고 숫자 넣어주면 간단하게 된다.

요거는 서버 쪽에서도 맞춰 줘야 한다.

#iperf -c 10.1.1.1 -w 2000

WARNING: TCP window size set to 2000 bytes. A small window size

will give poor performance. See the Iperf documentation.

------------------------------------------------------------

Client connecting to 10.1.1.1, TCP port 5001

TCP window size: 3.91 KByte (WARNING: requested 1.95 KByte)

------------------------------------------------------------

[ 3] local 10.6.2.5 port 51400 connected with 10.1.1.1 port 5001

[ 3] 0.0-10.1 sec 704 KBytes 572 Kbits/sec

#iperf -s -w 4000

------------------------------------------------------------

Server listening on TCP port 5001

TCP window size: 3.91 KByte

------------------------------------------------------------

[852] local 10.1.1.1 port 5001 connected with 10.6.2.5 port 51400

[ ID] Interval Transfer Bandwidth

[852] 0.0-10.1 sec 704 KBytes 570 Kbits/sec

포트 번호 설정은 -p, 그리고 -t는 전체 시간이고 -i는 인터벌(시간간격)
가지고 구하는 경우

#iperf -c 10.1.1.1 -p 12000 -t 20 -i 2

------------------------------------------------------------

Client connecting to 10.1.1.1, TCP port 12000

TCP window size: 16.0 KByte (default)

------------------------------------------------------------

[ 3] local 10.6.2.5 port 58316 connected with 10.1.1.1 port 12000

[ 3] 0.0- 2.0 sec 224 KBytes 918 Kbits/sec

[ 3] 2.0- 4.0 sec 368 KBytes 1.51 Mbits/sec

[ 3] 4.0- 6.0 sec 704 KBytes 2.88 Mbits/sec

[ 3] 6.0- 8.0 sec 280 KBytes 1.15 Mbits/sec

[ 3] 8.0-10.0 sec 208 KBytes 852 Kbits/sec

[ 3] 10.0-12.0 sec 344 KBytes 1.41 Mbits/sec

[ 3] 12.0-14.0 sec 208 KBytes 852 Kbits/sec

[ 3] 14.0-16.0 sec 232 KBytes 950 Kbits/sec

[ 3] 16.0-18.0 sec 232 KBytes 950 Kbits/sec

[ 3] 18.0-20.0 sec 264 KBytes 1.08 Mbits/sec

[ 3] 0.0-20.1 sec 3.00 MBytes 1.25 Mbits/sec

#iperf -s -p 12000

------------------------------------------------------------

Server listening on TCP port 12000

TCP window size: 8.00 KByte (default)

------------------------------------------------------------

[852] local 10.1.1.1 port 12000 connected with 10.6.2.5 port 58316

[ ID] Interval Transfer Bandwidth

[852] 0.0-20.1 sec 3.00 MBytes 1.25 Mbits/sec

Maximum Segment Size (-m argument) MSS 크기 설정 가능하게 해준다.
디폴트값은 1500Bytes.

Client side:

#iperf -c 10.1.1.1 -m

------------------------------------------------------------

Client connecting to 10.1.1.1, TCP port 5001

TCP window size: 16.0 KByte (default)

------------------------------------------------------------

[ 3] local 10.6.2.5 port 41532 connected with 10.1.1.1 port 5001

[ 3] 0.0-10.2 sec 1.27 MBytes 1.04 Mbits/sec

[ 3] MSS size 1448 bytes (MTU 1500 bytes, ethernet)

Here the MSS is not equal to 1500 - 40 but to 1500 - 40 - 12 (Timestamps option) = 1448

#iperf -c 10.1.1.1 -M 1300 -m

WARNING: attempt to set TCP maximum segment size to 1300, but got 536

------------------------------------------------------------

Client connecting to 10.1.1.1, TCP port 5001

TCP window size: 16.0 KByte (default)

------------------------------------------------------------

[ 3] local 10.6.2.5 port 41533 connected with 10.1.1.1 port 5001

[ 3] 0.0-10.1 sec 4.29 MBytes 3.58 Mbits/sec

[ 3] MSS size 1288 bytes (MTU 1328 bytes, unknown interface)

병렬 테스트를 하고자 하면 -p 옵션 주면 된다.

Client side:

#iperf -c 10.1.1.1 -P 2

------------------------------------------------------------

Client connecting to 10.1.1.1, TCP port 5001

TCP window size: 16.0 KByte (default)

------------------------------------------------------------

[ 3] local 10.6.2.5 port 41534 connected with 10.1.1.1 port 5001

[ 4] local 10.6.2.5 port 41535 connected with 10.1.1.1 port 5001

[ 4] 0.0-10.1 sec 1.35 MBytes 1.12 Mbits/sec

[ 3] 0.0-10.1 sec 1.35 MBytes 1.12 Mbits/sec

[SUM] 0.0-10.1 sec 2.70 MBytes 2.24 Mbits/sec

마지막으로 내가 사용하는 주로 쓰는 옵션은..
-n 옵션은 Transfer하는 데이터 크기를 정해서 주고 받는 옵션이다.


클라이언트

$ iperf -c 10.10.1.57 -p 50000 -n 300M
------------------------------------------------------------
Client connecting to 10.10.1.57, TCP port 50000
TCP window size: 85.3 KByte (default)
------------------------------------------------------------
[ 3] local 10.10.4.55 port 41529 connected with 10.10.1.57 port 50000
[ ID] Interval Transfer Bandwidth
[ 3] 0.0-26.3 sec 300 MBytes 95.8 Mbits/sec

서버

$ iperf -s -p 50000
------------------------------------------------------------
Server listening on TCP port 50000
TCP window size: 85.3 KByte (default)
------------------------------------------------------------
[ 4] local 10.10.1.57 port 50000 connected with 10.10.4.55 port 41529
[ ID] Interval Transfer Bandwidth
[ 4] 0.0-26.8 sec 300 MBytes 93.7 Mbits/sec

Client/Server:

-f

-i

-l

-m

-p

-u

-w

-B

-C

-M

-N

-V

--format

--interval

--len

--print_mss

--port

--udp

--window

--bind

--compatibility

--mss

--nodelay

--IPv6Version

[kmKM]

#

#[KM]

#

#[KM]

"host"

#

format to report: Kbits, Mbits, KBytes, MBytes

seconds between periodic bandwidth reports

length of buffer to read or write (default 8 KB)

print TCP maximum segment size (MTU - TCP/IP header)

server port to listen on/connect to

use UDP rather than TCP

TCP window size (socket buffer size)

bind to "host", an interface or multicast address

for use with older versions does not sent extra msgs

set TCP maximum segment size (MTU - 40 bytes)

set TCP no delay, disabling Nagle's Algorithm

Set the domain to IPv6

Server specific:

-s

-U

-D

--server

--single_udp

--daemon

run in server mode

run in single threaded UDP mode

run the server as a daemon

Client specific:

-b

-c

-d

-n

-r

-t

-F

-I

-L

-P

-T

--bandwidth

--client

--dualtest

--num

--tradeoff

--time

--fileinput

--stdin

--listenport

--parallel

--ttl

#[KM]

"host"

#[KM]

#

"name"

#

#

#

for UDP, bandwidth to send at in bits/sec (default 1 Mbit/sec, implies -u)

run in client mode, connecting to "host"

Do a bidirectional test simultaneously

number of bytes to transmit (instead of -t)

Do a bidirectional test individually

time in seconds to transmit for (default 10 secs)

input the data to be transmitted from a file

input the data to be transmitted from stdin

port to recieve bidirectional tests back on

number of parallel client threads to run

time-to-live, for multicast (default 1)

Miscellaneous:

-h

-v

--help

--version

print this message and quit

print version information and quit