摘要: 对于网络设备而言,一款好的发包工具至关重要,而目前像IXIA, Sprient等仪表厂商的发包仪表虽然好用,但是价格昂贵,那么是否有一款在功能和性能上能与仪表相当,却又是开源的工具呢,思科的TRex的给出了答案
目前,路由器厂商测试用的都是商业的仪表,一般的性能衡量都是以PPS作为标准,而路由器很复杂,牵扯到7层的应用,而且希望能够提供一种更加真实的流场景测试,TRex应运而生,TRex是一款开源的发包工具,它跑在标准的inter处理芯片上,同时支持stateful和stateless模式,stateful可以描述L4~L7层的应用场景,而stateless主要用来进行定制包的发包
TRex 功能性能
stateful支持高达200Gb/s的流量测试,需要网卡及CPU支持,一般跟core个数有关支持时延和抖动支持NAT/PAT自动学习支持L4~L7stateless轻易产生stateless traffic stream支持大流量 20mpps支持stream并发支持更改报文字段范围支持Continuous/Burst/Multi-burst support支持console/GUI支持每条流的统计支持pythonAPI
思博伦L4-L7旗舰产品Avalanche与TRex的比较
TRex的安装对OS以及网卡有特殊的要求
网卡Intel I350Inter82599Inter X710Mellanox ConnectX-4Cisco1300 seriesVMXNET/VMXNET3E1000
操作系统
Fedora20Fedora21Ubuntu14.04.1Ubuntu16.04.1
检查网卡
@trex:/tmp/trex/v2.23# lspci | grep Ethernet02:00.0Ethernetcontroller: Intel Corporation82545EMGigabit Ethernet Controller (Copper) (rev01)02:01.0Ethernetcontroller: Intel Corporation82545EMGigabit Ethernet Controller (Copper) (rev01)02:02.0Ethernetcontroller: Intel Corporation82545EMGigabit Ethernet Controller (Copper) (rev01)02:03.0Ethernetcontroller: Intel Corporation82545EMGigabit Ethernet Controller (Copper) (rev01)
下载和安装
mkdirtrexcd trexwget --no-cache http://trex-tgn.cisco.com/trex/release/latesttar -zxvf latest
first run trex
Identify the portsroot@trex:/tmp/trex/v2.23# ./dpdk_setup_ports.py -sNetwork devices using DPDK-compatible driver============================================0000:02:01.0'82545EM Gigabit Ethernet Controller (Copper)'drv=igb_uio unused=e1000,vfio-pci,uio_pci_generic0000:02:02.0'82545EM Gigabit Ethernet Controller (Copper)'drv=igb_uio unused=e1000,vfio-pci,uio_pci_generic0000:02:03.0'82545EM Gigabit Ethernet Controller (Copper)'drv=igb_uio unused=e1000,vfio-pci,uio_pci_genericNetwork devices using kernel driver===================================0000:02:00.0'82545EM Gigabit Ethernet Controller (Copper)'if=ens32 drv=e1000,unused=igb_uio,vfio-pci,uio_pci_generic *Active*Other network devices=====================
Active 端口作为管理端口,管理端口不能被绑定到trex,否则不能管理linx, 其它三个网卡可以绑定
cp cfg/simple_cfg.yaml /etc/trex_cfg.yaml,trex默认端口起动配置文件是/etc/trex_cfg.yaml,也可以自定义起动配置文件 "./t-rex-64 --cfg"
配置/etc/trex_yaml端口配置文件1- port_limit:2#端口数量限制2version :2#trex 版本3#List of interfaces. Change to suit your setup. Use ./dpdk_setup_ports.py-sto see av ailable options4interfaces : ["02:01.0","02:02.0"]#对应绑定网卡的pci号5port_info :# Port IPs. Change to suit your needs. Incaseof loopback, you c an leaveasis.6- ip :192.168.10.33#本端eth1的虚接口地址7default_gw :192.168.10.168#对端DUT接口地址8- ip :10.10.10.33#本端eth2的虚接口地址9default_gw :10.10.10.1#对端DUT接口地址
至此虚接口发免费的ARP,并发ARP学习192.168.10.168的MAC,使得本地的Linux与对端的DUT互相学习到MAC地址,此时可以进入stateless模式进行简单测试
启动stateless服务器
./t-rex-64-i
启动终端
@trex:/tmp/trex/v2.23# ./trex-consoleUsing'python'asPython interpeterConnecting to RPC server onlocalhost:4501[SUCCESS]Connecting to publisher server onlocalhost:4500[SUCCESS]Acquiring ports [0,1]: [SUCCESS]ServerInfo:Serverversion: v2.23ServerCPU:1x Intel(R) Xeon(R) CPU E5-2698v3 @2.30GHzPortscount:2x1Gbps @82545EMGigabit Ethernet Controller (Copper)-=TRex Console v2.0=-Type'help'or'?'forsupported actionstrex>
ping
trex>serviceEnabling service mode on port(s) [0,1]: [SUCCESS]trex(service)>ping -p0-d192.168.10.168# -p 端口号 -d dest_ipPinging192.168.10.168fromport0with64bytes of data: Replyfrom192.168.10.168: bytes=64, time=48.52ms, TTL=64Replyfrom192.168.10.168: bytes=64, time=2.42ms, TTL=64^CAction has failedwiththe following error:Interrupted by a keyboard signal (probably ctrl + c)trex(service)>ping -p0-d10.10.10.1Pinging10.10.10.1fromport0with64bytes of data: Replyfrom10.10.10.1: bytes=64, time=22.78ms, TTL=64^CAction has failedwiththe following error:Interrupted by a keyboard signal (probably ctrl + c)trex(service)>ping -p0-d10.10.10.33Pinging10.10.10.33fromport0with64bytes of data: Replyfrom10.10.10.33: bytes=64, time=2.07ms, TTL=128^CAction has failedwiththe following error:Interrupted by a keyboard signal (probably ctrl + c)
只有service 模式支持ARP和PING,这个是stateless的交互模式,便于开始测试网络初始连接
参考:
trex-tgn.cisco.com/trex/doc/trex_stateless.htmlhttp://trex-tgn.cisco.com/trex/doc/trex_manual.html
网友评论