Tutoriales

Cómo probar la velocidad / rendimiento de la red entre dos servidores Linux

I han configurado un total de cuatro servidores en un centro de datos basado en la aglomeración. Ejecutan CentOS o Ubuntu Linux. Necesito asegurarme de que el rendimiento del sistema de archivos en clúster sea arreglado, ya que mis servidores se comparten con otros usuarios. ¿Cómo verifico la velocidad entre los dos servidores Linux usando opciones de confín de comando para LAN / VLAN privada?

Puede probar la velocidad / rendimiento de la red entre Ubuntu / CentOS / Debian / Fedora Linux o Unix usando el comando iperf. Los comandos Iperf muestran información sobre el encantado de cuadrilla, el retraso, la fluctuación y la pérdida de datagramas. Es una útil para realizar mediciones de rendimiento de la red. Puede probar el rendimiento de TCP o UDP. Para realizar una prueba iperf, el heredero debe establecer tanto un servidor (para descartar tráfico) como un cliente (para ocasionar tráfico). Esta página explica cómo probar la velocidad / rendimiento de la red entre dos servidores Linux.

Detalles del tutorial
Nivel de dificultadClaro (rss)
Privilegios de rootNo
RequisitosLinux con iperf
Est. tiempo de percibir8 minutos

Tabla de Contenidos

Mi muestra se configuró para probar la velocidad / rendimiento de la red entre dos servidores Linux

Fig.01 Pruebe la velocidad de la red entre dos computadoras Linux

Fig.01 Pruebe la velocidad de la red entre dos computadoras Linux

Paso 1: instalación

Debe instalar iperf según su interpretación de distribución de Linux. Hay dos versiones de iperf:

  1. iperf
  2. iperf3

El iperf / iperf3 funciona en Linux, Unix, Windows, * BSD y otros sistemas operativos.

Instale iperf en un servidor Ubuntu / Debian Linux

Escriba el posterior comando apt-get / comando apt para instalar iperf en entreambos servidores:
$ sudo apt-get update
$ sudo apt-get install iperf

Esto es lo que vemos en el sistema Ubuntu 20.04 LTS:

[sudo] password for vivek: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  iperf
 upgraded, 1 newly installed,  to remove and 23 not upgraded.
Need to get 76.5 kB of archives.
After this operation, 213 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu focal/universe amd64 iperf amd64 2.0.13+dfsg1-1build1 [76.5 kB]
Fetched 76.5 kB in 1s (70.5 kB/s)                    
Selecting previously unselected package iperf.
(Reading database ... 344795 files and directories currently installed.)
Preparing to unpack .../iperf_2.0.13+dfsg1-1build1_amd64.deb ...
Unpacking iperf (2.0.13+dfsg1-1build1) ...
Setting up iperf (2.0.13+dfsg1-1build1) ...
Processing triggers for man-db (2.9.1-1) ...

Una nota sobre la instalación de iperf3 en Debian / Ubuntu Linux

Incluso es posible instalar iperf3 (última interpretación) de la posterior modo:
$ sudo apt-get install iperf3
Panorama:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libiperf0
The following NEW packages will be installed:
  iperf3 libiperf0
0 upgraded, 2 newly installed, 0 to remove and 23 not upgraded.
Need to get 86.2 kB of archives.
After this operation, 294 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://archive.ubuntu.com/ubuntu focal/universe amd64 libiperf0 amd64 3.7-3 [72.0 kB]
Get:2 http://archive.ubuntu.com/ubuntu focal/universe amd64 iperf3 amd64 3.7-3 [14.2 kB]
Fetched 86.2 kB in 1s (97.4 kB/s) 
Selecting previously unselected package libiperf0:amd64.
(Reading database ... 344807 files and directories currently installed.)
Preparing to unpack .../libiperf0_3.7-3_amd64.deb ...
Unpacking libiperf0:amd64 (3.7-3) ...
Selecting previously unselected package iperf3.
Preparing to unpack .../iperf3_3.7-3_amd64.deb ...
Unpacking iperf3 (3.7-3) ...
Setting up libiperf0:amd64 (3.7-3) ...
Setting up iperf3 (3.7-3) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.2) ...

Instalación de iperf en un servidor Linux Fedora / RHEL / CentOS 8 más fresco

Escriba el posterior comando dnf para instalar iperf en entreambos servidores:
$ sudo dnf install iperf

Una nota sobre la instalación de iperf3 en CentOS / RHEL / SL / Oracle Linux

Escriba el posterior comando:
$ sudo dnf install iperf3

Instale iperf en un servidor CentOS / RHEL / Oracle / Scientific Linux

Escriba el posterior comando yum para instalar iperf en entreambos servidores (primero active el repositorio EPEL para CentOS / RHEL 7.x):
$ sudo yum install iperf
Si está utilizando la última interpretación de Fedora y CentOS / RHEL 8.x, pruebe el comando dnf de la posterior modo:
$ sudo dnf install iperf3

Cómo probar el rendimiento de la velocidad de la red entre dos servidores Linux

Instalación de iperf3 en un servidor CentOS o RHEL 8.x

Una nota sobre la instalación de iperf3 en CentOS / RHEL / SL / Oracle Linux

Escriba el posterior comando:
$ sudo yum install iperf3

Paso 2: inicie un servidor iperf en serverA (modo servidor)

Escriba el posterior comando para ejecutar iperf en modo servidor:
iperf -s
O
iperf3 -s
Panorama de muestra:

------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 85.3 KByte (default)
------------------------------------------------------------

Anote el número de puerto TCP 5001.

Una nota sobre la configuración del firewall

Tenga en cuenta que debe rasgar el puerto TCP 5001 en el servidor A. Vea cómo usar ufw para rasgar un puerto en Ubuntu / Debian Linux:
$ sudo ufw allow from 192.168.149.0/24 to 192.168.149.69 port 5001 proto tcp
Los usuarios de CentOS / RHEL / Fedora necesitan el puerto usando FirewallD. Vea cómo configurar un firewall usando FirewallD en CentOS 8:
sudo firewall-cmd --zone=public --add-port=5001/tcp --permanent
Incluso es posible cambiar el puerto pasando el -pag opción de la posterior modo (por ejemplo, rasgar y usar el puerto TCP 2323):
iperf -s -p 2323
iperf3 -s -p 4242


-----------------------------------------------------------
Server listening on 4242
-----------------------------------------------------------

Paso 3: inicie un servidor iperf en serverB (modo cliente)

Escriba el posterior comando para ejecutarlo en modo cliente, conectándose a 192.168.149.69:
iperf -c {ip-address-of-serverA-here}
iperf -c {ip-address-of-serverA-here} -p {tcp-port}
iperf -c 192.168.149.69 -p 2323
iperf -c 192.168.149.69

O
iperf3 -c {ip-address-of-serverA-here}
iperf3 -c {ip-address-of-serverA-here} -p {tcp-port}
iperf3 -c 192.168.149.69 -p 2323
iperf3 -c 192.168.149.69

Panorama de muestra:

Figura 02: Resultado de la prueba de velocidad de red de Linux

Figura 02: Resultado de la prueba de velocidad de la red Linux

Cómo utilizar UDP en lado de TCP

En el banda del servidor:
iperf -s -u
Del banda del cliente:
iperf -c 192.168.149.69 -u

Consulte incluso: Cómo instalar Speedtest-cli en CentOS / RHEL / Scientific / Fedora Linux para realizar la velocidad de Internet desde Bash Shelll

Cómo configurar el número de subprocesos de cliente paralelos para ejecutar (opciones del modo de cliente)

Pasa el -PAG opción:
iperf -c 192.168.149.69 -P 3
Incluso puede establecer el tiempo en segundos para transmitir (predeterminado 10 segundos) de la posterior modo:
iperf -c 192.168.149.69 -P 3 -t 30
Panorama de muestra:

------------------------------------------------------------
Client connecting to 192.168.149.69, TCP port 5001
TCP window size: 85.0 KByte (default)
------------------------------------------------------------
[  5] locorregional 192.168.181.40 port 54198 connected with 192.168.149.69 port 5001
[  3] locorregional 192.168.181.40 port 54194 connected with 192.168.149.69 port 5001
[  4] locorregional 192.168.181.40 port 54196 connected with 192.168.149.69 port 5001
[ ID] Interval       Transfer     Bandwidth
[  5]  0.0-30.0 sec  2.26 GBytes   647 Mbits/sec
[  3]  0.0-30.0 sec  2.89 GBytes   828 Mbits/sec
[  4]  0.0-30.5 sec  1.91 GBytes   539 Mbits/sec
[SUM]  0.0-30.5 sec  7.07 GBytes  1.99 Gbits/sec

Aquí está la salida de iperf3:
## on the server side ##
iperf3 -s
## on the client side ##
iperf3 -c 192.168.149.69

Panorama de muestra:

Connecting to host 192.168.149.69, port 5201
[  4] locorregional 192.168.181.40 port 55522 connected to 192.168.149.69 port 5201
[ ID] Interval           Transfer     Bandwidth       Retr  Cwnd
[  4]   0.00-1.00   sec   235 MBytes  1.97 Gbits/sec   32    609 KBytes       
[  4]   1.00-2.00   sec   230 MBytes  1.93 Gbits/sec   21    670 KBytes       
[  4]   2.00-3.00   sec   159 MBytes  1.33 Gbits/sec   19    635 KBytes       
[  4]   3.00-4.00   sec   235 MBytes  1.97 Gbits/sec    7    686 KBytes       
[  4]   4.00-5.00   sec   229 MBytes  1.92 Gbits/sec   86    757 KBytes       
[  4]   5.00-6.00   sec   206 MBytes  1.73 Gbits/sec    6    537 KBytes       
[  4]   6.00-7.00   sec   210 MBytes  1.76 Gbits/sec    5    556 KBytes       
[  4]   7.00-8.00   sec   235 MBytes  1.97 Gbits/sec   10    617 KBytes       
[  4]   8.00-9.00   sec   245 MBytes  2.06 Gbits/sec   11    670 KBytes       
[  4]   9.00-10.00  sec   234 MBytes  1.96 Gbits/sec   10    713 KBytes       
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth       Retr
[  4]   0.00-10.00  sec  2.17 GBytes  1.86 Gbits/sec  207             sender
[  4]   0.00-10.00  sec  2.16 GBytes  1.86 Gbits/sec                  receiver

Obtener ayuda es obvio

Escriba el posterior comando:
$ man iperf
$ man iperf3
$ iperf --help
$ iperf3 --help

Server or Client:
  -p, --port      #         server port to listen on/connect to
  -f, --format   [kmgtKMGT] format to report: Kbits, Mbits, Gbits, Tbits
  -i, --interval  #         seconds between periodic throughput reports
  -F, --file name           xmit/recv the specified file
  -A, --affinity n/n,m      set CPU affinity
  -B, --bind      <host>    bind to the interface associated with the address <host>
  -V, --verbose             more detailed output
  -J, --json                output in JSON format
  --logfile f               send output to a log file
  --forceflush              force flushing output at every interval
  -d, --debug               emit debugging output
  -v, --version             show version information and quit
  -h, --help                show this message and quit
Server specific:
  -s, --server              run in server mode
  -D, --daemon              run the server as a daemon
  -I, --pidfile file        write PID file
  -1, --one-off             handle one client connection then exit
  --rsa-private-key-path    path to the RSA private key used to decrypt
                            authentication credentials
  --authorized-users-path   path to the configuration file containing user
                            credentials
Client specific:
  -c, --client    <host>    run in client mode, connecting to <host>
  --sctp                    use SCTP rather than TCP
  -X, --xbind <name>        bind SCTP association to links
  --nstreams      #         number of SCTP streams
  -u, --udp                 use UDP rather than TCP
  --connect-timeout #       timeout for control connection setup (ms)
  -b, --bitrate #[KMG][/#]  target bitrate in bits/sec ( for unlimited)
                            (default 1 Mbit/sec for UDP, unlimited for TCP)
                            (optional slash and packet count for burst mode)
  --pacing-timer #[KMG]     set the timing for pacing, in microseconds (default 1000)
  --fq-rate #[KMG]          enable fair-queuing based socket pacing in
                            bits/sec (Linux only)
  -t, --time      #         time in seconds to transmit for (default 10 secs)
  -n, --bytes     #[KMG]    number of bytes to transmit (instead of -t)
  -k, --blockcount #[KMG]   number of blocks (packets) to transmit (instead of -t or -n)
  -l, --length    #[KMG]    length of buffer to read or write
                            (default 128 KB for TCP, dynamic or 1460 for UDP)
  --cport         <port>    bind to a specific client port (TCP and UDP, default: ephemeral port)
  -P, --parallel  #         number of parallel client streams to run
  -R, --reverse             run in reverse mode (server sends, client receives)
  --bidir                   run in bidirectional mode.
                            Client and server send and receive data.
  -w, --window    #[KMG]    set window size / socket buffer size
  -C, --congestion <poco>   set TCP congestion control algorithm (Linux and FreeBSD only)
  -M, --set-mss   #         set TCP/SCTP maximum segment size (MTU - 40 bytes)
  -N, --no-delay            set TCP/SCTP no delay, disabling Nagle's Algorithm
  -4, --version4            only use IPv4
  -6, --version6            only use IPv6
  -S, --tos N               set the IP type of service, 0-255.
                            The usual prefixes for octal and hex can be used,
                            i.e. 52, 064 and 0x34 all specify the same value.
  --dscp N or --dscp val    set the IP dscp value, either 0-63 or symbolic.
                            Numeric values can be specified in parte,
                            octal and hex (see --tos above).
  -L, --flowlabel N         set the IPv6 flow label (only supported on Linux)
  -Z, --zerocopy            use a 'zero copy' method of sending data
  -O, --omit N              omit the first n seconds
  -T, --title str           prefix every output line with this string
  --extra-data str          data string to include in client and server JSON
  --get-server-output       get results from server
  --udp-counters-64bit      use 64-bit counters in UDP test packets
  --repeating-payload       use repeating pattern in payload, instead of
                            randomized payload (like in iperf2)
  --username                username for authentication
  --rsa-public-key-path     path to the RSA public key used to encrypt
                            authentication credentials
 
[KMG] indicates options that support a K/M/G suffix for kilo-, mega-, or giga-
 
iperf3 homepage at: https://software.es.net/iperf/
Report bugs to:     https://github.com/esnet/iperf

Resumiendo

Esta página explica cómo realizar pruebas de rendimiento de red entre dos servidores Linux o Unix utilizando la útil iperf3 / iperf. Consulte la documentación de iperf y el código fuente de iperf3 en confín para obtener más información.

Publicaciones relacionadas

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

Botón volver arriba