Skip to content
Egor Blagov edited this page Sep 11, 2019 · 24 revisions

Trex server

The fastest and easiest way to configure TRex is install it locally into VirtualBox. Here is a step by step installation instruction:

  • Install VM using this manual
  • Configure VM:
    • Open VM Settings -> Network -> Advanced -> Port forwarding
    • Add VM port forwarding for ports: 4501(async), 4507(scapy-server)
  • Update trex:
    • Start VM and connect via ssh: ssh -p 3022 [email protected] (password: trex)
    • Update TRex to the latest release
    cd /opt/trex/
    wget --no-cache http://trex-tgn.cisco.com/trex/release/latest
    tar -xzvf latest
  • Run TRex server: (cd /opt/trex/v2.* ; sudo ./t-rex-64 -i )

Trex Stateless GUI

Download latest release from https://github.com/cisco-system-traffic-generator/trex-stateless-gui/releases

You can use Mac/Windows installer (dmg/exe files)

Installation

To run TRex stateless GUI you should have Java Runtime 8 installed.

JRE installation

To start TRex stateless GUI you should install Oracle JRE 8 (1.8). Please, follow this link.

Dashboard

Dashboard is active only if the TRex Stateless GUI connected to the TRex server. You can open it from the Stats menu or by click on the dashboard icon in top-right corner of the main window.

trex-main-open-dashboard

Global statistics

At the top of the dashboard you can see global TRex statistics. Global statistics contains ten panels which represents main TRex statistics. Four of them have an color indicator which is green if value is good and red if it is not. It are "CPU", "Rx CPU", "Drop Rate" and "Queue Full". For the "CPU" and "Rx CPU" a good value threshold is 85%, for the "Drop Rate" and "Queue Full" it is 0.

Ports statistics table

Ports statistics table represents total information about all selected ports and detail information about each of it. Here is two rows which have color indicator with good value threshold equals to 0. It are oerrors and ierrors.

trex-dashboard-ports

Ports filter

On the left side of the dashboard you can see the filter panel.

You can filter statistics by selection the port owner(All, My).

trex-dashboard-ports-owner-my

Or you can select specific ports.

trex-dashboard-ports-selection

Streams statistics table

Streams statistics table represents detail information about active streams.

trex-dashboard-streams

Streams count filter

At the bottom of the filter panel you can specify count of streams which you want to see.

trex-dashboard-streams-count

Latency window table

Latency window table represents detail information about the last ten temporary max latencies, jitter, max latency, avg latency and common information about the errors. Errors row has color indicator with good value threshold equals to 0.

trex-dashboard-latency-window

Latency histogram table

Latency window table represents detail information about the latencies and errors. All error rows have color indicator with good value threshold equals to 0.

trex-dashboard-latency-histogram

Charts

Charts view represents graphical information about the streams and latencies.

trex-dashboard-charts

You need to enable RX stats for Streams in order to see them on charts: enable rx stats for stream

You can choose charts interval.

trex-dashboard-charts-interval

You can choose layout to see more charts at the same time.

trex-dashboard-charts-layout

You can click on the chart to select it type.

trex-dashboard-charts-selector

Clear

Clear button provides ability to reset statistics.

trex-dashboard-clear

Port management

Port attributes

Port attributes tab displays detailed port information and provides capabilities to modify port attributes such as Multicast, Promiscuous, Flow control and others. Also it is possible to control port's service mode right from the GUI.

Port Attributes

Layer mode configuration

Now you can easily configure port in L2 or L3 mode with automatic ARP resolution. Also you can ping hosts with properly configured L3 mode. IPv6 is supported also. You can discover IPv6 neighbors and use theirs MAC in L2 configuration. Pinging IPv6 hosts works also.

Port Layer Configuration

Hardware counters

If you have real NIC you probably need to see hardware counters for debugging purposes or any other matters. By default non-zero counters is visible. If you need to find certain counter you can specify it's name in the filter and pin interested one and see the value despite on filter options.

Port Hardware Counters

Packet Capture

User can monitor activity on TRex ports without connecting to the TRex console. It is very useful capability which completes full lifecycle of traffic generation. Create streams -> Combine them into a profile and specify bandwidth/rate etc -> Start Traffic -> Verify the results.

Monitor

The are two ways to see captured packets in realtime. The first one is use simple TRex GUI. And the second one is launch monitoring in Wireshark.

capture_monitor_compressed

Similar to Wireshark TRex GUI also can show detailed packet information.

packet_viewer

Record

Another useful feature is record packets and save them as PCAP file later.

capture_recorder_compressed

Packet editor

You can find embedded packet editor in a build/edit stream dialogs. To open Packet Editor you need to click on "Advanced mode" button in stream editor window.

packet editor standalone app screenshot

Appending new layer

You can select available(suggested) layers, or type any layer you want to produce a malformed structure. Click on a append field and start typing - autocompletion will show all available variants without restrictions. append-new-layer

Moving and deleting layers

Packet editor is flexible and uses Scapy to build packets. It allows to create malformed packets, and shows a warning(red label on a layer name). You can move and remove any layer(except Ether) by the right-click on the layer title incorrect-layer-structure-and-menu

Menu and Toolbar

You can use menu, hotkeys and the toolbar to use the following features:

  • create a new packet
  • create a new packet from the template
  • undo & redo
  • import a first packet of the PCAP file
  • Export packet to PCAP file or save current packet model to a JSON file menu-and-toolpbar

Menu is not available in the embeded mode

Payload generator

Payload generator can append Random or template bytes to any layer You have following options:

payload-generator-options

Use template-code and specify the target size of a payload of a whole packet you want. Template code is a hex string. Example: "DE AD BE EF F0 0D" (6 bytes will be repeated to fill the target size. all whitespaces are ignored). payload-generator-code

You can upload a binary file as a payload payload-generator-file

Use "random ascii/bytes" option to generate random payloads of printable characters or any bytes. payload-generator-bytes-packet-size

Binary viewer

At any time you can see the binary representation of a network packet you've created. Click on a field to highlight corresponding packet bytes in a binary viewer

binary-viewer-mac

binary-viewer-text-payload

Field engine

field-editor

List of supported instructions

  • STLVmFlowVar
  • STLVmWrFlowVar
  • STLVmWrMaskFlowVar
  • STLVmFixIpv4
  • STLVmTrimPktSize
  • STLVmTupleGen
  • STLVmFlowVarRepetableRandom
  • STLVmFixChecksumHw

Smart autocomplete for instruction parameters. Flow variable names:

field-editor-autocomplete-var_names

Fields' offset names:

field-editor-autocomplete-offsets

Handle protocol duplication. Packet structure widget and offset autocompleter knows when packet contains duplicate protocols and suggest protocol indexes also.

field-editor-autocomplete-offsets-with-duplicate-IP

Create predefined instructions template with initial parameter values:

screen shot 2016-12-06 at 1 43 33 am screen shot 2016-12-06 at 1 45 26 am

Interactive help for instructions:

field-editor-help

Automatically import parameters from simple configuration mode

It is easy to export parameters from simple configuration mode to Advanced(Packet Editor + Field Engine).

screen shot 2016-12-16 at 12 36 44 pm

screen shot 2016-12-16 at 12 37 49 pm

screen shot 2016-12-16 at 12 38 03 pm

screen shot 2016-12-16 at 12 38 23 pm

TRex Daemon

You can find TRex Daemon dialog in menu bar. It provides ability to edit config, start and stop remote TRex, if daemon is started on TRex machine.

Config editor

TRex daemon config editor

Based on TRex config parameters, provides convenient interface for editing TRex config. Button Load default config pulls default config from TRex remote machine and uploads it to the GUI.

Start and stop TRex

Started TRex

After you've configured TRex with needed parameters, you could start it using the daemon. Previewed YAML will be uploaded to TRex machine and will be used to start TRex.

Build a Native App

This section describes how to build a native application bundle (EXE for Windows and DMG for Mac).

  1. mvn clean jfx:native (generates the native packaging using Maven).
  2. Look for the the installer, DMG, or EXE in (project)\target\jfx\native.

This will build an installer for whatever platform you are building on. Building on a Mac will produce a Mac app. Building on a Windows PC will produce a Windows app.

Building a Windows Installer and Native Application EXE

Building a Mac DMG or Windows EXE works straight of the box. However, Windows requires either WiX for MSI creation or Inno Setup for an EXE-based installer (both install an EXE for the JavaFX application along with a packaged JRE).

Both don't need to be installed, just whichever one gets you to your desired installer format.

Build an EXE Installer with Inno Setup

Follow the steps below to create an EXE-based installer with Inno Setup and the JavaFX Maven plugin.

  1. Download from Inno Setup's site
  2. Install it (I defaulted most of the installation options)
  3. Add C:\Program Files (x86)\Inno Setup 5 to your system Path variable.

Once done, run mvn jfx:native to create an EXE based installer at (project)\target\jfx\native.

By running the EXE installer, it installs the JavaFX application to the user's local app data folder, as well as an uninstaller entry in the Programs and Features control panel. The application is also launched immediately following installation.

Build an MSI with WiX

To install WiX and have the JavaFX Maven plugin use it during a build, do the following:

  1. Download from WiX's site
  2. Install it.
  3. Add C:\Program Files (x86)\WiX Toolset v3.10\bin to your system Path variable.

Once that is complete, mvn jfx:native will create an MSI file in (project)\target\jfx\native\bundles.

Running the MSI installs the application to C:\Program Files (x86)\(project name) without prompt. Additionally, it creates an uninstaller listing in the Programs and Features control panel.