Mini-HOWTO for the Linux packet generator module.
1. Enable CONFIG_NET_PKTGEN to compile and build pktgen.o either in kernel
or as module. Module is preferred. insmod pktgen if needed.
2. For montoring and control pktgen creates. Inspect them!
/proc/net/pktgen/pgctrl
/proc/net/pktgen/kpktgend_X
/proc/net/pktgen/ethX
3. Extract the example script «pktgen.sh» (see below).
4. Edit script to set preferred device and destination MAC, and IP address.
5. Run in shell: «./pktgen.sh»
It does all the setup including sending. Also
«echo «start» > /proc/net/pktgen/pgctrl» Starts sends on all threads and devs
Use
«cat /proc/pktgen/eth[X]» X={1,n} to inspect an interfacee.
7. Use «pgset» change pktgen settings. See examples.
«pgset» to change generator parameters. F.e.
pgset «clone_skb 1″ sets the number of copies of the same packet
pgset «clone_skb 0″ use single SKB for all transmits
pgset «pkt_size 9014″ sets packet size to 9014
pgset «frags 5″ packet will consist of 5 fragments
pgset «count 200000″ sets number of packets to send, set to zero
for continious sends untill explicitly
stopped.
pgset «ipg 5000″ sets artificial gap inserted between packets
to 5000 nanoseconds
pgset «dst 10.0.0.1″ sets IP destination address
(BEWARE! This generator is very aggressive!)
pgset «dst_min 10.0.0.1″ Same as dst
pgset «dst_max 10.0.0.254″ Set the maximum destination IP.
pgset «src_min 10.0.0.1″ Set the minimum (or only) source IP.
pgset «src_max 10.0.0.254″ Set the maximum source IP.
pgset «dstmac 00:00:00:00:00:00″ sets MAC destination address
pgset «srcmac 00:00:00:00:00:00″ sets MAC source address
pgset «src_mac_count 1″ Sets the number of MACs we’ll range through. The
‘minimum’ MAC is what you set with srcmac.
pgset «dst_mac_count 1″ Sets the number of MACs we’ll range through. The
‘minimum’ MAC is what you set with dstmac.
pgset «flag [name]» Set a flag to determine behaviour. Current flags
are: IPSRC_RND #IP Source is random (between min/max),
IPDST_RND, UDPSRC_RND,
UDPDST_RND, MACSRC_RND, MACDST_RND
pgset «udp_src_min 9″ set UDP source port min, If < udp_src_max, then
cycle through the port range.
pgset «udp_src_max 9″ set UDP source port max.
pgset «udp_dst_min 9″ set UDP destination port min, If < udp_dst_max, then
cycle through the port range.
pgset «udp_dst_max 9″ set UDP destination port max.
pgset stop aborts injection
Also, ^C aborts generator.

This book benefited from the efforts of all Cisco engineers who share our dedication and passion for
Второе издание популярного справочника полностью переработано и расширено с целью предоставить читателю наиболее полное описание
Эта книга поможет вам изучить принципы и методики конфигурирования «с нуля» маршрутизаторов Cisco для большинства сетевых ситуаций, а затем применить полученные знания на практике.
Книга представляет собой обширный справочник, содержащий описание практически всех используемых в настоящее время сетевых протоколов и технологий. В книге рассмотрен широкий спектр вопросов межсетевого взаимодействия, включая протоколы локальных сетей, технологии распределенных сетей, мостовые и коммутируемые соединения, а также управление сетями. В ней также описаны разрабатываемые в настоящее время протоколы и сетевые технологии. Приведена информация о последних разработках корпорации Cisco в сфере обеспечения безопасности сетей, их масштабируемости и повышения скорости передачи, а также о сетях хранения данных и об оптических сетях. Книга предназначена для специалистов по сетевым технологиям.