pktgen.conf-1-1-rdos 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #!/bin/bash
  2. #modprobe pktgen
  3. function pgset() {
  4. local result
  5. echo $1 > $PGDEV
  6. result=`cat $PGDEV | fgrep "Result: OK:"`
  7. if [ "$result" = "" ]; then
  8. cat $PGDEV | fgrep Result:
  9. fi
  10. }
  11. # Config Start Here -----------------------------------------------------------
  12. # thread config
  13. # Each CPU has its own thread. One CPU example. We add eth1.
  14. PGDEV=/proc/net/pktgen/kpktgend_0
  15. echo "Removing all devices"
  16. pgset "rem_device_all"
  17. echo "Adding eth1"
  18. pgset "add_device eth1"
  19. # device config
  20. # delay 0
  21. # We need to do alloc for every skb since we cannot clone here.
  22. CLONE_SKB="clone_skb 0"
  23. # NIC adds 4 bytes CRC
  24. PKT_SIZE="pkt_size 60"
  25. # COUNT 0 means forever
  26. #COUNT="count 0"
  27. COUNT="count 10000000"
  28. DELAY="delay 0"
  29. PGDEV=/proc/net/pktgen/eth1
  30. echo "Configuring $PGDEV"
  31. pgset "$COUNT"
  32. pgset "$CLONE_SKB"
  33. pgset "$PKT_SIZE"
  34. pgset "$DELAY"
  35. # Random address with in the min-max range
  36. pgset "flag IPDST_RND"
  37. pgset "dst_min 10.0.0.0"
  38. pgset "dst_max 10.255.255.255"
  39. pgset "dst_mac 00:04:23:08:91:dc"
  40. # Time to run
  41. PGDEV=/proc/net/pktgen/pgctrl
  42. echo "Running... ctrl^C to stop"
  43. trap true INT
  44. pgset "start"
  45. echo "Done"
  46. cat /proc/net/pktgen/eth1