No description, website, or topics provided.
C++ M4 Other
Switch branches/tags
Nothing to show
Clone or download
bmerry Allow generating packets to send to multiple addresses.
Passing --addresses N when in packet generator mode will cause packets
to be round-robined across N consecutive addresses, starting with the
given one.
Latest commit 755709e May 23, 2018
Failed to load latest commit information.
COPYING Add license and documentation Jun 9, 2015 Redesign to reduce overheads Oct 15, 2016 Add option to act as a packet generator Apr 11, 2018
common.cpp Add option to set IP_MULTICAST_TTL Oct 11, 2017
common.h Allow generating packets to send to multiple addresses. May 23, 2018 Make pfpacket udpcount backend optional Oct 23, 2017
ibv_transmit.cpp Stop trying to allocate huge pages after first failure Oct 12, 2017
ibv_transmit.h Add option to set IP_MULTICAST_TTL Oct 11, 2017
sendmmsg_transmit.cpp Add option to set IP_MULTICAST_TTL Oct 11, 2017
udpcount.cpp Make pfpacket udpcount backend optional Oct 23, 2017
udpreplay.cpp Allow generating packets to send to multiple addresses. May 23, 2018


udpreplay is a tool to replays UDP packets from a pcap dump.

Unlike tcpreplay, it only replays the payload and not the headers, so it does not require root privileges and works fine with the Linux loopback device.

It supports rate control, either in packets per second or bits per second. It can also replay the original timings.

The packets are pre-loaded from the pcap file, so it is possible to send at a higher rate than the packets can be loaded. Typically, the NIC or the kernel limits the maximum rate.

Instead of providing a pcap file, one can provide a number, which is used as a packet size (specifically, the UDP payload size), and generates an infinite stream of packets (or a finite stream if --repeat is used).


An extra tool is included, called udpcount. It listens for UDP packets on a socket, and reports statistics about the number of bytes and packets received once per second.


You will need libpcap (including development headers), Boost headers, and the libraries for the Boost system and program_options libraries. You will also need a modern C++11-capable compiler. GCC 4.8 and Clang 3.4 are known to work.


udpcount uses the standard autoconf/automake flow for installation. If you are installing from a git checkout, you should first run ./ After that, it is the usual process of

sudo make install


First, capture a file using tcpdump or whichever tool you prefer. Only ethernet frame types are currently supported (which includes the Linux loopback device). Then to replay it at 100Mbps, run

udpreplay --mbps 100 capture.pcap

Run udpreplay -h to see a list of other options. A particularly useful option on Linux is --mode sendmmsg, which can increase performance.

Infiniband Verbs API

If your NIC supports the Infiniband Verbs API, you may be able to get higher performance by passing --mode=ibv. Support will be automatically detected at configure time.

There are some caveats. It can only be used with multicast destination addresses, and you must specify the interface to use by passing --bind <ip-address>.

Original timings

Specifying --use-timestamps will attempt to replay the packets according to the timestamps in the original file. The mode is somewhat less efficient, so it might not keep up with the goal when packets are close together in time.

Original destinations

Normally, udpreplay sends all the traffic to a specific host and port, ignoring the values in the original packets. With --use-destination, it will instead use the original IP address and port. Note that the MAC address is not used, even when using --mode=ibv, so if you edit the file to change the destination, it's not necessary to update the MAC address to match.


This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see