pktgen 运行时选项和命令
运行pktgen后出现
Pktgen:/>
就像shell一样,可以输入命令,设置,显示
Pktgen command line directory format
Pktgen支持的命令以目录的结构进行组织
Pktgen:/> ls
Pktgen:/> cd
都是可以的
这些命令具体怎么用可以先help一下
Pktgen:/>help
跟着help介绍这些命令吧,其实都很简单,那就简单过一下,看看有哪些命令吧
______________________________________________________________________________________________________
The page commands to show different screens:
page
- Show the port pages or configuration or sequence page
[0-7] - Page of different ports
main - Display page zero
range - Display the range packet page
config | cfg - Display the configuration page
pcap - Display the pcap page
cpu - Display some information about the CPU system
next - Display next page of PCAP packets.
sequence | seq - sequence will display a set of packets for a given port
Note: use the 'port ' to display a new port sequence
rnd - Display the random bitfields to packets for a given port
Note: use the 'port ' to display a new port sequence
log - Display the log messages page
latency - Display the latency page
stats - Display physical ports stats for all ports
也就是说page命令,是用来显示端口相关的状态,配置的,具体要看哪个就自己选吧
______________________________________________________________________________________________________
List of the enable/disable commands:
enable|disable
Feature - process - Enable or Disable processing of ARP/ICMP/IPv4/IPv6 packets
mpls - Enable/disable sending MPLS entry in packets
qinq - Enable/disable sending Q-in-Q header in packets
gre - Enable/disable GRE support
gre_eth - Enable/disable GRE with Ethernet frame payload
vlan - Enable/disable VLAN tagging
garp - Enable or Disable GARP packet processing and update MAC address
random - Enable/disable Random packet support
latency - Enable/disable latency testing
pcap - Enable or Disable sending pcap packets on a portlist
blink - Blink LED on port(s)
rx_tap - Enable/Disable RX Tap support
tx_tap - Enable/Disable TX Tap support
icmp - Enable/Disable sending ICMP packets
range - Enable or Disable the given portlist for sending a range of packets
capture - Enable/disable packet capturing on a portlist
enable|disable screen - Enable/disable updating the screen and unlock/lock window
mac_from_arp - Enable/disable MAC address from ARP packet
off - screen off shortcut
on - screen on shortcut
使能命令,打开,关闭某些功能
______________________________________________________________________________________________________
List of the set commands:
set value - Set a few port values
- a list of ports as 2,4,6-9,12 or the word 'all'
count - number of packets to transmit
size - size of the packet to transmit
rate - Packet rate in percentage
burst - number of packets in a burst
sport - Source port number for TCP
dport - Destination port number for TCP
prime - Set the number of packets to send on prime command
seq_cnt - Set the number of packet in the sequence to send
dump - Dump the next received packets to the screen
vlan - Set the VLAN ID value for the portlist
jitter - Set the jitter threshold in micro-seconds
mpls entry - Set the MPLS entry for the portlist (must be specified in hex)
gre_key - Set the GRE key
src|dst mac - Set MAC addresses 00:11:22:33:44:55
You can use 0011:2233:4455 format as well
set jitter - Set the jitter value
set type ipv4|ipv6|vlan|arp - Set the packet type to IPv4 or IPv6 or VLAN
set proto udp|tcp|icmp - Set the packet protocol to UDP or TCP or ICMP per port
set pattern - Set the fill pattern type
type - abc - Default pattern of abc string
none - No fill pattern, maybe random data
zero - Fill of zero bytes
user - User supplied string of max 16 bytes
set user pattern - A 16 byte string, must set 'pattern user' command
set [src|dst] ip ipaddr - Set IP addresses, Source must include network mask e.g. 10.1.2.3/24
set ports_per_page - Set ports per page value 1 - 6
set qinqids - Set the Q-in-Q ID's for the portlist
set rnd - Set random mask for all transmitted packets from portlist
idx: random mask slot
off: offset in packets, where to apply mask
mask: up to 32 bit long mask specification (empty to disable):
0: bit will be 0
1: bit will be 1
.: bit will be ignored (original value is retained)
X: bit will get random value
______________________________________________________________________________________________________
The range commands:
-- Setup the packet range values --
note: SMMI = start|min|max|inc (start, minimum, maximum, increment)
range src|dst mac - Set destination/source MAC address
e.g: range 0 mac start 00:00:00:00:00:00
range 0 mac max 00:12:34:56:78:90
or range 0 mac 00:00:00:00:00:00 00:00:00:00:00:00 00:12:34:56:78:90 00:00:00:01:01:01
range src|dst ip - Set source IP start address
e.g: range 0 dst ip start 0.0.0.0
range 0 dst ip min 0.0.0.0
range 0 dst ip max 1.2.3.4
range 0 dst ip inc 0.0.1.0
or range 0 dst ip 0.0.0.0 0.0.0.0 1.2.3.4 0.0.1.0
range proto tcp|udp - Set the IP protocol type (alias range.proto)
range src|dst port - Set UDP/TCP source/dest port number
or range src|dst port
range vlan - Set vlan id start address
or range vlan
range size - Set pkt size start address
or range size
range teid - Set TEID value
or range teid
range mpls entry - Set MPLS entry value
range qinq index - Set QinQ index values
range gre key - Set GRE key value
______________________________________________________________________________________________________
The sequence commands:
sequence dst src dst src sport dport ipv4|ipv6 udp|tcp|icmp vlan pktsize [teid ]
sequence ipv4|ipv6 udp|tcp|icmp []
- Set the sequence packet information, make sure the src-IP has the netmask value eg 1.2.3.4/24
______________________________________________________________________________________________________
The pcap commands:
pcap show - Show PCAP information
pcap index - Move the PCAP file index to the given packet number, 0 - rewind, -1 - end of file
pcap filter - PCAP filter string to filter packets on receive
______________________________________________________________________________________________________
The start|stop commands:
start - Start transmitting packets
stop - Stop transmitting packets
stp - Stop all ports from transmitting
str - Start all ports transmitting
start prime - Transmit packets on each port listed. See set prime command above
start arp - Send a ARP type packet
type - request | gratuitous | req | grat
______________________________________________________________________________________________________
The debug commands:
debug l2p - Dump out internal lcore to port mapping debug tx_debug - Enable tx debug output debug mempool -
Dump out the mempool info for a given type debug pdump - Hex dump the first packet to be sent,
single packet mode only
______________________________________________________________________________________________________
The odd or special commands:
save - Save a configuration file using the filename
load - Load a command/script file from the given path
script - Execute the Lua script code in file (www.lua.org).
lua 'lua string' - Execute the Lua code in the string needs quotes
geometry - Set the display geometry Columns by Rows (ColxRow)
clear stats - Clear the statistics
clr - Clear all Statistices
reset - Reset the configuration the ports to the default
rst - Reset the configuration for all ports
ports per page [1-6] - Set the number of ports displayed per page
port - Sets the sequence packets to display for a given port
restart - Restart or stop a ethernet port and restart
ping4 - Send a IPv4 ICMP echo request on the given portlist
______________________________________________________________________________________________________
The theme commands::
theme - - Set color for item with fg/bg color and attribute value theme show - List the item strings,
colors and attributes to the items theme save - Save the current color theme to a
theme - - Set color for item with fg/bg color and attribute value
theme show - List the item strings, colors and attributes to the items
theme save - Save the current color theme to a file
______________________________________________________________________________________________________
Flags: P---------------- - Promiscuous mode enabled
E - ICMP Echo enabled
A - Send ARP Request flag
G - Send Gratuitous ARP flag
C - TX Cleanup flag
p - PCAP enabled flag
S - Send Sequence packets enabled
R - Send Range packets enabled
D - DPI Scanning enabled (If Enabled)
I - Process packets on input enabled
* - Using TAP interface for this port can be [-rt*]
L - Send Latency packets V - Send VLAN ID tag
M - Send MPLS header
Q - Send Q-in-Q tags
g - Process GARP packets
g - Perform GRE with IPv4 payload
G - Perform GRE with Ethernet payload
C - Capture received packets
R - Random bitfield(s) are applied
Notes: - Use enable|disable or on|off to set the state.
- a list of ports (no spaces) as 2,4,6-9,12 or 3-5,8 or 5 or the word 'all'
Color best seen on a black background for now
To see a set of example Lua commands see the files in wr-examples/pktgen/test
______________________________________________________________________________________________________
慢慢看吧。使用工具,主要还是得会用这些命令。fucked a dog!