File tree Expand file tree Collapse file tree 12 files changed +693
-0
lines changed Expand file tree Collapse file tree 12 files changed +693
-0
lines changed Original file line number Diff line number Diff line change
1
+ A collection of small tutorial scripts for pktgen.
2
+ Source:
3
+ ftp://robur.slu.se/pub/Linux/net-development/pktgen-testing/examples/
4
+
5
+
6
+ pktgen.conf-1-1 # 1 CPU 1 dev
7
+ pktgen.conf-1-2 # 1 CPU 2 dev
8
+ pktgen.conf-2-1 # 2 CPU's 1 dev
9
+ pktgen.conf-2-2 # 2 CPU's 2 dev
10
+ pktgen.conf-1-1-rdos # 1 CPU 1 dev w. route DoS
11
+ pktgen.conf-1-1-ip6 # 1 CPU 1 dev ipv6
12
+ pktgen.conf-1-1-ip6-rdos # 1 CPU 1 dev ipv6 w. route DoS
13
+ pktgen.conf-1-1-flows # 1 CPU 1 dev multiple flows.
14
+
15
+
Original file line number Diff line number Diff line change
1
+ A collection of small tutorial scripts for pktgen.
2
+
3
+
4
+ pktgen.conf-1-1 # 1 CPU 1 dev
5
+ pktgen.conf-1-2 # 1 CPU 2 dev
6
+ pktgen.conf-2-1 # 2 CPU's 1 dev
7
+ pktgen.conf-2-2 # 2 CPU's 2 dev
8
+ pktgen.conf-1-1-rdos # 1 CPU 1 dev w. route DoS
9
+ pktgen.conf-1-1-ip6 # 1 CPU 1 dev ipv6
10
+ pktgen.conf-1-1-ip6-rdos # 1 CPU 1 dev ipv6 w. route DoS
11
+ pktgen.conf-1-1-flows # 1 CPU 1 dev multiple flows.
12
+
13
+
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ # modprobe pktgen
4
+
5
+
6
+ function pgset() {
7
+ local result
8
+
9
+ echo $1 > $PGDEV
10
+
11
+ result=` cat $PGDEV | fgrep " Result: OK:" `
12
+ if [ " $result " = " " ]; then
13
+ cat $PGDEV | fgrep Result:
14
+ fi
15
+ }
16
+
17
+ function pg() {
18
+ echo inject > $PGDEV
19
+ cat $PGDEV
20
+ }
21
+
22
+ # Config Start Here -----------------------------------------------------------
23
+
24
+
25
+ # thread config
26
+ # Each CPU has own thread. Two CPU exammple. We add eth1, eth2 respectivly.
27
+
28
+ PGDEV=/proc/net/pktgen/kpktgend_0
29
+ echo " Removing all devices"
30
+ pgset " rem_device_all"
31
+ echo " Adding eth1"
32
+ pgset " add_device eth1"
33
+ echo " Setting max_before_softirq 10000"
34
+ pgset " max_before_softirq 10000"
35
+
36
+
37
+ # device config
38
+ # ipg is inter packet gap. 0 means maximum speed.
39
+
40
+ CLONE_SKB=" clone_skb 1000000"
41
+ # NIC adds 4 bytes CRC
42
+ PKT_SIZE=" pkt_size 60"
43
+
44
+ # COUNT 0 means forever
45
+ # COUNT="count 0"
46
+ COUNT=" count 10000000"
47
+ IPG=" ipg 0"
48
+
49
+ PGDEV=/proc/net/pktgen/eth1
50
+ echo " Configuring $PGDEV "
51
+ pgset " $COUNT "
52
+ pgset " $CLONE_SKB "
53
+ pgset " $PKT_SIZE "
54
+ pgset " $IPG "
55
+ pgset " dst 10.10.11.2"
56
+ pgset " dst_mac 00:04:23:08:91:dc"
57
+
58
+
59
+ # Time to run
60
+ PGDEV=/proc/net/pktgen/pgctrl
61
+
62
+ echo " Running... ctrl^C to stop"
63
+ pgset " start"
64
+ echo " Done"
65
+
66
+ # Result can be vieved in /proc/net/pktgen/eth1
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ # modprobe pktgen
4
+
5
+
6
+ function pgset() {
7
+ local result
8
+
9
+ echo $1 > $PGDEV
10
+
11
+ result=` cat $PGDEV | fgrep " Result: OK:" `
12
+ if [ " $result " = " " ]; then
13
+ cat $PGDEV | fgrep Result:
14
+ fi
15
+ }
16
+
17
+ function pg() {
18
+ echo inject > $PGDEV
19
+ cat $PGDEV
20
+ }
21
+
22
+ # Config Start Here -----------------------------------------------------------
23
+
24
+
25
+ # thread config
26
+ # Each CPU has own thread. Two CPU exammple. We add eth1, eth2 respectivly.
27
+
28
+ PGDEV=/proc/net/pktgen/kpktgend_0
29
+ echo " Removing all devices"
30
+ pgset " rem_device_all"
31
+ echo " Adding eth1"
32
+ pgset " add_device eth1"
33
+ echo " Setting max_before_softirq 10000"
34
+ pgset " max_before_softirq 10000"
35
+
36
+
37
+ # device config
38
+ # ipg is inter packet gap. 0 means maximum speed.
39
+ # We need to do alloc for every skb since we cannot clone here.
40
+
41
+ CLONE_SKB=" clone_skb 0"
42
+ # NIC adds 4 bytes CRC
43
+ PKT_SIZE=" pkt_size 60"
44
+
45
+ # COUNT 0 means forever
46
+ # COUNT="count 0"
47
+ COUNT=" count 10000000"
48
+ IPG=" ipg 0"
49
+
50
+ PGDEV=/proc/net/pktgen/eth1
51
+ echo " Configuring $PGDEV "
52
+ pgset " $COUNT "
53
+ pgset " $CLONE_SKB "
54
+ pgset " $PKT_SIZE "
55
+ pgset " $IPG "
56
+ # Random address with in the min-max range
57
+ pgset " flag IPDST_RND"
58
+ pgset " dst_min 10.0.0.0"
59
+ pgset " dst_max 10.255.255.255"
60
+
61
+ # 8k Concurrent flows at 4 pkts
62
+ pgset " flows 8192"
63
+ pgset " flowlen 4"
64
+
65
+ pgset " dst_mac 00:04:23:08:91:dc"
66
+
67
+ # Time to run
68
+ PGDEV=/proc/net/pktgen/pgctrl
69
+
70
+ echo " Running... ctrl^C to stop"
71
+ pgset " start"
72
+ echo " Done"
73
+
74
+ # Result can be vieved in /proc/net/pktgen/eth1
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ # modprobe pktgen
4
+
5
+
6
+ function pgset() {
7
+ local result
8
+
9
+ echo $1 > $PGDEV
10
+
11
+ result=` cat $PGDEV | fgrep " Result: OK:" `
12
+ if [ " $result " = " " ]; then
13
+ cat $PGDEV | fgrep Result:
14
+ fi
15
+ }
16
+
17
+ function pg() {
18
+ echo inject > $PGDEV
19
+ cat $PGDEV
20
+ }
21
+
22
+ # Config Start Here -----------------------------------------------------------
23
+
24
+
25
+ # thread config
26
+ # Each CPU has own thread. Two CPU exammple. We add eth1, eth2 respectivly.
27
+ # IPv6. Note increase in minimal packet length
28
+
29
+ PGDEV=/proc/net/pktgen/kpktgend_0
30
+ echo " Removing all devices"
31
+ pgset " rem_device_all"
32
+ echo " Adding eth1"
33
+ pgset " add_device eth1"
34
+ echo " Setting max_before_softirq 10000"
35
+ pgset " max_before_softirq 10000"
36
+
37
+
38
+ # device config
39
+ # ipg is inter packet gap. 0 means maximum speed.
40
+
41
+ CLONE_SKB=" clone_skb 1000000"
42
+ # NIC adds 4 bytes CRC
43
+ PKT_SIZE=" pkt_size 66"
44
+
45
+ # COUNT 0 means forever
46
+ # COUNT="count 0"
47
+ COUNT=" count 10000000"
48
+ IPG=" ipg 0"
49
+
50
+ PGDEV=/proc/net/pktgen/eth1
51
+ echo " Configuring $PGDEV "
52
+ pgset " $COUNT "
53
+ pgset " $CLONE_SKB "
54
+ pgset " $PKT_SIZE "
55
+ pgset " $IPG "
56
+ pgset " dst6 fec0::1"
57
+ pgset " src6 fec0::2"
58
+ pgset " dst_mac 00:04:23:08:91:dc"
59
+
60
+ # Time to run
61
+ PGDEV=/proc/net/pktgen/pgctrl
62
+
63
+ echo " Running... ctrl^C to stop"
64
+ pgset " start"
65
+ echo " Done"
66
+
67
+ # Result can be vieved in /proc/net/pktgen/eth1
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ # modprobe pktgen
4
+
5
+
6
+ function pgset() {
7
+ local result
8
+
9
+ echo $1 > $PGDEV
10
+
11
+ result=` cat $PGDEV | fgrep " Result: OK:" `
12
+ if [ " $result " = " " ]; then
13
+ cat $PGDEV | fgrep Result:
14
+ fi
15
+ }
16
+
17
+ function pg() {
18
+ echo inject > $PGDEV
19
+ cat $PGDEV
20
+ }
21
+
22
+ # Config Start Here -----------------------------------------------------------
23
+
24
+
25
+ # thread config
26
+ # Each CPU has own thread. Two CPU exammple. We add eth1, eth2 respectivly.
27
+ # IPv6. Note increase in minimal packet length
28
+
29
+ PGDEV=/proc/net/pktgen/kpktgend_0
30
+ echo " Removing all devices"
31
+ pgset " rem_device_all"
32
+ echo " Adding eth1"
33
+ pgset " add_device eth1"
34
+ echo " Setting max_before_softirq 10000"
35
+ pgset " max_before_softirq 10000"
36
+
37
+
38
+ # device config
39
+ # ipg is inter packet gap. 0 means maximum speed.
40
+
41
+ # We need to do alloc for every skb since we cannot clone here.
42
+ CLONE_SKB=" clone_skb 0"
43
+
44
+ # NIC adds 4 bytes CRC
45
+ PKT_SIZE=" pkt_size 66"
46
+
47
+ # COUNT 0 means forever
48
+ # COUNT="count 0"
49
+ COUNT=" count 10000000"
50
+ IPG=" ipg 0"
51
+
52
+ PGDEV=/proc/net/pktgen/eth1
53
+ echo " Configuring $PGDEV "
54
+ pgset " $COUNT "
55
+ pgset " $CLONE_SKB "
56
+ pgset " $PKT_SIZE "
57
+ pgset " $IPG "
58
+ pgset " dst6_min fec0::1"
59
+ pgset " dst6_max fec0::FFFF:FFFF"
60
+
61
+ pgset " dst_mac 00:04:23:08:91:dc"
62
+
63
+ # Time to run
64
+ PGDEV=/proc/net/pktgen/pgctrl
65
+
66
+ echo " Running... ctrl^C to stop"
67
+ pgset " start"
68
+ echo " Done"
69
+
70
+ # Result can be vieved in /proc/net/pktgen/eth1
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ # modprobe pktgen
4
+
5
+
6
+ function pgset() {
7
+ local result
8
+
9
+ echo $1 > $PGDEV
10
+
11
+ result=` cat $PGDEV | fgrep " Result: OK:" `
12
+ if [ " $result " = " " ]; then
13
+ cat $PGDEV | fgrep Result:
14
+ fi
15
+ }
16
+
17
+ function pg() {
18
+ echo inject > $PGDEV
19
+ cat $PGDEV
20
+ }
21
+
22
+ # Config Start Here -----------------------------------------------------------
23
+
24
+
25
+ # thread config
26
+ # Each CPU has own thread. Two CPU exammple. We add eth1, eth2 respectivly.
27
+
28
+ PGDEV=/proc/net/pktgen/kpktgend_0
29
+ echo " Removing all devices"
30
+ pgset " rem_device_all"
31
+ echo " Adding eth1"
32
+ pgset " add_device eth1"
33
+ echo " Setting max_before_softirq 10000"
34
+ pgset " max_before_softirq 10000"
35
+
36
+
37
+ # device config
38
+ # ipg is inter packet gap. 0 means maximum speed.
39
+
40
+ # We need to do alloc for every skb since we cannot clone here.
41
+
42
+ CLONE_SKB=" clone_skb 0"
43
+ # NIC adds 4 bytes CRC
44
+ PKT_SIZE=" pkt_size 60"
45
+
46
+ # COUNT 0 means forever
47
+ # COUNT="count 0"
48
+ COUNT=" count 10000000"
49
+ IPG=" ipg 0"
50
+
51
+ PGDEV=/proc/net/pktgen/eth1
52
+ echo " Configuring $PGDEV "
53
+ pgset " $COUNT "
54
+ pgset " $CLONE_SKB "
55
+ pgset " $PKT_SIZE "
56
+ pgset " $IPG "
57
+ # Random address with in the min-max range
58
+ pgset " flag IPDST_RND"
59
+ pgset " dst_min 10.0.0.0"
60
+ pgset " dst_max 10.255.255.255"
61
+
62
+ pgset " dst_mac 00:04:23:08:91:dc"
63
+
64
+ # Time to run
65
+ PGDEV=/proc/net/pktgen/pgctrl
66
+
67
+ echo " Running... ctrl^C to stop"
68
+ pgset " start"
69
+ echo " Done"
70
+
71
+ # Result can be vieved in /proc/net/pktgen/eth1
You can’t perform that action at this time.
0 commit comments