pktgen 运行时选项和命令

来源:互联网 发布:linux epoll wait 编辑:程序博客网 时间:2024/06/05 14:06
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 <pages>                       - 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 <number>' to display a new port sequence
     rnd                           - Display the random bitfields to packets for a given port
                                     Note: use the 'port <number>' 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 <portlist> <features>
    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 <portlist> <type> value        - Set a few port values
  <portlist>                       - a list of ports as 2,4,6-9,12 or the word 'all'
  <type>         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 <value> 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 <etheraddr> - Set MAC addresses 00:11:22:33:44:55
                                     You can use 0011:2233:4455 format as well
set <portlist> jitter <value>      - Set the jitter value
set <portlist> type ipv4|ipv6|vlan|arp - Set the packet type to IPv4 or IPv6 or VLAN
set <portlist> proto udp|tcp|icmp  - Set the packet protocol to UDP or TCP or ICMP per port
set <portlist> pattern <type>      - 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 <portlist> user pattern <string> - A 16 byte string, must set 'pattern user' command
set <portlist> [src|dst] ip ipaddr - Set IP addresses, Source must include network mask e.g. 10.1.2.3/24
set ports_per_page <value>         - Set ports per page value 1 - 6
set <portlist> qinqids <id1> <id2> - Set the Q-in-Q ID's for the portlist
set <portlist> rnd <idx> <off> <mask> - 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 <portlist> src|dst mac <SMMI> <etheraddr> - 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 <portlist> src|dst ip <SMMI> <ipaddr>   - 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 <portlist> proto tcp|udp                - Set the IP protocol type (alias range.proto)
range <portlist> src|dst port <SMMI> <value>  - Set UDP/TCP source/dest port number
   or  range <portlist> src|dst port <start> <min> <max> <inc>
range <portlist> vlan <SMMI> <value>          - Set vlan id start address
   or  range <portlist> vlan <start> <min> <max> <inc>
range <portlist> size <SMMI> <value>          - Set pkt size start address
   or  range <portlist> size <start> <min> <max> <inc>
range <portlist> teid <SMMI> <value>          - Set TEID value
   or  range <portlist> teid <start> <min> <max> <inc>
range <portlist> mpls entry <hex-value>       - Set MPLS entry value
range <portlist> qinq index <val1> <val2>     - Set QinQ index values
range <portlist> gre key <value>              - Set GRE key value
______________________________________________________________________________________________________
The sequence commands:
sequence <seq#> <portlist> dst <Mac> src <Mac> dst <IP> src <IP> sport <val> dport <val> ipv4|ipv6 udp|tcp|icmp vlan <val> pktsize <val> [teid <val>]
sequence <seq#> <portlist> <dst-Mac> <src-Mac> <dst-IP> <src-IP> <sport> <dport> ipv4|ipv6 udp|tcp|icmp <vlanid> <pktsize> [<teid>]
- 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 <portlist> <string>    - PCAP filter string to filter packets on receive
______________________________________________________________________________________________________
The start|stop commands:
start <portlist>                   - Start transmitting packets
stop <portlist>                    - Stop transmitting packets
stp                                - Stop all ports from transmitting
str                                - Start all ports transmitting
start <portlist> prime             - Transmit packets on each port listed. See set prime command above
start <portlist> arp <type>        - 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 <portlist> <type> -
Dump out the mempool info for a given type debug pdump <portlist> - Hex dump the first packet to be sent,
single packet mode only

______________________________________________________________________________________________________
The odd or special commands:
save <path-to-file>                - Save a configuration file using the filename
load <path-to-file>                - Load a command/script file from the given path
script <filename>                  - Execute the Lua script code in file (www.lua.org).
lua 'lua string'                   - Execute the Lua code in the string needs quotes
geometry <geom>                    - Set the display geometry Columns by Rows (ColxRow)
clear <portlist> stats             - Clear the statistics
clr                                - Clear all Statistices
reset <portlist>                   - 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 <number>                      - Sets the sequence packets to display for a given port
restart <portlist>                 - Restart or stop a ethernet port and restart
ping4 <portlist>                   - Send a IPv4 ICMP echo request on the given portlist
______________________________________________________________________________________________________
The theme commands::
theme <item> <fg> <bg> <attr> - 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 <filename> - Save the current color theme to a

theme <item> <fg> <bg> <attr>      - 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 <filename>              - 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: <state>       - Use enable|disable or on|off to set the state.
       <portlist>    - 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!