6 In this example we use only two systems, *csp2s22c03* and *net2s22c05*, to run
7 **TRex** VPP is installed on **csp2s22c03** and run as a packet forwarding
8 engine. On *net2s22c05*, TRex is used to generate both client and server-side
9 traffic. **TRex** is a high-performance traffic generator. It leverages DPDK and
10 run in user space. Figure 2 illustrates this configuration.
12 VPP is set up on *csp2s22c03* exactly as it was in the previous example. Only
13 the setup on *net2s22c05* is modified slightly to run TRex preconfigured traffic
16 .. figure:: /_images/trex.png
18 Figure 2: The TRex traffic generator sends packages to the host that has VPP running.
21 First we install **TRex**.
23 .. code-block:: console
25 NET2S22C05$ wget --no-cache http://trex-tgn.cisco.com/trex/release/latest
26 NET2S22C05$ tar -xzvf latest
29 Then show the devices we have.
31 .. code-block:: console
33 NET2S22C05$ sudo ./dpdk_nic_bind.py -s
35 Network devices using DPDK-compatible driver
36 ============================================
37 0000:87:00.0 'Ethernet Controller XL710 for 40GbE QSFP+' drv=vfio-pci unused=i40e
38 0000:87:00.1 'Ethernet Controller XL710 for 40GbE QSFP+' drv=vfio-pci unused=i40e
40 Network devices using kernel driver
41 ===================================
42 0000:03:00.0 'Ethernet Controller 10-Gigabit X540-AT2' if=enp3s0f0 drv=ixgbe unused=vfio-pci *Active*
43 0000:03:00.1 'Ethernet Controller 10-Gigabit X540-AT2' if=enp3s0f1 drv=ixgbe unused=vfio-pci
44 0000:81:00.0 '82599 10 Gigabit TN Network Connection' if=ens787f0 drv=ixgbe unused=vfio-pci
45 0000:81:00.1 '82599 10 Gigabit TN Network Connection' if=ens787f1 drv=ixgbe unused=vfio-pci
51 Create the */etc/trex_cfg.yaml* configuration file. In this configuration file,
52 the port should match the interfaces available in the target system, which is
53 *net2s22c05* in our example. The IP addresses correspond to Figure 2. For more
54 information on the configuration file, please refer to the `TRex Manual <http://trex-tgn.cisco.com/trex/doc/index.html>`_.
56 .. code-block:: console
58 NET2S22C05$ cat /etc/trex_cfg.yaml
61 interfaces: ['87:00.0', '87:00.1']
74 threads: [22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43]
76 Stop the previous VPP session and start it again in order to add a route for new
77 IP addresses 16.0.0.0/8 and 48.0.0.0/8, according to Figure 2. Those IP addresses
78 are needed because TRex generates packets that use these addresses. Refer to the
79 `TRex Manual <http://trex-tgn.cisco.com/trex/doc/index.html>`_ for details on
80 these traffic templates.
82 .. code-block:: console
84 csp2s22c03$ sudo service vpp stop
85 csp2s22c03$ sudo service vpp start
86 csp2s22c03$ sudo vppctl
88 __/ __/ _ \ (_)__ | | / / _ \/ _ \
89 _/ _// // / / / _ \ | |/ / ___/ ___/
90 /_/ /____(_)_/\___/ |___/_/ /_/
93 Name Idx State Counter Count
94 FortyGigabitEthernet82/0/0 1 down
95 FortyGigabitEthernet82/0/1 2 down
99 vpp# set interface ip address FortyGigabitEthernet82/0/0 10.10.1.1/24
100 vpp# set interface ip address FortyGigabitEthernet82/0/1 10.10.2.1/24
101 vpp# set interface state FortyGigabitEthernet82/0/0 up
102 vpp# set interface state FortyGigabitEthernet82/0/1 up
103 vpp# ip route add 16.0.0.0/8 via 10.10.1.2
104 vpp# ip route add 48.0.0.0/8 via 10.10.2.2
107 Now, you can generate a simple traffic flow from *net2s22c05* using the traffic
108 configuration file "cap2/dns.yaml".
110 .. code-block:: console
112 NET2S22C05$ sudo ./t-rex-64 -f cap2/dns.yaml -d 1 -l 1000
115 Total-pkt-drop : 0 pkts
116 Total-tx-bytes : 166886 bytes
117 Total-tx-sw-bytes : 166716 bytes
118 Total-rx-bytes : 166886 byte
120 Total-tx-pkt : 2528 pkts
121 Total-rx-pkt : 2528 pkts
122 Total-sw-tx-pkt : 2526 pkts
123 Total-sw-err : 0 pkts
124 Total ARP sent : 4 pkts
125 Total ARP received : 2 pkts
126 maximum-latency : 35 usec
127 average-latency : 8 usec
128 latency-any-error : OK
130 On *csp2s22c03*, the *show run* command displays the graph runtime statistics.
132 .. figure:: /_images/build-a-fast-network-stack-terminal-2.png