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 

 

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 (builder@kbuilder.dev.centos.org) (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

[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

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.

 

0
你可以留言,或者trackback 从你的网站

留言哦

blonde teen swallows load.xxx videos