Installing and configuring TRex for use with Napatech Link™ Capture Software.
Introduction
TRex is a fast realistic open source traffic generation tool, running on standard Intel processors. TRex uses DPDK libs and drivers, included in TRex. Napatech Link™ Capture Software provides a kernel driver that DPDK can run on top of, replacing the DPDK kernel driver igb_uio.
TRex must be built from source.
Steps
- Download the TRex source: https://github.com/cisco-system-traffic-generator/trex-core, or clone from https://github.com/cisco-system-traffic-generator/trex-core.git.
- Install Napatech Link™ Capture Software: see Installing Napatech Link™ Capture Software.
- Start and stop ntservice in order to create the driver
configuration file ntservice.ini:
$ sudo /opt/napatech3/bin/ntstart.sh Loading nt3gd driver [Done] Creating driver device file [Done] Loading nt3gd_netdev driver [Done] Creating driver device file [Done] Starting NTService (this may take a while) [Done] $ sudo /opt/napatech3/bin/ntstop.sh Stopping NTService (this may take a while) NTService stopped [Done]
- Change the number of RX and TX buffers in ntservice.ini from 4 to
32:
HostBuffersRx = [32,16,-1] # [x1, x2, x3], ... HostBuffersTx = [32,16,-1] # [x1, x2, x3], ...
- Start ntservice.
- Build TRex with Napatech support:
# cd linux_dpdk #./b configure --no-mlx=NO_MLX --with-ntacc Setting top to : /usr/project/trex-core Setting out to : /usr/project/trex-core/linux_dpdk/build_dpdk Checking for program 'gcc, cc' : /usr/bin/gcc Checking for program 'ar' : /usr/bin/ar Checking for program 'g++, c++' : /usr/bin/g++ Checking for program 'ar' : /usr/bin/ar Checking for program 'ldd' : /usr/bin/ldd Checking for library z : yes Build sanitized images (GCC >= 4.9.0) : no Checking for NTAPI : Found needed NTAPI library 'configure' finished successfully (0.408s) #./b Waf: Entering directory `/usr/builds/trex-core.github.rsync/linux_dpdk/build_dpdk' Info: Using external libverbs. update version files ... [1206/1210] Compiling version.c [1207/1210] Linking build_dpdk/linux_dpdk/_t-rex-64-debug-o [1208/1210] Linking build_dpdk/linux_dpdk/_t-rex-64-debug [1209/1210] Linking build_dpdk/linux_dpdk/_t-rex-64-o [1210/1210] Linking build_dpdk/linux_dpdk/_t-rex-64 Waf: Leaving directory `/usr/builds/trex-core.github.rsync/linux_dpdk/build_dpdk' *** generating softlinks *** 'build' finished successfully (15.621s)
- Create a TRex configuration file: Use dpdk_setup_ports.py to create the config file:
# ./dpdk_setup_ports.py -i By default, IP based configuration file is created. Do you want to use MAC based config? (y/N) +----+------+---------+-------------------+------------------------------------------------+--------+------------+----------+ | ID | NUMA | PCI | MAC | Name | Driver | Linux IF | Active | +====+======+=========+===================+================================================+========+============+==========+ | 0 | 0 | 05:00.0 | | NT20E2 Network Adapter 2x10Gb | nt3gd | | | +----+------+---------+-------------------+------------------------------------------------+--------+------------+----------+ | 1 | 0 | 07:00.0 | ac:22:0b:02:6d:21 | 82574L Gigabit Network Connection | e1000e | enp7s0 | *Active* | +----+------+---------+-------------------+------------------------------------------------+--------+------------+----------+ | 2 | 0 | 08:00.0 | ac:22:0b:02:6d:22 | 82574L Gigabit Network Connection | e1000e | enp8s0 | | +----+------+---------+-------------------+------------------------------------------------+--------+------------+----------+ | 3 | 1 | 82:00.0 | 00:1b:21:77:c5:54 | 82599ES 10-Gigabit SFI/SFP+ Network Connection | ixgbe | enp130s0f0 | | +----+------+---------+-------------------+------------------------------------------------+--------+------------+----------+ | 4 | 1 | 82:00.1 | 00:1b:21:77:c5:55 | 82599ES 10-Gigabit SFI/SFP+ Network Connection | ixgbe | enp130s0f1 | | +----+------+---------+-------------------+------------------------------------------------+--------+------------+----------+ | 5 | 1 | 86:00.0 | | NT100E3-1-PTP Network Adapter 1x100Gb | nt3gd | | | +----+------+---------+-------------------+------------------------------------------------+--------+------------+----------+ | 6 | 1 | 87:00.0 | | NT100E3-1-PTP Network Adapter 1x100Gb | nt3gd | | | +----+------+---------+-------------------+------------------------------------------------+--------+------------+----------+ | 7 | 1 | 8a:00.0 | | NT80E3-2-PTP Network Adapter 2x40Gb | nt3gd | | | +----+------+---------+-------------------+------------------------------------------------+--------+------------+----------+ | 8 | 1 | 8b:00.0 | | NT80E3-2-PTP Network Adapter 2x40Gb | nt3gd | | | +----+------+---------+-------------------+------------------------------------------------+--------+------------+----------+ Choose even number of interfaces from the list above, either by ID , PCI or Linux IF Stateful uses order of interfaces: Client1 Server1 Client2 Server2 etc. for flows. Stateless can be in any order. For performance, try to choose each pair of interfaces to be on the same NUMA. Enter list of interfaces separated by space (for example: 1 3) : 7 8 For interface 7, assuming loopback to it's dual interface 8. Putting IP 1.1.1.1, default gw 2.2.2.2 Change it?(y/N). For interface 8, assuming loopback to it's dual interface 7. Putting IP 2.2.2.2, default gw 1.1.1.1 Change it?(y/N). Print preview of generated config? (Y/n) ### Config file generated by dpdk_setup_ports.py ### - port_limit: 2 version: 2 interfaces: ['8a:00.0', '8b:00.0'] port_bandwidth_gb: 40 port_info: - ip: 1.1.1.1 default_gw: 2.2.2.2 - ip: 2.2.2.2 default_gw: 1.1.1.1 platform: master_thread_id: 0 latency_thread_id: 1 dual_if: - socket: 1 threads: [8,9,10,11,12,13,14,15,24,25,26,27,28,29,30,31] Save the config to file? (Y/n) Default filename is /etc/trex_cfg.yaml Press ENTER to confirm or enter new file: File /etc/trex_cfg.yaml already exist, overwrite? (y/N)Y Saved to /etc/trex_cfg.yaml.
- Get the SmartNIC bus ID:
To find the correct Bus ID, run adapterinfo [Link].
- Edit the TRex configuration file to include the Bus ID: For example: dpdk_setup_ports.py generates the following config file:
### Config file generated by dpdk_setup_ports.py ### - port_limit: 2 version: 2 interfaces: ['8a:00.0', '8b:00.0'] port_bandwidth_gb: 40 port_info: - ip: 1.1.1.1 default_gw: 2.2.2.2 - ip: 2.2.2.2 default_gw: 1.1.1.1 platform: master_thread_id: 0 latency_thread_id: 1 dual_if: - socket: 1 threads: [8,9,10,11,12,13,14,15,24,25,26,27,28,29,30,31]
Edit the line interfaces: ['8a:00.0', '8b:00.0'] to interfaces: ['8a:00.0/0', '8a:00.0/1'] in order to use the correct bus ID and port 0 and port 1.
### Config file generated by dpdk_setup_ports.py ### - port_limit: 2 version: 2 interfaces: ['8a:00.0', '8b:00.0'] port_bandwidth_gb: 40 port_info: - ip: 1.1.1.1 default_gw: 2.2.2.2 - ip: 2.2.2.2 default_gw: 1.1.1.1 platform: master_thread_id: 0 latency_thread_id: 1 dual_if: - socket: 1 threads: [8,9,10,11,12,13,14,15,24,25,26,27,28,29,30,31]
TRex setup and use
See the TRex documentation for how to set up TRex and Linux with hugepages and other settings.
Related links
TRex site: https://trex-tgn.cisco.com/.
TRex source: https://github.com/cisco-system-traffic-generator/trex-core.
TRex documentation: http://trex-tgn.cisco.com/trex/doc/.