Skip to content

Instantly share code, notes, and snippets.

@wenjianhn
Created December 9, 2015 05:41
Show Gist options
  • Save wenjianhn/8a4e82796b48746245d2 to your computer and use it in GitHub Desktop.
Save wenjianhn/8a4e82796b48746245d2 to your computer and use it in GitHub Desktop.
/sbin/modprobe pktgen
neigh_ip=$1
ping -c 1 ${neigh_ip}
DST=${neigh_ip}
DST_MAC=$(ip neigh | grep ${neigh_ip} | awk '{print $5}')
# DEVICE=$(ip neigh | grep ${neigh_ip} | awk '{print $3}')
DEVICE=eth0
PKT_SIZE=64
echo "rem_device_all" > /proc/net/pktgen/kpktgend_0
echo "add_device ${DEVICE}" > /proc/net/pktgen/kpktgend_0
echo "count 10000000" > /proc/net/pktgen/${DEVICE}
echo "clone_skb 1000000" > /proc/net/pktgen/${DEVICE}
echo "pkt_size ${PKT_SIZE}" > /proc/net/pktgen/${DEVICE}
echo "delay 0" > /proc/net/pktgen/${DEVICE}
echo "dst_mac ${DST_MAC}" > /proc/net/pktgen/${DEVICE}
echo "dst ${DST}" > /proc/net/pktgen/${DEVICE}
echo "ratep 50000" > /proc/net/pktgen/${DEVICE}
echo "start" > /proc/net/pktgen/pgctrl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment