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']
69 Stop the previous VPP session and start it again in order to add a route for new
70 IP addresses 16.0.0.0/8 and 48.0.0.0/8, according to Figure 2. Those IP addresses
71 are needed because TRex generates packets that use these addresses. Refer to the
72 `TRex Manual <http://trex-tgn.cisco.com/trex/doc/index.html>`_ for details on
73 these traffic templates.
75 .. code-block:: console
77 csp2s22c03$ sudo service vpp stop
78 csp2s22c03$ sudo service vpp start
79 csp2s22c03$ sudo vppctl
81 __/ __/ _ \ (_)__ | | / / _ \/ _ \
82 _/ _// // / / / _ \ | |/ / ___/ ___/
83 /_/ /____(_)_/\___/ |___/_/ /_/
86 Name Idx State Counter Count
87 FortyGigabitEthernet82/0/0 1 down
88 FortyGigabitEthernet82/0/1 2 down
92 vpp# set interface ip address FortyGigabitEthernet82/0/0 10.10.1.1/24
93 vpp# set interface ip address FortyGigabitEthernet82/0/1 10.10.2.1/24
94 vpp# set interface state FortyGigabitEthernet82/0/0 up
95 vpp# set interface state FortyGigabitEthernet82/0/1 up
96 vpp# ip route add 16.0.0.0/8 via 10.10.1.2
97 vpp# ip route add 48.0.0.0/8 via 10.10.2.2
100 Now, you can generate a simple traffic flow from *net2s22c05* using the traffic
101 configuration file "cap2/dns.yaml".
103 .. code-block:: console
105 NET2S22C05$ sudo ./t-rex-64 -f cap2/dns.yaml -d 1 -l 1000
108 Total-pkt-drop : 0 pkts
109 Total-tx-bytes : 166886 bytes
110 Total-tx-sw-bytes : 166716 bytes
111 Total-rx-bytes : 166886 byte
113 Total-tx-pkt : 2528 pkts
114 Total-rx-pkt : 2528 pkts
115 Total-sw-tx-pkt : 2526 pkts
116 Total-sw-err : 0 pkts
117 Total ARP sent : 4 pkts
118 Total ARP received : 2 pkts
119 maximum-latency : 35 usec
120 average-latency : 8 usec
121 latency-any-error : OK
123 On *csp2s22c03*, the *show run* command displays the graph runtime statistics.
125 .. figure:: /_images/build-a-fast-network-stack-terminal-2.png