简介
本文档介绍如何在Catalyst 9000系列交换机上使用iPerf来执行带宽测试。
先决条件
要求
Cisco 建议您了解以下主题:
- Catalyst 9000系列交换机上的应用托管
- Linux
使用的组件
本文档中的信息基于以下软件和硬件版本:
- C9300
- 思科IOS® XE 17.3.5
- 思科IOS® XE 17.6.4
注意:有关在其他思科平台上启用这些功能的命令,请参阅相应的配置指南。
本文档中的信息都是基于特定实验室环境中的设备编写的。本文档中使用的所有设备最初均采用原始(默认)配置。如果您的网络处于活动状态,请确保您了解所有命令的潜在影响。
相关产品
本文档还可与以下硬件和软件版本一起使用:
背景信息
iPerf3是主动测量IP网络最大可达带宽的工具。iPerf使用TCP和UDP的不同容量提供带宽统计信息。
注意:有关此工具的更多信息,请参阅iPerf官方文档。
视频
iPerf安装
限制
- 应用托管不是虚拟路由和转发感知(VRF感知)。
- 在Cisco IOS® XE Amsterdam 17.3.3之前的版本中,应用托管需要专用存储分配,并在bootflash上禁用。
- 在Cisco IOS® XE Amsterdam 17.3.3及更高版本中,在bootflash上启用应用托管,但是,仅托管思科签名的应用。
- 不支持前面板通用串行总线(USB)棒。
- Cisco Catalyst 9300系列交换机仅支持后面板思科认证的USB。
- Cisco Catalyst 9500高性能系列交换机和Cisco Catalyst 9600系列交换机不支持前面板USB用于应用托管。
- Cisco Catalyst 9500和9500高性能系列交换机和Cisco Catalyst 9600系列交换机不支持AppGigabitEthernet接口。
- 在Cisco IOS® XE Bengaluru 17.5.1之前的版本中,Cisco Catalyst 9410R交换机不支持应用托管。
- 在AppGigabitEthernet接口上配置enable命令,以在Cisco Catalyst 9410R交换机上启用应用托管。
安装步骤
- 下载最新的iPerf映像,并验证其是否已存储到USB SSD中:
C9300-AC1#dir usbflash1:/
Directory of usbflash1:/
12 -rw- 6043136 Jan 26 2023 21:55:35 +00:00 iPerf.tar
2.为iPerf连接选择一个VLAN或配置新的VLAN:
C9300-AC1(config)#interface vlan 10
C9300-AC1(config-if)#ip add 192.168.10.11 255.255.255.0
3.配置AppGigabitEthernet接口:
C9300-AC1(config)#int Ap1/0/1
C9300-AC1(config-if)#switchport mode trunk
4.配置iPerf docker并将其与VLAN关联:
C9300-AC1(config)#app-hosting appid iPerf
C9300-AC1(config-app-hosting)#app-vnic AppGigabitEthernet trunk
C9300-AC1(config-config-app-hosting-trunk)#vlan 10 guest-interface 0
C9300-AC1(config-config-app-hosting-vlan-access-ip)#guest-ipaddress 192.168.10.21 netmask 255.255.255.0
5.将您为iPerf连接选择的SVI的IP配置为应用的默认网关:
C9300-AC1(config)#app-hosting appid iPerf
C9300-AC1(config-app-hosting)#app-default-gateway 192.168.10.11 guest-int
6.启动IOX服务,并使用特权EXEC命令running
验证show iox-service
其处于状态:
C9300-AC1(config)#iox
C9300-AC1(config)#do show iox-service
IOx Infrastructure Summary:
---------------------------
IOx service (CAF) : Running
IOx service (HA) : Running
IOx service (IOxman) : Not Ready
IOx service (Sec storage) : Not Running
Libvirtd 5.5.0 : Running
Dockerd 18.03.0 : Running
Sync Status : Disabled
7.从SSD安装iPerf应用并验证是否已部署:
C9300-AC1#app-hosting install appid iPerf package usbflash1:iPerf.tar
Installing package 'usbflash1:iPerf.tar' for 'iPerf'. Use 'show app-hosting list' for progress.
C9300-AC1#show app-hosting list
App id State
---------------------------------------------------------
iPerf DEPLOYED
8.激活和启动iPerf应用程序:
C9300-AC1#app-hosting activate appid iPerf
iPerf activated successfully
Current state is: ACTIVATED
C9300-AC1#show app-hosting list
App id State
---------------------------------------------------------
iPerf ACTIVATED
C9300-AC1#app-hosting start appid iPerf
iPerf started successfully
Current state is: RUNNING
C9300-AC1#
C9300-AC1#show app-hosting list
App id State
---------------------------------------------------------
iPerf RUNNING
注意:iPerf处于状态running
后,默认情况下会作为服务器运行。
确认
要验证应用详细信息,您可以使用特权show app-hosting utilization appid [app-name]
EXEC命令:
C9300-AC1#show app-hosting detail appid iPerf
App id : iPerf
Owner : iox
State : RUNNING
Application
Type : docker
Name : mlabbe/iperf3
Version : latest
Description :
Author :
Path : usbflash1:iPerf.tar
URL Path :
Activated profile name : default
Resource reservation
Memory : 409 MB
Disk : 10 MB
CPU : 1480 units
CPU-percent : 20 %
VCPU : 1
Platform resource profiles
Profile Name CPU(unit) Memory(MB) Disk(MB)
--------------------------------------------------------------
Attached devices
Type Name Alias
---------------------------------------------
serial/shell iox_console_shell serial0
serial/aux iox_console_aux serial1
serial/syslog iox_syslog serial2
serial/trace iox_trace serial3
Network interfaces
---------------------------------------
eth0:
MAC address : 52:54:dd:d2:df:af
IPv4 address : 192.168.10.21
IPv6 address : ::
Network name : mgmt-bridge-v10
Docker
------
Run-time information
Command :
Entry-point : iperf3 -s
Run options in use :
Package run options :
Application health information
Status : 0
Last probe error :
Last probe output :
要验证应用程序利用率,您可以使用特show app-hosting utilization appid [app-name]
权EXEC命令:
C9300-AC1# show app-hosting utilization appid iPerf
Application: iPerf
CPU Utilization:
CPU Allocation: 1480 units
CPU Used: 0.00 %
CPU Cores:
Memory Utilization:
Memory Allocation: 409 MB
Memory Used: 1064 KB
Disk Utilization:
Disk Allocation: 10 MB
Disk Used: 0.00 MB
要验证应用容器中的详细信息,您可以使用特app-hosting connect appid [app-name] session
权EXEC命令:
C9300-AC1#app-hosting connect appid iPerf session
/ $
/ $ #Verify IP address assigned
/ $
/ $ ifconfig
eth0
inet addr:192.168.10.21 Bcast:0.0.0.0 Mask:255.255.255.0
/ $
/ $ #Verify iPerf is running as server
/ $
/ $ ps
PID USER TIME COMMAND
1 iperf 0:00 iperf3 -s
390 iperf 0:00 /bin/sh
398 iperf 0:00 ps
/ $
带宽测试
网络图
本文档中介绍的执行带宽测试的方法基于以下网络图:

注意:iPerf安装部分的配置示例取自同一实验环境。
为以上设备分配IP地址:
C9300-AC1
|
C9300-AC2
|
SVI 192.168.10.11
iPerf 192.168.10.21
|
SVI 192.168.10.12
iPerf 192.168.10.22
|
注意:这些示例中使用的所有设备都在同一个VLAN域(VLAN 10)中。
方法 1:交换机作为客户端
在本示例中,测量从C9300-AC1到C9300-AC2的带宽。C9300-AC1是客户端。
1.运行命令以app-hosting connect appid iPerf session
进入应用容器提示符:
C9300-AC1#app-hosting connect appid iPerf session
/ $
2.进入应用容器提示符后,使iperf3 -c
用命令开始带宽测试:
/ $ iperf3 -c 192.168.10.22
Connecting to host 192.168.10.22, port 5201
[ 5] local 192.168.10.21 port 34906 connected to 192.168.10.22 port 5201
[ ID] Interval Transfer Bitrate Retr Cwnd
[ 5] 0.00-1.00 sec 114 MBytes 955 Mbits/sec 2 833 KBytes
[ 5] 1.00-2.00 sec 113 MBytes 947 Mbits/sec 3 923 KBytes
[ 5] 2.00-3.00 sec 111 MBytes 934 Mbits/sec 77 974 KBytes
[ 5] 3.00-4.00 sec 113 MBytes 945 Mbits/sec 1 1.03 MBytes
[ 5] 4.00-5.00 sec 112 MBytes 940 Mbits/sec 109 1.08 MBytes
[ 5] 5.00-6.00 sec 111 MBytes 931 Mbits/sec 395 820 KBytes
[ 5] 6.00-7.00 sec 111 MBytes 933 Mbits/sec 198 882 KBytes
[ 5] 7.00-8.00 sec 112 MBytes 944 Mbits/sec 2 970 KBytes
[ 5] 8.00-9.00 sec 111 MBytes 933 Mbits/sec 9 1.02 MBytes
[ 5] 9.00-10.00 sec 111 MBytes 933 Mbits/sec 524 1.04 MBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bitrate Retr
[ 5] 0.00-10.00 sec 1.09 GBytes 940 Mbits/sec 1320 sender
[ 5] 0.00-10.01 sec 1.09 GBytes 937 Mbits/sec receiver
iperf Done.
/ $
3.测试完成后,键入exit
返回交换机CLI。
注意:由于iPerf在默认情况下作为服务器运行,因此服务器端不需要其他命令。
方法 2:PC作为客户端
在本示例中,测量从主机A到C9300-AC2(iPerf服务器)的带宽。
- 确保您的PC已下载iPerf。
- 将iPerf存储在PC中后,从命令提示符导航到iperf3.exe:
C:\Users\user\Downloads\iperf-3.1.3-win64\iperf-3.1.3-win64>iperf3.exe
3.从您的PC使用-c选项。这表示PC是客户端:
C:\Users\user\Downloads\iperf-3.1.3-win64\iperf-3.1.3-win64>iperf3.exe -c 192.168.10.22
Connecting to host 192.168.10.22, port 5201
[ 4] local 192.168.10.2 port 56009 connected to 192.168.10.22 port 5201
[ ID] Interval Transfer Bandwidth
[ 4] 0.00-1.00 sec 109 MBytes 916 Mbits/sec
[ 4] 1.00-2.00 sec 0.00 Bytes 0.00 bits/sec
[ 4] 2.00-3.00 sec 0.00 Bytes 0.00 bits/sec
[ 4] 3.00-4.00 sec 93.6 MBytes 786 Mbits/sec
[ 4] 4.00-5.00 sec 15.1 MBytes 127 Mbits/sec
[ 4] 5.00-6.02 sec 0.00 Bytes 0.00 bits/sec
[ 4] 6.02-7.00 sec 78.2 MBytes 666 Mbits/sec
[ 4] 7.00-8.00 sec 42.9 MBytes 360 Mbits/sec
[ 4] 8.00-9.00 sec 0.00 Bytes 0.00 bits/sec
[ 4] 9.00-10.00 sec 49.4 MBytes 414 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bandwidth
[ 4] 0.00-10.00 sec 388 MBytes 326 Mbits/sec sender
[ 4] 0.00-10.00 sec 388 MBytes 326 Mbits/sec receiver
iperf Done.
提示:对于传统方法,您需要使用2台PC,一台用作服务器,一台用作客户端。对于用作服务器的PC,请使用iperf3.exe -s
命令。
相关信息