Deploy TRex in Centos7.4

TRex based on DPDK, have high performance for traffics generator scenario. TRex has two deployment scenarios, one is Stateless mode, another is Server/client mode. How different for them? As follow pic. Btw, TRex has a GUI tool that can easy config traffic pattern, but that only support in Stateless mode. For Server/Client mode, only CLI (you can reference “Linux SRv6实战 (第三篇) 多云环境下Overlay(VPP) 和Underlay整合测试 ” that use Server/Client mode). For the article, only focus on stateless mode and GUI tool.

Some useful official document:

  1. TRex -> include more useful information, suggest to detail study
  2. TRex Virtual Machine setup and basic usage -> based on docker and VM, docker is easy, but that use the virtual port in docker; not study VM
  3. TRex GUI

My new Trex blog:

2020 7.20 Update: GUI on Linux

After checked, if you want to install GUI on Linux, must use Oracle JAVA, so you can download at here: jre-8u261-linux-x64.rpm, then install by “yum install -y jre-8u261-linux-x64.rpm”.

After installed, config environment at “/etc/profile”, more information, can check my last blog: Install JAVA in RHEL6.3

# need add follow environment data
export JAVA_HOME=/usr/java/jre1.8.0_261-amd64
export JRE_PATH=/usr/java/jre1.8.0_261-amd64
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_PATH}/lib
export PATH=${JAVA_HOME}/bin:${JRE_PATH}/bin:$PATH

Linux Version

I tried to use ubuntu cloud image (18.04), have module issue; so I switchover to centos cloud image and update to newest version, but have some issue too, at finally, I use official recommend version centos 7.4, not found any issue… we should follow the doc ~ 🙂 Why do I use cloud image? I want to combine the TRex into VIRL.

# hostnamectl set-hostname  frank-trex
[root@frank-trex cisco]# cat /etc/redhat-release
CentOS Linux release 7.4.1708 (Core) 
[root@frank-trex cisco]# cat /proc/version 
Linux version 3.10.0-693.el7.x86_64 ([email protected]) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC) ) #1 SMP Tue Aug 22 21:09:27 UTC 2017
[root@frank-trex cisco]# uname -a
Linux frank-trex.novaloca 3.10.0-693.el7.x86_64 #1 SMP Tue Aug 22 21:09:27 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

CPU and Memory

If you config 2 vCPU, will have some alarms, in order to avoid some issue, please use 4 vCPU, I use 8G memory.

[root@frank-trex cisco]# grep 'physical id' /proc/cpuinfo | sort -u | wc -l
4
[root@frank-trex cisco]# grep 'core id' /proc/cpuinfo | sort -u | wc -l
1
[root@frank-trex cisco]# grep 'processor' /proc/cpuinfo | sort -u | wc -l
4
[root@frank-trex cisco]# dmidecode -s processor-version
pc-i440fx-xenial
pc-i440fx-xenial
pc-i440fx-xenial
pc-i440fx-xenial

Install TRex And Assgin NIC

If you enable other service that need dpdk and NIC, e.g VPP, you must return all DPDK interfaces to Linux driver first, then enable other application, otherwise the kernel maybe crash.

Install Trex

[root@frank-trex cisco]# yum --exclude=kernel* update
[root@frank-trex cisco]# yum install pciutils
[root@frank-trex cisco]# yum install lshw
[root@frank-trex cisco]# yum install wget
[root@frank-trex cisco]# TREX_WEB_URL=http://trex-tgn.cisco.com/trex
[root@frank-trex cisco]# mkdir -p /opt/trex
[root@frank-trex cisco]# cd /opt/trex
[root@frank-trex trex]# wget --no-cache ${TREX_WEB_URL}/release/latest
[root@frank-trex trex]# tar -xzvf latest
[root@frank-trex trex]# cd v2.57/
[root@frank-trex v2.57]# ./dpdk_setup_ports.py -s

Network devices using DPDK-compatible driver
============================================
<none>

Network devices using kernel driver
===================================
0000:00:03.0 '82540EM Gigabit Ethernet Controller' if=ens3 drv=e1000 unused=igb_uio,vfio-pci,uio_pci_generic 
0000:00:04.0 '82540EM Gigabit Ethernet Controller' if=ens4 drv=e1000 unused=igb_uio,vfio-pci,uio_pci_generic *Active*
0000:00:05.0 '82540EM Gigabit Ethernet Controller' if=ens5 drv=e1000 unused=igb_uio,vfio-pci,uio_pci_generic 
0000:00:06.0 '82540EM Gigabit Ethernet Controller' if=ens6 drv=e1000 unused=igb_uio,vfio-pci,uio_pci_generic 

Other network devices
=====================
<none>

Check pci by lshw cmd

[root@frank-trex v2.57]# lshw -class network -businfo
Bus info          Device      Class          Description
========================================================
pci@0000:00:03.0  ens3        network        82540EM Gigabit Ethernet Controller
pci@0000:00:04.0  ens4        network        82540EM Gigabit Ethernet Controller
pci@0000:00:05.0  ens5        network        82540EM Gigabit Ethernet Controller
pci@0000:00:06.0  ens6        network        82540EM Gigabit Ethernet Controller

Assgin NIC

下面的默认配置trex_cfg.yaml可以通过命令“./dpdk_setup_ports.py -i –no-ht”自动生成,详细参考我的另一篇文章:Trex building packets by advance mode in GUI

[root@frank-trex v2.57]# cat /etc/trex_cfg.yaml
     - port_limit    : 2
       version       : 2
       interfaces    : ["00:05.0", "00:06.0"]
       
       port_info       :
            - default_gw : 10.0.0.5
              ip         : 1.1.1.1
            - default_gw : 10.0.0.9
              ip         : 2.2.2.2


[root@frank-trex v2.57]# ./dpdk_setup_ports.py
WARNING: tried to configure 2048 hugepages for socket 0, but result is: 1157
Trying to bind to igb_uio ...
/bin/python dpdk_nic_bind.py --bind=igb_uio 0000:00:05.0 0000:00:06.0 
The ports are bound/configured.
[root@frank-trex v2.57]# ./dpdk_setup_ports.py -s

Network devices using DPDK-compatible driver
============================================
0000:00:05.0 '82540EM Gigabit Ethernet Controller' drv=igb_uio unused=e1000,vfio-pci,uio_pci_generic
0000:00:06.0 '82540EM Gigabit Ethernet Controller' drv=igb_uio unused=e1000,vfio-pci,uio_pci_generic

Network devices using kernel driver
===================================
0000:00:03.0 '82540EM Gigabit Ethernet Controller' if=ens3 drv=e1000 unused=igb_uio,vfio-pci,uio_pci_generic 
0000:00:04.0 '82540EM Gigabit Ethernet Controller' if=ens4 drv=e1000 unused=igb_uio,vfio-pci,uio_pci_generic *Active*

Other network devices
=====================
<none>

Enable TRex in Shell

Due to interactive mode will output more infomraiton and couldn’t stop session, so I need run the TRex in background. Screen is good tool that similar with “jobs + bg + fg” that I summaried at former, can reference Ubuntu CTRL Z的用法

[root@frank-trex v2.57]# yum install screen
[root@frank-trex v2.57]# screen -S trex
[root@frank-trex v2.57]# ./t-rex-64 -i
Starting Scapy server.... Scapy server is started
The ports are bound/configured.
Starting  TRex v2.57 please wait  ... 
 set driver name net_e1000_em 
 driver capability  : TCP_UDP_OFFLOAD 
 set dpdk queues mode to ONE_QUE 
 Number of ports found: 2
zmq publisher at: tcp://*:4500
...

Now Control-a + d, that will let you detached from the screen, if you want to back to screen, can use follow cmd. Btw, if you want to stop screen, you can use “#screen -X -S 9355 quit

[root@frank-trex v2.57]# screen -ls
There is a screen on:
	9355.trex	(Detached)
1 Socket in /var/run/screen/S-root.

[root@frank-trex v2.57]# screen -r 9355

2020-07-23 Update: For Centos8 and Ubuntu 20.04

Base on my testing on ubuntu 20.04, I found report alarm when enable Trex, follow by: ‘./t-rex-64 -i’ failed in ubuntu 20.04 | v2.8.1

Recovery to normal after disable the “intel_iommu” in “/etc/default/grub”:

root@server-test:/opt# more /etc/default/grub |grep GRUB_CMDLINE_LINUX=
GRUB_CMDLINE_LINUX="intel_iommu=off"

root@server-test:/opt# update-grub

Config TRex GUI

Topology

Connect Server

Assign Ports

Config address and get ARP

Config Traffics Pattern

Send traffics and check status

Testbed is XRv9k with license, Dashboard has many information can check.

本文出自 Frank's Blog

版权声明:


本文链接:Deploy TRex in Centos7.4
版权声明:本文为原创文章,仅代表个人观点,版权归 Frank Zhao 所有,转载时请注明本文出处及文章链接
你可以留言,或者trackback 从你的网站

2 Responses to “Deploy TRex in Centos7.4”

  1. Cai Yuan说道:

    Hi Frank,

    I am Cai. I found your article very interesting and I am excited to talk to you, as there are not many articles around about T-REX. I am working on a small satellite network company, and we are introduced T-REX by VyOS engineers when we are exploring the option to replace Cisco 39xx enterprise router with VyOS. The router is to manage a small satellite network with a few thousands subscribers via PPP, with total throughput of only around 50 to 200Mbps. I have a few questions and would be very grateful if you can give us some advice:

    1. Is T-REX and DPDK overkill for our small network testing? Are there any alternatives for network test automation?

    2. We have been using Ubuntu for our development and production. Is it that we shall avoid Ubuntu when it comes to T-REX?

    3. the WAN throughput needs to be adaptive. Currently in Cisco 39xx we have not find a good way to make interface shaping adaptive, and that is why we are trying VyOS, a virtual router in Linux. Do you know if there is any affordable adaptive products around for such purpose?

  2. frank说道:

    Hi CaiYuan,

    1. I suppose any traffics generator can do for network test automation, e.g ixia, spirent, but TREX is free.
    2. From official web, centos is recommended, I am not trying in ubuntu…
    3. Sorry I don’t know what is “make interface shaping adaptive”, and don’t know your detail scenario, if you are interesting, we can talk about by mail. I suppose virtual router is flexible, but performance and convergence is slow than physical devices in general.

    Thanks
    Frank

留言哦

blonde teen swallows load.xxx videos