簡介
本文說明如何在Catalyst 9000系列交換器上使用iPerf執行頻寬測試。
必要條件
需求
思科建議您瞭解以下主題:
- Catalyst 9000系列交換器上的應用託管
- Linux
採用元件
本文中的資訊係根據以下軟體和硬體版本:
- C9300
- Cisco IOS XE 17.3.5
- Cisco IOS XE 17.6.4
注意:有關在其他思科平台上啟用這些功能的命令,請參閱相應的配置指南。
本文中的資訊是根據特定實驗室環境內的裝置所建立。文中使用到的所有裝置皆從已清除(預設)的組態來啟動。如果您的網路運作中,請確保您瞭解任何指令可能造成的影響。
相關產品
本文件也適用於以下硬體和軟體版本:
背景資訊
iPerf3是主動測量IP網路上可達到的最大頻寬的工具。iPerf使用TCP和UDP的不同容量來提供頻寬統計資訊。
注意:請參閱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服務並驗證它是否在 running
狀態 show iox-service
特權EXEC命令:
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 / $
頻寬測試
網路圖表
執行頻寬測試的方法基於以下網路圖:
注意:Perf安裝部分的配置示例是從同一實驗室環境中獲取的。
為以上裝置分配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。
- 在PC中儲存iPerf後,從命令提示符導航到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
指令。
相關資訊