Существует три типа трафика:
Как мы уже знаем, iperf может отправлять пакеты TCP или UDP получателю, используя метод сервера и клиента. Давайте посмотрим, как мы можем отправлять многоадресный трафик с помощью инструмента iperf.
Мы можем использовать следующую команду для запуска любого многоадресного сервера в Linux:
$ iperf -s -u -B 239.1.1.10 -i 1
Здесь:
Для многоадресного сервера существуют фиксированные IP-адреса класса D в диапазоне от 224.0.0.0 до 239.255.255.255.
Таким образом, 239.1.1.10 можно использовать в качестве адреса получателя многоадресной рассылки.
------------------------------------------------------------ Server listening on UDP port 5001 Binding to local address 239.1.1.10 Joining multicast group 239.1.1.10 Receiving 1470 byte datagrams UDP buffer size: 208 KByte (default) ------------------------------------------------------------
Вот команда:
$ iperf -c 239.1.1.10 -u -T 3 -t 20 -i 1 -b 200M
«-c 239.1.1.10» означает отправку трафика на сервер IP 239.1.1.10, на котором работает многоадресный сервер.
Здесь мы знаем это из предыдущей команды сервера:
------------------------------------------------------------ Client connecting to 239.1.1.10, UDP port 5001 Sending 1470 byte datagrams Setting multicast TTL to 3 UDP buffer size: 64.0 KByte (default) ------------------------------------------------------------ [ 3] local 192.168.1.4 port 63633 connected with 239.1.1.10 port 5001 [ ID] Interval Transfer Bandwidth [ 3] 0.0- 1.0 sec 1.54 MBytes 12.9 Mbits/sec [ 3] 1.0- 2.0 sec 1.39 MBytes 11.7 Mbits/sec [ 3] 2.0- 3.0 sec 1.35 MBytes 11.3 Mbits/sec [ 3] 3.0- 4.0 sec 1.55 MBytes 13.0 Mbits/sec [ 3] 4.0- 5.0 sec 1.37 MBytes 11.5 Mbits/sec [ 3] 5.0- 6.0 sec 1.54 MBytes 12.9 Mbits/sec [ 3] 6.0- 7.0 sec 1.34 MBytes 11.2 Mbits/sec [ 3] 7.0- 8.0 sec 1.37 MBytes 11.5 Mbits/sec [ 3] 8.0- 9.0 sec 778 KBytes 6.37 Mbits/sec [ 3] 9.0-10.0 sec 1.08 MBytes 9.02 Mbits/sec [ 3] 10.0-11.0 sec 531 KBytes 4.35 Mbits/sec [ 3] 11.0-12.0 sec 1.21 MBytes 10.2 Mbits/sec [ 3] 12.0-13.0 sec 1.39 MBytes 11.6 Mbits/sec [ 3] 13.0-14.0 sec 1.41 MBytes 11.8 Mbits/sec [ 3] 14.0-15.0 sec 1.53 MBytes 12.8 Mbits/sec [ 3] 15.0-16.0 sec 1.39 MBytes 11.6 Mbits/sec [ 3] 16.0-17.0 sec 1005 KBytes 8.23 Mbits/sec [ 3] 17.0-18.0 sec 711 KBytes 5.82 Mbits/sec [ 3] 18.0-19.0 sec 715 KBytes 5.86 Mbits/sec [ 3] 19.0-20.0 sec 1.21 MBytes 10.1 Mbits/sec [ 3] 0.0-20.0 sec 24.3 MBytes 10.2 Mbits/sec [ 3] Sent 17338 datagrams
Давайте посмотрим на следующий вывод на стороне сервера Iperf после запуска клиента:
------------------------------------------------------------ [ 3] local 239.1.1.10 port 5001 connected with 192.168.1.4 port 63633 [ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams [ 3] 0.0- 1.0 sec 48.8 KBytes 400 Kbits/sec 22.355 ms 3/ 37 (8.1%) [ 3] 1.0- 2.0 sec 45.9 KBytes 376 Kbits/sec 26.301 ms 94/ 126 (75%) [ 3] 2.0- 3.0 sec 58.9 KBytes 482 Kbits/sec 23.585 ms 2/ 43 (4.7%) [ 3] 3.0- 4.0 sec 44.5 KBytes 365 Kbits/sec 23.099 ms 127/ 158 (80%) [ 3] 4.0- 5.0 sec 38.8 KBytes 318 Kbits/sec 29.384 ms 129/ 156 (83%) [ 3] 5.0- 6.0 sec 40.2 KBytes 329 Kbits/sec 27.560 ms 110/ 138 (80%) [ 3] 6.0- 7.0 sec 37.3 KBytes 306 Kbits/sec 28.645 ms 128/ 154 (83%) [ 3] 7.0- 8.0 sec 57.4 KBytes 470 Kbits/sec 23.172 ms 0/ 40 (0%) [ 3] 8.0- 9.0 sec 44.5 KBytes 365 Kbits/sec 31.233 ms 128/ 159 (81%) [ 3] 9.0-10.0 sec 70.3 KBytes 576 Kbits/sec 20.961 ms 0/ 49 (0%) [ 3] 10.0-11.0 sec 63.2 KBytes 517 Kbits/sec 17.203 ms 231/ 275 (84%) [ 3] 11.0-12.0 sec 48.8 KBytes 400 Kbits/sec 114.719 ms 1972/ 2006 (98%) [ 3] 12.0-13.0 sec 45.9 KBytes 376 Kbits/sec 37.111 ms 2/ 34 (5.9%) [ 3] 13.0-14.0 sec 51.7 KBytes 423 Kbits/sec 30.123 ms 1200/ 1236 (97%) [ 3] 14.0-15.0 sec 50.2 KBytes 412 Kbits/sec 29.018 ms 1058/ 1093 (97%) [ 3] 15.0-16.0 sec 44.5 KBytes 365 Kbits/sec 30.480 ms 1098/ 1129 (97%) [ 3] 16.0-17.0 sec 47.4 KBytes 388 Kbits/sec 33.832 ms 1687/ 1720 (98%) [ 3] 17.0-18.0 sec 74.6 KBytes 612 Kbits/sec 21.411 ms 1/ 53 (1.9%) [ 3] 18.0-19.0 sec 73.2 KBytes 600 Kbits/sec 23.323 ms 171/ 222 (77%) [ 3] 19.0-20.0 sec 35.9 KBytes 294 Kbits/sec 33.545 ms 986/ 1011 (98%) [ 3] 20.0-21.0 sec 70.3 KBytes 576 Kbits/sec 14.751 ms 10/ 59 (17%) [ 3] 21.0-22.0 sec 86.1 KBytes 706 Kbits/sec 19.265 ms 745/ 805 (93%) [ 3] 22.0-23.0 sec 87.6 KBytes 717 Kbits/sec 13.829 ms 0/ 61 (0%) [ 3] 23.0-24.0 sec 102 KBytes 835 Kbits/sec 17.444 ms 897/ 968 (93%) [ 3] 24.0-25.0 sec 37.3 KBytes 306 Kbits/sec 19.787 ms 52/ 78 (67%) [ 3] 25.0-26.0 sec 80.4 KBytes 659 Kbits/sec 19.339 ms 587/ 643 (91%) [ 3] 26.0-27.0 sec 99.1 KBytes 811 Kbits/sec 16.696 ms 327/ 396 (83%) [ 3] 27.0-28.0 sec 76.1 KBytes 623 Kbits/sec 15.594 ms 0/ 53 (0%) [ 3] 28.0-29.0 sec 89.0 KBytes 729 Kbits/sec 16.635 ms 1061/ 1123 (94%) [ 3] 29.0-30.0 sec 99.1 KBytes 811 Kbits/sec 14.228 ms 0/ 69 (0%) [ 3] 30.0-31.0 sec 81.8 KBytes 670 Kbits/sec 22.782 ms 501/ 558 (90%) [ 3] 31.0-32.0 sec 109 KBytes 894 Kbits/sec 17.737 ms 409/ 485 (84%) [ 3] 32.0-33.0 sec 105 KBytes 858 Kbits/sec 17.845 ms 191/ 264 (72%) [ 3] 33.0-34.0 sec 109 KBytes 894 Kbits/sec 27.198 ms 558/ 634 (88%) [ 3] 34.0-35.0 sec 79.0 KBytes 647 Kbits/sec 19.252 ms 818/ 873 (94%) [ 3] 35.0-36.0 sec 105 KBytes 858 Kbits/sec 13.071 ms 0/ 73 (0%)
Вот пакет в Wireshark. Отправитель — 192.168.1.4 [клиент], а многоадресный адрес получателя — 239.1.1.10.
В этой статье мы изучили команды iperf для отправки и получения кадра многоадресной рассылки, а также проверки кадра многоадресной рассылки в Wireshark. Бесплатный инструмент iperf с открытым исходным кодом также можно использовать для отправки многоадресного кадра.