Ubuntu24.04 + Cisco TRex v3.08
Windows BitLocker と Ubuntu Linux のデュアルブートを debootstrap で実現 で余ったPCに入れた Linux で TRex を動かしてみました。TRex は Cisco が Apache 2.0 License で開発しているトラフィックジェネレータで、DPDK で使える NIC が必要です。公式にはかなり古い CentOS をサポートしているのですが、これを新しめの Ubuntu 24.04LTS でも動くのか試します。あと数ヶ月後には 26.04 LTS が出るけど…。
TRex: https://trex-tgn.cisco.com/
TRex GitHub: https://github.com/cisco-system-traffic-generator
お試し環境
- OS: Ubuntu 24.04.3 (6.8.0-90-generic)
- TRex: v3.08.tar.gz (2025-11-05 14:20)
- NIC: Intel 82599ES 10G SFP+ *2ports
- CPU: Intel Core i7-6700K @ 4.00GHz (Windows11非対応の哀れな世代)
- RAM: 64GB
動作確認が目標なので、とりあえず10G SRのトランシーバをさして 2port を直結しました。
セットアップ
Ubuntu には build-essentials, dpdk あたりを apt install しておきます。その後 TRex の最新である v3.08.tar.gz を https://trex-tgn.cisco.com/trex/release/ からダウンロードし、適当なところに展開しました。
HugePages
2M * 4096pages (8GB) こんなにいらないと思うけど
$ grep CMDLINE_LINUX_DEFAULT /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="intel_iommu=on iommu=pt hugepagesz=2M hugepages=4096"
$ sudo update-grub
$ sudo shutdown -r now
$ grep Huge /proc/meminfo
AnonHugePages: 0 kB
ShmemHugePages: 0 kB
FileHugePages: 0 kB
HugePages_Total: 4096
HugePages_Free: 4096
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
Hugetlb: 8388608 kB
$
TRex
TRex の設定ファイルを適当に作成
$ lspci | grep Ethernet
00:1f.6 Ethernet controller: Intel Corporation Ethernet Connection (2) I219-V (rev 31)
01:00.0 Ethernet controller: Intel Corporation 82599ES 10-Gigabit SFI/SFP+ Network Connection (rev 01)
01:00.1 Ethernet controller: Intel Corporation 82599ES 10-Gigabit SFI/SFP+ Network Connection (rev 01)
$
$ cat /etc/trex_cfg.yaml
- version: 2
interfaces: ['01:00.0', '01:00.1']
port_info:
- ip: 192.168.160.1
dest_mac: '90:1b:0e:00:00:01'
- ip: 192.168.161.1
dest_mac: '90:1b:0e:00:00:02'
platform:
master_thread_id: 0
latency_thread_id: 1
dual_if:
- socket: 0
threads: [2,3,4,]
$
port_info の ipは今はなくていいです。MACアドレスは対向のNICのMACアドレスを書いておきます。対向といっても単にNICのMACアドレスを2つ書けばいいのですが。
動かす
これで sudo ./t-rex-64 -i でTRexを起動させます。
$ sudo ./t-rex-64 -i
Starting Scapy server.... Scapy server is started
The ports are bound/configured.
Starting TRex v3.08 please wait ...
set driver name net_ixgbe
driver capability : TCP_UDP_OFFLOAD TSO LRO
set dpdk queues mode to DROP_QUE_FILTER
Number of ports found: 2
zmq publisher at: tcp://*:4500
wait 1 sec .
port : 0
------------
link : link : Link Up - speed 10000 Mbps - full-duplex
promiscuous : 0
port : 1
------------
link : link : Link Up - speed 10000 Mbps - full-duplex
promiscuous : 0
number of ports : 2
max cores for 2 ports : 1
tx queues per port : 3
-------------------------------
RX core uses TX queue number 1 on all ports
core, c-port, c-queue, s-port, s-queue, lat-queue
------------------------------------------
1 0 0 1 0 2
-------------------------------
別の端末にて, trex-console で
$ ./trex-console
Using 'python3' as Python interpeter
Connecting to RPC server on localhost:4501 [SUCCESS]
Connecting to publisher server on localhost:4500 [SUCCESS]
Acquiring ports [0, 1]: [SUCCESS]
Server Info:
Server version: v3.08 @ STL
Server mode: Stateless
Server CPU: 1 x Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz
Ports count: 2 x 10Gbps @ 82599ES 10-Gigabit SFI/SFP+ Network Connection
-=TRex Console v3.0=-
Type 'help' or '?' for supported actions
trex> start -f stl/bench.py -m 1gbps -p 0 1
Removing all streams from port(s) [0._, 1._]: [SUCCESS]
Attaching 1 streams to port(s) [0._]: [SUCCESS]
Attaching 1 streams to port(s) [1._]: [SUCCESS]
Starting traffic on port(s) [0._, 1._]: [SUCCESS]
33.89 [ms]
trex>
となって, これはパッと見は動いたかと思ったんですが、サーバ t-rex-64 -i 側が
(snip...)
sh: 1: /usr/bin/addr2line: not found
WATCHDOG: task 'Trex DP core 1' has not responded for more than 1.00027 seconds - timeout is 1 seconds
*** traceback follows ***
1 0x6ca9bd ./_t-rex-64() [0x6ca9bd]
2 0x79d3eee45320 /lib/x86_64-linux-gnu/libc.so.6(+0x45320) [0x79d3eee45320]
3 0x9e5462 rte_delay_us_block + 82
4 0x655da3 ./_t-rex-64() [0x655da3]
5 0x656ec8 CCoreEthIFStateless::send_node(CGenNode*) + 424
6 0x6b96b9 CNodeGenerator::handle_stl_node(CGenNode*, CFlowGenListPerThread*) + 825
7 0x6b1404 CNodeGenerator::flush_file(double, double, bool, CFlowGenListPerThread*, double&) + 2500
8 0x8742e0 TrexStatelessDpCore::start_scheduler() + 272
9 0x7f1e30 TrexDpCore::start() + 80
10 0x6a537d CFlowGenListPerThread::start(std::string&, CPreviewMode&) + 93
11 0x52d8d6 CGlobalTRex::run_in_core(unsigned char) + 412
12 0x6578bd ./_t-rex-64() [0x6578bd]
13 0x9e4d98 eal_thread_loop + 248
14 0x9f4dd9 ./_t-rex-64() [0x9f4dd9]
15 0x79d3eee9ca94 /lib/x86_64-linux-gnu/libc.so.6(+0x9ca94) [0x79d3eee9ca94]
16 0x79d3eef29c3c /lib/x86_64-linux-gnu/libc.so.6(+0x129c3c) [0x79d3eef29c3c]
*** addr2line information follows ***
./t-rex-64: line 109: 2439 Aborted ./_$(basename $0) $INPUT_ARGS $EXTRA_INPUT_ARGS
Killing Scapy server... Scapy server is killed
$
止まりました。おっと binutils 入れ忘れてた。……そういう問題ではなく、低速で試しても trex> start -f stl/bench.py -m 1kpps -p 0 やっぱり同様に止まります。--no-watchdog を付けると刺さって帰って来れなくなります。これを追うのは面倒そうなので uio_pci_generic 以外のドライバを試します。
そして TRex v3.08 の ko/src/ の igb_uio は古くて, Kernel 5 or 6 近辺以降ではコンパイルできません(pci_set_dma_mask() はもうありません)。では Ubuntu の vfio-pci を明示的に使ってみます。
$ sudo modprobe vfio-pci
$ sudo dpdk-devbind.py -b vfio-pci 01:00.0 01:00.1
$ sudo dpdk-devbind.py -s
Network devices using DPDK-compatible driver
============================================
0000:01:00.0 '82599ES 10-Gigabit SFI/SFP+ Network Connection 10fb' drv=vfio-pci unused=ixgbe
0000:01:00.1 '82599ES 10-Gigabit SFI/SFP+ Network Connection 10fb' drv=vfio-pci unused=ixgbe
Network devices using kernel driver
===================================
0000:00:1f.6 'Ethernet Connection (2) I219-V 15b8' if=eth0 drv=e1000e unused=vfio-pci *Active*
drv=vfio-pci であればOKです。unused=ixgbe は普通の通信(普通とは?)に使うドライバがunusedですね。もうこの状態であれば OS からは見えなくなっています。OSから使うように戻すなら sudo dpdk-devbind.py -b ixgbe 01:00.0 01:00.1 などとします。
その下に出てる I219-V は Intel のオンボードNICですが、これは普通の通信のために e1000e で動いたままです。
再チャレンジ
$ sudo ./t-rex-64 -i
Starting Scapy server.... Scapy server is started
The ports are bound/configured.
Starting TRex v3.08 please wait ...
(snip)
別の端末にて, trex-console で 64 bytes のショート UDP パケットを 100% で相互に送信してみます。これの最大値は約 14.88Mpps (が2個) になるはずです。64+8(UDP)+12(IFG) == 84, 10G/84/8 ≈ 14.88M
trex> start -f stl/udp_1pkt_simple.py -m 100% -p 0 1
...
trex> stats
Global Statistics
connection : localhost, Port 4501 total_tx_L2 : 15.24 Gbps
version : STL @ v3.08 total_tx_L1 : 20 Gbps
cpu_util. : 95.09% @ 1 cores (1 per dual port) total_rx : 15.24 Gbps
rx_cpu_util. : 0.0% / 0 pps total_pps : 29.76 Mpps
async_util. : 0% / 15.04 bps drop_rate : 0 bps
total_cps. : 0 cps queue_full : 24,318,235 pkts
Port Statistics
port | 0 | 1 | total
-----------+-------------------+-------------------+------------------
owner | user | user |
link | UP | UP |
state | TRANSMITTING | TRANSMITTING |
speed | 10 Gb/s | 10 Gb/s |
CPU util. | 95.09% | 95.09% |
-- | | |
Tx bps L2 | 7.62 Gbps | 7.62 Gbps | 15.24 Gbps
Tx bps L1 | 10 Gbps | 10 Gbps | 20 Gbps
Tx pps | 14.88 Mpps | 14.88 Mpps | 29.76 Mpps
Line Util. | 100 % | 100 % |
--- | | |
Rx bps | 7.62 Gbps | 7.62 Gbps | 15.24 Gbps
Rx pps | 14.88 Mpps | 14.88 Mpps | 29.76 Mpps
---- | | |
opackets | 7678336858 | 7678337435 | 15356674293
ipackets | 7678336748 | 7678337490 | 15356674238
obytes | 491413559360 | 491413596288 | 982827155648
ibytes | 491413552256 | 491413599808 | 982827152064
tx-pkts | 7.68 Gpkts | 7.68 Gpkts | 15.36 Gpkts
rx-pkts | 7.68 Gpkts | 7.68 Gpkts | 15.36 Gpkts
tx-bytes | 491.41 GB | 491.41 GB | 982.83 GB
rx-bytes | 491.41 GB | 491.41 GB | 982.83 GB
----- | | |
oerrors | 0 | 0 | 0
ierrors | 0 | 0 | 0
trex>
結論
TRexは古めのディストリビューションでないといろいろ罠があるというやつなんですけど、2025年後半ごろ Python3.12 で動くように修正が入ったおかげで、Ubuntu24.04 でも比較的簡単に動きそうでした。
- drop_rate: 0
- TX bps L2: 7.62 Gbps (≈ラインレート)
- TX bps L1: 10 Gbps (≈ラインレート)
- TX pps: 14.88 Mpps (たまたまきっちり綺麗に出たな?)
- Line Util.: 100 % (≈ラインレート)
- RX bps: 7.62 Gbps (≈ラインレート)
- RX pps: 14.88 Mpps (≈ラインレート)
- CPU util.: 95.09% (ギリ)
10Gならまあ使えそうでしょうかね? なんかCPUがギリっぽいのは気になるけど、ここまで動けばこの先はどうとでもなりそうです。