{"id":11208,"date":"2019-03-11T06:56:49","date_gmt":"2019-03-11T06:56:49","guid":{"rendered":"http:\/\/www.appservgrid.com\/paw92\/?p=11208"},"modified":"2019-03-11T06:56:49","modified_gmt":"2019-03-11T06:56:49","slug":"how-to-test-network-throughput-using-iperf3-tool-in-linux","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/03\/11\/how-to-test-network-throughput-using-iperf3-tool-in-linux\/","title":{"rendered":"How to Test Network Throughput Using iperf3 Tool in Linux"},"content":{"rendered":"<p><strong>iperf3<\/strong>\u00a0is a free open source, cross-platform command line based program for performing real time network throughput measurements. It is one of the poweful tools for testing the maximum achievable bandwidth in IP networks (supports\u00a0<strong>IPv4<\/strong>\u00a0and\u00a0<strong>IPv6<\/strong>).<\/p>\n<p><strong>Read Also<\/strong>:\u00a0<a href=\"https:\/\/www.tecmint.com\/linux-network-bandwidth-monitoring-tools\/\" target=\"_blank\" rel=\"noopener\">16 Bandwidth Monitoring Tools to Analyze Network Usage in Linux<\/a><\/p>\n<p>With\u00a0<strong>iperf<\/strong>, you can tune several parameters associated with timing, buffers and protocols such as TCP, UDP, SCTP. It comes in handy for\u00a0<a href=\"https:\/\/www.tecmint.com\/linux-networking-commands\/\" target=\"_blank\" rel=\"noopener\">network performance tuning<\/a>\u00a0operations.<\/p>\n<p>In order to acquire maximum or rather improved network performance, you need to increase the throughput as well as latency of your network\u2019s receiving and sending capabilities. However, before you can go into actual tuning, you need to perform some test to gather overall network performance statistics that will guide your tuning process.<\/p>\n<p>Its results include time interval in seconds, data transfered, bandwidth (transfer rate), loss, and other useful network performance parameters. It is primarily intended to assist in tuning TCP connections over a particular path and this is what we will focus on in this guide.<\/p>\n<h4>Requirements:<\/h4>\n<ul>\n<li>Two networked computers which both have\u00a0<strong>iperf3<\/strong>\u00a0installed.<\/li>\n<\/ul>\n<h3>How to Install iperf3 in Linux Systems<\/h3>\n<p>Before you start using\u00a0<strong>iperf3<\/strong>, you need to install it on the two machines you will use for benchmarking. Since\u00a0<strong>iperf3<\/strong>\u00a0is available in the official software repositories of most common Linux distributions, installing it should be easy, using a package manager as shown.<\/p>\n<pre>$ sudo apt install iperf3\t#Debian\/Ubuntu\r\n$ sudo yum install iperf3\t#RHEL\/CentOS\r\n$ sudo dnf install iperf3\t#Fedora 22+ \r\n<\/pre>\n<p>Once you have\u00a0<strong>iperf3<\/strong>\u00a0installed on your both machines, you can start testing network throughput.<\/p>\n<h3>How to Test Network Throughput Between Linux Servers<\/h3>\n<p>Firt connect to the remote machine which you will use as the\u00a0<strong>server<\/strong>\u00a0and fireup\u00a0<strong>iperf3<\/strong>\u00a0in server mode using\u00a0<code>-s<\/code>flag, it will listen on port\u00a0<strong>5201<\/strong>\u00a0by default.<\/p>\n<p>You can specify the format (<strong>k<\/strong>,\u00a0<strong>m<\/strong>,\u00a0<strong>g<\/strong>\u00a0for\u00a0<strong>Kbits<\/strong>,\u00a0<strong>Mbits<\/strong>,\u00a0<strong>Gbits<\/strong>\u00a0or\u00a0<strong>K<\/strong>,\u00a0<strong>M<\/strong>,\u00a0<strong>G<\/strong>\u00a0for\u00a0<strong>KBytes<\/strong>,\u00a0<strong>Mbytes<\/strong>,\u00a0<strong>Gbytes<\/strong>) to report in, using the\u00a0<code>-f<\/code>\u00a0switch as shown.<\/p>\n<pre>$ iperf3 -s -f K \r\n<\/pre>\n<p>If port\u00a0<strong>5201<\/strong>\u00a0is being used by another program on your server, you can specify a different port (e.g\u00a0<strong>3000<\/strong>) using the\u00a0<code>-p<\/code>\u00a0switch as shown.<\/p>\n<pre>$ iperf 3 -s -p 3000\r\n<\/pre>\n<p>Optionally, you can run the server as a daemon, using the\u00a0<code>-D<\/code>\u00a0flag and write server messages to a log file, as follows.<\/p>\n<pre>$ iperf 3 -s -D &gt; iperf3log \r\n<\/pre>\n<p>Then on your local machine which we will treat as the\u00a0<strong>client<\/strong>\u00a0(where the actual benchmarking takes place), run\u00a0<strong>iperf3<\/strong>\u00a0in client mode using\u00a0<code>-c<\/code>\u00a0flag and specify the host on which the server is running on (either using its IP address or domain or hostname).<\/p>\n<pre>$ iperf 3 -c 192.168.10.1 -f K\r\n<\/pre>\n<p>After about\u00a0<strong>18<\/strong>\u00a0to\u00a0<strong>20<\/strong>\u00a0seconds, the client should terminate and produce results indicating the average throughput for the benchmark, as shown in the following screenshot.<\/p>\n<div id=\"attachment_30664\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2018\/09\/Test-Network-Throughput-Between-Servers.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-30664\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2018\/09\/Test-Network-Throughput-Between-Servers.png\" alt=\"Test Network Throughput Between Servers\" width=\"640\" height=\"758\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">Test Network Throughput Between Servers<\/p>\n<\/div>\n<p><strong>Important<\/strong>: From the benchmark results, as shown in the above screenshot, there is a variation in values from the\u00a0<strong>server<\/strong>\u00a0and\u00a0<strong>client<\/strong>. But, you should always consider using the results obtained from the\u00a0<strong>iperf client<\/strong>\u00a0machine in every test you carry out.<\/p>\n<h3>How to Peform Advance Network Test Throughput in Linux<\/h3>\n<p>There are a number of client specific options for performing advanced test, as explained below.<\/p>\n<p>One of the important factors that determines the amount of data in the network a given time is the TCP window size \u2013 it is important in tuning TCP connections. You can set the window size\/socket buffer size using the\u00a0<code>-w<\/code>flag as shown.<\/p>\n<pre>$ iperf 3 -c 192.168.10.1 -f K -w 500K\t\r\n<\/pre>\n<p>To run it in\u00a0<strong>reverse mode<\/strong>\u00a0where the\u00a0<strong>server<\/strong>\u00a0sends and\u00a0<strong>client<\/strong>\u00a0receives, add the\u00a0<code>-R<\/code>\u00a0switch.<\/p>\n<pre>$ iperf 3 -c 192.168.10.1 -f K -w 500K -R\t\r\n<\/pre>\n<p>To run a\u00a0<strong>bi-directional test<\/strong>, meaning you measure bandwidth in both directions simultaneously, use the\u00a0<code>-d<\/code>option.<\/p>\n<pre>$ iperf 3 -c 192.168.10.1 -f K -w 500K -d\r\n<\/pre>\n<p>If you want to get\u00a0<strong>server results<\/strong>\u00a0in the\u00a0<strong>client<\/strong>\u00a0output, use the\u00a0<code>--get-server-output<\/code>\u00a0option.<\/p>\n<pre>$ iperf 3 -c 192.168.10.1 -f K -w 500K -R --get-server-output\r\n<\/pre>\n<div id=\"attachment_30665\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2018\/09\/get-server-results-in-client-output.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-30665\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2018\/09\/get-server-results-in-client-output.png\" alt=\"Get Server Network Results in Client\" width=\"642\" height=\"647\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">Get Server Network Results in Client<\/p>\n<\/div>\n<p>It is also possible to set the number of parallel client streams (two in this example), which run at the same time, using the\u00a0<code>-P<\/code>\u00a0options.<\/p>\n<pre>$ iperf 3 -c 192.168.10.1 -f K -w 500K -P 2\r\n<\/pre>\n<p>For more information, see the iperf3 man page.<\/p>\n<pre>$ man iperf3\r\n<\/pre>\n<p><strong>iperf3 Homepage<\/strong>:\u00a0<a href=\"https:\/\/iperf.fr\/\" target=\"_blank\" rel=\"nofollow noopener\">https:\/\/iperf.fr\/<\/a><\/p>\n<p>That\u2019s all! Remember to always perform network performance tests before going for actual network performance tuning.\u00a0<strong>iperf3<\/strong>\u00a0is a powerful tool, that comes in handy for running network throughput tests. Do you have any thoughts to share or questions to ask, use the comment form below.<\/p>\n<p><a href=\"https:\/\/www.tecmint.com\/test-network-throughput-in-linux\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>iperf3\u00a0is a free open source, cross-platform command line based program for performing real time network throughput measurements. It is one of the poweful tools for testing the maximum achievable bandwidth in IP networks (supports\u00a0IPv4\u00a0and\u00a0IPv6). Read Also:\u00a016 Bandwidth Monitoring Tools to Analyze Network Usage in Linux With\u00a0iperf, you can tune several parameters associated with timing, buffers &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/03\/11\/how-to-test-network-throughput-using-iperf3-tool-in-linux\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;How to Test Network Throughput Using iperf3 Tool in Linux&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-11208","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/11208","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=11208"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/11208\/revisions"}],"predecessor-version":[{"id":11209,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/11208\/revisions\/11209"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=11208"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=11208"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=11208"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}