Created
January 14, 2016 16:36
-
-
Save mdpuma/5ec328e9ee6ecd8b272e to your computer and use it in GitHub Desktop.
pktgen
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Send 60-byte packets at maximum rate through eth1 to 10.0.0.2. | |
# Additional arguments are passed on to configure the device under pktgen; | |
# try "pkt_size BYTES" or "rate US" or "ratep PPS". | |
# | |
thread=$1 | |
modprobe pktgen | |
pgset () { | |
echo "$*" | |
echo "$*" > $PGDEV | |
cat $PGDEV | fgrep Result: | |
} | |
PGDEV=/proc/net/pktgen/kpktgend_$thread | |
pgset rem_device_all | |
pgset add_device eth0 | |
pgset max_before_softirq 10000 | |
PGDEV=/proc/net/pktgen/eth0 | |
pgset clone_skb 100000 | |
pgset pkt_size 60 | |
pgset burst 100 | |
pgset src_min | |
pgset src_max | |
pgset dst | |
pgset dst_mac b8:ac:6f:7e:c1:ee | |
pgset count 0 | |
pgset queue_map_min 1 | |
pgset queue_map_max 4 | |
pgset rate 10000M | |
for param; do | |
pgset $param | |
done | |
PGDEV=/proc/net/pktgen/pgctrl | |
read | |
pgset start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment