本页内容
示例:在 MX104 路由器上为第 3 层 IPv4 服务配置基于 RFC 2544 的基准测试
要求
在基于RFC2544的基准测试中,MX 系列路由器仅支持反射器功能。此示例使用 MX104 3D 通用边缘路由器作为反射器。您还可以在 MX80 路由器以及配备 Junos OS 16.1 或更高版本的 MPC1、MPC2 和 16 端口 10 千兆以太网 MPC 的 MX240、MX480 和 MX960 路由器上配置基准测试。要在 MX240、MX480、MX960 路由器上配置基于RFC2544的基准测试,请参阅 在 MX 系列 路由器上启用对基于 RFC 2544 的基准测试的支持。
此示例不适用于 ACX7100、ACX5448、ACX5048 和 ACX5096 路由器,因为它们只能配置为反射器,而不能配置为启动器。
此示例使用以下硬件和软件组件:
MX104 路由器(反射器)
ACX 系列路由器(发起器)
Junos OS 13.3 或更高版本
概述
考虑一个示例拓扑,其中路由器路由器 A (ACX) 充当基于 RFC 2544 的基准测试测试的测试帧的发起方和终止方。路由器 A 通过第 3 层网络连接到另一台路由器 B(MX104),后者充当反射器,反射回从路由器 A 接收到的测试帧。IPv4 用于在第 3 层网络上传输测试帧。此基准测试用于计算路由器 A 和路由器 B 之间的 IPv4 服务参数。两台路由器上的逻辑接口均配置了 IPv4 地址,用于衡量 IPv4 服务网络设备的性能属性,如吞吐量、延迟、帧丢失和突发帧。
图 1 显示了对第 3 层 IPv4 服务执行 RFC 2544 测试的示例拓扑。
基准测试
配置
在此示例中,您将为路由器 A 上的接口 ge-0/0/0 和路由器 B 上的接口 ge-0/0/4 之间的第 3 层 IPv4 服务配置基准测试,以检测和分析互连路由器的性能。您不要在路由器 B 上配置测试配置文件,因为它充当反射器。在配置启动器(路由器 A)之前,必须先配置反射器(路由器 B),因为在开始在启动器上测试之前,需要配置反射器并运行测试。如果先在启动器上启动测试,则发送的所有数据包都将丢失,直到在反射器上开始测试为止。
CLI 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改详细信息,以便与网络配置匹配,然后将命令复制并粘贴到 [edit] 层级的 CLI 中:
在路由器 B 上配置基准测试参数
set interfaces ge-0/0/4 unit 0 family inet address 192.0.2.2/24 set services rpm rfc2544-benchmarking tests test-name test1 test-interface ge-0/0/4.0 set services rpm rfc2544-benchmarking tests test-name test1 mode reflect set services rpm rfc2544-benchmarking tests test-name test1 family inet set services rpm rfc2544-benchmarking tests test-name test1 destination-ipv4-address 192.0.2.2 set services rpm rfc2544-benchmarking tests test-name test1 destination-udp-port 4001 set services rpm rfc2544-benchmarking tests test-name test1 source-ipv4-address 192.0.2.1
在路由器 A 上配置基准测试参数
set interfaces ge-0/0/0 unit 0 family inet address 192.0.2.1/24 set services rpm rfc2544-benchmarking profiles test-profile throughput test-type throughput set services rpm rfc2544-benchmarking profiles test-profile throughput packet-size 64 set services rpm rfc2544-benchmarking profiles test-profile throughput bandwidth-kbps 1000 set services rpm rfc2544-benchmarking tests test-name test1 test-profile throughput set services rpm rfc2544-benchmarking tests test-name test1 test-interface ge-0/0/0.0 set services rpm rfc2544-benchmarking tests test-name test1 mode initiate-and-terminate set services rpm rfc2544-benchmarking tests test-name test1 family inet set services rpm rfc2544-benchmarking tests test-name test1 destination-ipv4-address 192.0.2.2 set services rpm rfc2544-benchmarking tests test-name test1 destination-udp-port 4001 set services rpm rfc2544-benchmarking tests test-name test1 source-ipv4-address 192.0.2.1
在路由器 B 上配置基准测试参数
分步过程
下面要求您在各个配置层级中进行导航。有关 CLI 导航的信息,请参阅 在配置模式下使用 CLI 编辑器。
要在路由器 B 上配置测试参数,请执行以下作:
-
在配置模式下,转到
[edit interfaces]层次结构级别:[edit] user@RouterB# edit interfaces
-
配置必须运行测试的接口。
[edit interfaces] user@RouterB# edit ge-0/0/4
-
配置逻辑单元并将协议族指定为
inet。[edit interfaces ge-0/0/4] user@RouterB# edit unit 0 family inet
-
指定逻辑接口的地址。
[edit interfaces ge-0/0/4 unit 0 family inet] user@RouterB# set address 192.0.2.2/24
-
转到最高级别的配置模式。
[edit interfaces ge-0/0/4 unit 0] user@RouterB# top
-
在配置模式下,转到
[edit services rpm rfc2544-benchmarking]层级。[edit] user@RouterB# edit services rpm rfc2544-benchmarking
-
定义测试的名称,例如 test1。测试名称标识符的长度最多为 32 个字符。
[edit services rpm rfc2544-benchmarking] user@RouterB# edit tests test-name test1
-
指定运行基于 RFC 2544 的基准测试的逻辑接口 ge-0/0/4.0。
[edit services rpm rfc2544-benchmarking tests test-name test1] user@RouterB# set test-interface ge-0/0/4.0
-
指定
reflect为基准测试期间发送的数据包的测试模式。[edit services rpm rfc2544-benchmarking tests test-name test1] user@RouterB# set mode reflect
-
配置用于基准测试的地址类型系列
inet。[edit services rpm rfc2544-benchmarking tests test-name test1] user@RouterB# set family inet
-
将测试数据包的目标 IPv4 地址配置为 192.0.2.2。反射器上配置的目标 IPv4 地址必须与发起方上配置的目标 IPv4 地址匹配。如果改为配置 192.0.2.1,则会收到以下错误消息:
error: test test1 - Could not determine local interface for address 192.0.2.1。[edit services rpm rfc2544-benchmarking tests test-name test1] user@host# set destination-ipv4-address 192.0.2.2
-
将生成帧的 UDP 标头中要使用的目标的 UDP 端口指定为 4001。
[edit services rpm rfc2544-benchmarking tests test-name test1] user@host# set destination-udp-port 4001
-
为测试数据包配置源 IPv4 地址。
[edit services rpm rfc2544-benchmarking tests test-name test1] user@host# set source-ipv4-address 192.0.2.1
-
转到最高级别的配置模式。
[edit services rpm rfc2544-benchmarking tests test-name test1] user@RouterB# top
-
提交配置。
[edit] user@RouterB# commit
-
确认配置。如果输出中不包含以下配置,请重复此示例中的配置说明,以便进行更正。
[edit interfaces] ge-0/0/4 { unit 0 { family inet { address 192.0.2.2/24; } } } [edit services rpm] rfc2544-benchmarking { # Note, When in reflector mode, test profile is not needed tests { test-name test1 { test-interface ge-0/0/4.0; mode reflect; family inet; destination-ipv4-address 192.0.2.2; destination-udp-port 4001; source-ipv4-address 192.0.2.1 } } } -
退出作模式。
[edit] user@RouterB# exit user@RouterB>
-
在反射器上开始基准测试。
user@host> test services rpm rfc2544-benchmarking test test1 start
在启动器上成功完成测试后,可以通过输入
test services rpm rfc2544-benchmarking test test1 stop命令在反射器上停止测试。
在路由器 A 上配置基准测试参数
分步过程
下面要求您在各个配置层级中进行导航。有关 CLI 导航的信息,请参阅 在配置模式下使用 CLI 编辑器。
要在路由器 A 上配置测试参数:
-
在配置模式下,转到
[edit interfaces]层次结构级别:[edit] user@RouterA# edit interfaces
-
配置必须运行测试的接口。
[edit interfaces] user@RouterA# edit ge-0/0/0
-
配置逻辑单元并指定协议家族。
[edit interfaces ge-0/0/0] user@RouterA# edit unit 0 family inet
-
指定逻辑接口的地址。
[edit interfaces ge-0/0/0 unit 0 family inet] user@RouterA# set address 192.0.2.1/24
-
转到最高级别的配置模式。
[edit interfaces ge-0/0/0 unit 0] user@RouterA# top
-
在配置模式下,转到
[edit services rpm rfc2544-benchmarking]层级。[edit] user@RouterA# edit services rpm rfc2544-benchmarking
-
定义测试配置文件的名称,例如吞吐量。
[edit services rpm rfc2544-benchmarking] user@RouterA# edit profiles test-profile throughput
-
将要执行的测试类型配置为吞吐量。
[edit services rpm rfc2544-benchmarking profiles test-profile throughput] user@RouterA# set test-type throughput
-
将测试数据包的大小指定为 64 字节。
[edit services rpm rfc2544-benchmarking profiles test-profile throughput] user@RouterA# set packet-size 64
-
定义测试的理论最大带宽(以千比特/秒为单位),值为 1,000 Kbps 到 1,000,000 Kbps。
[edit services rpm rfc2544-benchmarking profiles test-profile throughput] user@RouterA# set bandwidth-kbps 1000
-
输入
up命令,进入配置层次结构中的上一级。[edit services rpm rfc2544-benchmarking profiles test-profile throughput] user@RouterA# up
-
输入
up命令,进入配置层次结构中的上一级。[edit services rpm rfc2544-benchmarking profiles] user@RouterA# up
-
定义测试的名称,例如 test1。测试名称标识符的长度最多为 32 个字符。
[edit services rpm rfc2544-benchmarking] user@RouterA# edit tests test-name test1
-
指定要与特定测试名称关联的测试配置文件的名称(例如,吞吐量)。
[edit services rpm rfc2544-benchmarking tests test-name test1] user@RouterA# set test-profile throughput
-
指定运行基于 RFC 2544 的基准测试的逻辑接口 ge-0/0/0.0。
[edit services rpm rfc2544-benchmarking tests test-name test1] user@RouterA# set test-interface ge-0/0/0.0
-
将基准测试期间发送的数据包的测试模式指定为“启动”和“终止”。
[edit services rpm rfc2544-benchmarking tests test-name test1] user@RouterA# set mode initiate-and-terminate
-
配置用于基准测试的地址类型系列
inet。[edit services rpm rfc2544-benchmarking tests test-name test1] user@RouterA# set family inet
-
配置测试数据包的目标 IPv4 地址。
[edit services rpm rfc2544-benchmarking tests test-name test1] user@RouterA# set destination-ipv4-address 192.0.2.2
-
将生成帧的 UDP 标头中要使用的目标的 UDP 端口指定为 4001。
[edit services rpm rfc2544-benchmarking tests test-name test1] user@RouterA# set destination-udp-port 4001
-
为测试数据包配置源 IPv4 地址。
[edit services rpm rfc2544-benchmarking tests test-name test1] user@RouterA# set source-ipv4-address 192.0.2.1
-
转到最高级别的配置模式。
[edit services rpm rfc2544-benchmarking tests test-name test1] user@RouterA# top
-
提交配置。
[edit] user@RouterA# commit
-
确认配置。如果输出中不包含以下配置,请重复此示例中的配置说明,以便进行更正。
[edit] user@RouterA# show [edit interfaces] ge-0/0/0 { unit 0 { family inet { address 192.0.2.1/24; } } } [edit services rpm] rfc2544-benchmarking { profiles { test-profile throughput { test-type throughput packet-size 64; bandwidth-kbps 1000; } } tests { test-name test1 { test-profile throughput; interface ge-0/0/0.0; mode initiate-and-terminate; family inet; destination-ipv4-address 192.0.2.2 destination-udp-port 4001; source-ipv4-address 192.0.2.1 } } } -
退出作模式。
[edit] user@RouterA# exit user@RouterA>
-
在启动器上启动基准测试。
user@RouterA> test services rpm rfc2544-benchmarking test test1 start
测试成功完成后,它会自动停在启动器上。在启动器上成功完成测试后,可以通过在作模式下在路由器 B 上输入
test services rpm rfc2544-benchmarking test test1 stop命令来停止在反射器上测试。
结果
如果尚未执行此作,请在 [edit interfaces] 和 [edit services rpm] 层级的配置模式下输入 show 命令,以确认您在路由器 A 和路由器 B 上的配置。如果输出未显示预期的配置,请重复此示例中的配置说明,以便进行更正。
路由器 A 上的基准测试参数配置:
[edit interfaces]
ge-0/0/0 {
unit 0 {
family inet {
address 192.0.2.1/24;
}
}
}
[edit services rpm]
rfc2544-benchmarking {
profiles {
test-profile throughput {
test-type throughput
packet-size 64;
bandwidth-kbps 1000;
}
}
tests {
test-name test1 {
test-profile throughput;
test-interface ge-0/0/0.0;
mode initiate-and-terminate;
family inet;
destination-ipv4-address 192.0.2.2
destination-udp-port 4001;
source-ipv4-address 192.0.2.1
}
}
}
路由器 B 上的基准测试参数配置:
[edit interfaces]
ge-0/0/4 {
unit 0 {
family inet {
address 192.0.2.2/24;
}
}
}
[edit services rpm]
rfc2544-benchmarking {
# Note, When in reflector mode, test profile is not needed
tests {
test-name test1 {
test-interface ge-0/0/4.0;
mode reflect;
family inet;
destination-ipv4-address 192.0.2.2;
destination-udp-port 4001;
source-ipv4-address 192.0.2.1
}
}
}