Deploying Cisco traffic generator in GNS3
July 21, 2016 6 Comments
Goal: Deploy TRex, a realistic Cisco traffic generator, to test devices in GNS3.
TRex traffic generator is a tool designed to benchmark platforms using realistic traffic.
One of the tools through which TRex can be learned and tested is a virtual machine instance, fully simulating TRex without the need for any additional hardware.
The TRex Virtual Machine is based on Oracle’s Virtual Box freeware.
It is designed to enable TRex newbies to explore this tool without any special resources.
Download the virtual appliance ova file: http://trex-tgn.cisco.com/trex/T_Rex_162_VM_Fedora_21.ova
Open the image in VMWare (I am using VMWare workstation)
From GNS3 import the VMWare device:
Edit the VM template and make sure to select “Allow GNS3 to use any configured VMware adapter”
Insert the a device to test, DUT (Device Under Test), in our case it is a Cisco IOU router and build the following topology, in which TRex will play the role of the client and the server for the generated traffic.
Because TRex doesn’t implement ARP, we have to manually indicate the router MAC addresses of the directly connected interfaces.
You can set TRex to match the DUT MACs or DUT to match the default MAC configured on TRex. We opt for the first solution:
Note the router interface MAC addresses:
Login to TRex through the console:
and edit Trex configuration file
and change the DUT MACs
Make sure the list of interfaces ids match the ones defined by dpdk_nic_bind.py
sudo ./dpdk_nic_bind.py –status
We also need to set our router under test with the MAC addersses used by TRex for the traffic.
On the IOU router:
IOU1(config-if)#ip address 192.168.10.2 255.255.255.0
IOU1(config-if)#ip address 192.168.20.2 255.255.255.0
IOU1(config)#arp 192.168.10.1 0800.2723.21dc ARPA
IOU1(config)#arp 192.168.20.1 0800.2723.21dd ARPA
IOU1(config)#do sh arp
Protocol Address Age (min) Hardware Addr Type Interface
Internet 192.168.10.1 – 0800.2723.21dc ARPA
Internet 192.168.20.1 – 0800.2723.21dd ARPA
e0/1 and e0/2 IP addresses are configured with 192.168.10.2 and 192.168.20.2. In fact it doesn’t matter for TRex because we have routes to forward traffic out the appropriate interfaces to reach TRex interfaces.
On the router set routes to the emulated client and servers:
ip route 18.104.22.168 255.0.0.0 192.168.10.1
ip route 22.214.171.124 255.0.0.0 192.168.20.1
For this lab we will generate IMIX traffic (64byte UDP packets profile) from emulated clients and servers using virtual IP range configurable in 16.0.0.[1-255] and 48.0.[0.1-255.255]
Back to TRex:
So let’s configure our router to route traffic destined to previous ranges out the appropriate interfaces.
IOU1(config)#ip route 126.96.36.199 255.0.0.0 192.168.10.1
IOU1(config)#ip route 188.8.131.52 255.0.0.0 192.168.20.1
Start the emulation on Trex:
sudo ./t-rex-64 -f cap2/imix_64.yaml -d 60 -m 40000 -c 1
You can observe the generated traffic passing through the router with Wireshark
For more inf. please refer to