Using a search for "linux ethernet packet generator" gives me packeth as the first hit.
- Has both a GUI and CLI version
- Generates not only UDP, but many other protocols as well, including QinQ
- Is packaged for RedHat as an rpm, or Debian package
If it was me, I would just do a quick-and-dirty ten second netcat test, because netcat is already installed in most linux distros... this is an example of sending a linux file (or in my example, /dev/urandom
) via UDP...
First start tcpdump on both sides, and listen for a rare UDP port (use 65535/udp in this example). I'm using -s 1
to reduce the amount of work tcpdump
has to do (which means it captures faster).
tcpdump -s 1 -ni eth0 udp and port 65535
Next, optionally start your receiver with a timed finish (backgrounding the netcat portion in a subshell so it won't block). This is not really necessary if you don't care about checksumming the received data.:
(nc -q 1 -u -l -p 65535 > /dev/null &); sleep 10; fuser -k 65535/udp;
Then, start your Transmitter ... in this case, I show it pushing the output of /dev/urandom
to on udp/65535. Use a real file if you like...
(cat /dev/urandom | nc -u <DESTINATION_IP> 65535&); sleep 10; \
fuser -n udp ,<DESTINATION_IP>,65535 -k
be sure you choose the timeout (I'm using sleep 10
, above) to be long enough to sequence the shell commands and finish the network transfer. If you're transferring something other than /dev/urandom
, be sure you sleep
long enough to finish the file transfer.
When you're done, stop tcpdump on both sides. When it exits, you'll get packet counts from tcpdump:
[mpenning@tsunami ~]$ sudo tcpdump -s 1 -ni eth0 udp and port 65535
14:18:55.563674 [|ether]
14:18:55.563688 [|ether]
^C
2000 packets captured
2000 packets received by filter
0 packets dropped by kernel
[mpenning@tsunami ~]$
Do the math of sender_count
- receiver_count
, and that's your packet loss.