Skip to content

Instantly share code, notes, and snippets.

@bave
Created May 19, 2015 16:30
Show Gist options
  • Save bave/c9589cfafdba6c2f39a0 to your computer and use it in GitHub Desktop.
Save bave/c9589cfafdba6c2f39a0 to your computer and use it in GitHub Desktop.
pktgen script sample
#!/bin/sh
#modprobe pktgen
ETH="eth0"
CLONE_SKB="clone_skb 10"
PKT_SIZE="64"
DELAY="0"
SRC_MAC="00:26:2d:08:8b:25"
DST_MAC="00:26:2d:08:99:fb"
SRC_IP="172.16.0.11"
DST_IP="172.16.0.12"
COUNT="1000000000"
CPUS="1"
echo "rem_device_all" > /proc/net/pktgen/kpktgend_0
echo "add_device ${ETH}" > /proc/net/pktgen/kpktgend_0
echo "count ${COUNT}" > /proc/net/pktgen/${ETH}
echo "clone_skb 1" > /proc/net/pktgen/${ETH}
echo "pkt_size ${PKT_SIZE}" > /proc/net/pktgen/${ETH}
echo "delay ${DELAY}" > /proc/net/pktgen/${ETH}
echo "src_min ${SRC_IP}" > /proc/net/pktgen/${ETH}
echo "src_max ${SRC_IP}" > /proc/net/pktgen/${ETH}
echo "src_mac ${SRC_MAC}" > /proc/net/pktgen/${ETH}
echo "dst ${DST_IP}" > /proc/net/pktgen/${ETH}
echo "dst_mac ${DST_MAC}" > /proc/net/pktgen/${ETH}
echo "start" > /proc/net/pktgen/pgctrl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment