Packet Generator User Guide V0.1 Based on DeanSys Pktgen-0.0.4 dean@deansys.com www.deansys.com, Oct.20,2006 Contents Contents. 2 Chapter 1. Abstract 4 Chapter 2. How to install it?. 5 2.1 Get the Latest Release. 5 2.2 System Requirement 5 2.3 The way to build a packet 5 Chapter 3. Command description. 6 Chapter 4. Global Mode Commands. 7 4.1 Build Command: 9 4.2 Clear Command: 9 4.3 Config Command: 9 4.4 Edit Command: 9 4.5 Send Command: 10 4.6 Show Command: 10 4.6.1 Show Buffer Command: 10 4.6.2 Show Interface Command. 10 4.6.3 Show Netstat Command. 11 4.6.4 Show Packet Counter Command. 12 4.6.5 Show Router Command. 12 4.6.6 Show System Command. 13 4.6.7 Show Version Command: 13 Chapter 5. Build Mode Commands. 14 5.1 OSPF Commands: 17 5.1.1 OSPF DBD command. 17 5.1.2 OSPF HELLO command. 17 5.1.3 OSPF LAS Command. 17 5.2 RIP Commands: 18 5.3 PIM Commands: 18 5.4 RAW Commands: 18 5.5 IGMP Command: 19 Chapter 6. Configuration Mode Commands. 20 6.1 Interface Command: 21 6.2 Number Command: 21 6.3 Length Command: 21 6.4 Time Command: 21 Chapter 7. Notes. 23 8. THANKS. 24 Chapter 1. Abstract User Interface (UI) of this packet generator is designed following the format of switch. User can type in commands in the same way what they are doing on the switch. They can type ¡®?¡¯ anywhere to get help messages about the commands, can type ¡®tab¡¯ to complete the rest command automatically. And it offers auto-building functions that they can build well known protocol packets with some parameters automatically. User also can set the raw packets with different configuration file with a simple command. It can only work under UNIX/Linux system. Redhat Linux 9.0 is the best choice. And Redhat Linux ES/AS version is also acceptable. Make sure that you have got one Ethernet interface card at least. Multi users can use this packets generator at the same time. And the multi processed function is not supported in this version right now. More function will be available in the next version. The current version of DeanSys packet generator and analysis is v0.0.4. This is a temporary version of CLI Specification. More details will be available in the next version. Please send mail to me if you have found some bugs or have some suggestion. My mail box is dean@deansys.com . Copyright is an old topic. Everyone is permitted to copy and distribute verbatim copies of this document, but changing it is not allowed. Design different system solutions for different usages. Chapter 2. How to install it? 2.1 Get the Latest Release Go to our website www.deansys.com and download the tar ball from our website and type the following command on your linux system to install it: [root@DeanOS main]#tar ¨Cxzvf pktgen-X.X.X.tar.gz Then it is available for you. 2.2 System Requirement We recommend the system as following description: Item Requirement Best Choice CPU 1GHz >2.0G Memory 256M >512M Disk 20M >50M NIC 10M/100M 10M/100M/1000M OS Unix/Linux Linux-2.4.31 2.3 The way to build a packet (1). Select the packet type you want. A. Raw packet from configuration file. B. Well-known protocols with the packet building function. (2). Set the interface name, number of packet and pause time between packets. Or just skip them to keep the default. (3). Send the packets. (4). Check the result. The first and second steps can be exchanged with each other. You decide the order. Note: You must be able to access the interface! ¡®root¡¯ is the recommend user group. Chapter 3. Command description There are three modes in the packet generator at now. They are 1. global mode 2. configuration mode 3. build mode. Global mode contains the basic commands for packet generator, such like ¡®show¡¯ to show current system status, ¡®send¡¯ to send packet out and other commands to change modes such as ¡®configure¡¯. Configuration mode contains all the commands to make system settings. You can set the packets number, length and pause time between packets. You also can select which network interface card you want to use. Build mode contains all the function to build a well-known protocol packet such as ¡®OSPF HELLO¡¯. Packet also can be built up with a defined configuration file. What you need to do is to make your choice and type the right commands into system. All the commands can be listed by typing ¡®?¡¯ or ¡®help¡¯. And all the commands can be completed automatically by type ¡®tab¡¯. Short and uncompleted commands are also available. Colors will be used to make the messages more easy-reading. Error and warning messages will be printed with red color. Status and help messages will use green or yellow. Chapter 4. Global Mode Commands Run the program and you will enter into the global mode: [root@DeanOS main]# ./pktgen pktgen# Global mode contains the basic commands of this packet generator. Type ¡®?¡¯ to get the command list as : pktgen#? build Change to build mode to build packet automatically. clear Clear the data value in buffer. configure Change to configure mode to modify the settings. edit Edit the data value in buffer. end Back to global mode automatically. exit Exit current mode and down to previous mode help Print command help messages. list Print command list send Send the packet in buffer. show Show information. pktgen# Type ¡®list¡¯ to get command list: pktgen#list build clear configure edit [0-1517] [0-0xff] end exit help list send show buffer show interface [IFNAME] show netstat show packet counter [IFNAME] show router show system show version pktgen# Following is the table of commands description. Table 1 Command Description Build Change into build mode to build the well-known type of packets with the help of this packet generator. clear Clear the data value in buffer. Set the buffer to zero. configure Change into the configuration mode to configure the parameters of this packet generator. The parameters will contains: 1. Number of packet 2. Length of packet 3. Pause time between packets 4. Interface name edit Edit the data of the packet in buffer. end Back to global mode. exit Logoff from packet generator. help Get help message about commands list Print command list. send Send the packet in buffer with assured interface, number, length and data. show Show packet generator status information. ? Same with help. Get help message about commands ¡®\t¡¯ Complete the command. 4.1 Build Command: Type ¡®build¡¯ to enable build mode. Then you will get the commands to build a well-known protocol packet. pktgen#build Enter to build mode! pktgen(build)# 4.2 Clear Command: This command is used to reset the value in buffer. The default value is zero. pktgen#clear Clear the data in buffer. pktgen# 4.3 Config Command: Type config to enable configuration mode. pktgen#configure Enter to config mode! pktgen(config)# 4.4 Edit Command: Type ¡®edit [0-1517] [0-0xff]¡¯ to modify the value in buffer. You can use ¡®show¡¯ first to verify the value in buffer. The packet units is from 0 to 1517 pktgen#edit ? [0-1517] Position in buffer. pktgen#edit 0 ? [0-0xff] The value you want to set. pktgen#edit 0 aa ? pktgen#edit 0 aa pktgen# 4.5 Send Command: Type ¡®send¡¯ command to send the packet in buffer with the configuration value. pktgen#send Packet Number :1 Length :60 Device :eth0 Wrote 60 bytes packet; check the wire. 4.6 Show Command: ¡®show ¡¯ command is used to show the packet generator status. It contains data in buffer, configuration values and system status. pktgen#show ? buffer Show buffer information. interface Interface status and configuration netstat Network status and configuration packet Packet status and configuration router Local router status and configuration system Displays system status version Displays pktgen version pktgen# 4.6.1 Show Buffer Command: This command is used to check the data in buffer. The size of content depends on the length of packet. pktgen#show buffer Packet Generator Status: Device: eth0, Length: 60 byte, Number: 1, Pause: 0 s Data from Configuration file. aa 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 pktgen# 4.6.2 Show Interface Command This command is used to show network interface cards status on this system. pktgen#show interface ? [IFNAME] Inteface name pktgen#show interface eth0 Link encap:Ethernet HWaddr 00:0C:29:43:5F:A0 inet addr:192.168.110.98 Bcast:192.168.110.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:59754 errors:0 dropped:0 overruns:0 frame:0 TX packets:5927 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:100 RX bytes:6085464 (5.8 Mb) TX bytes:2995771 (2.8 Mb) Interrupt:10 Base address:0x1080 eth1 Link encap:Ethernet HWaddr 00:0C:29:43:5F:AA BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:5 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:100 RX bytes:728 (728.0 b) TX bytes:0 (0.0 b) Interrupt:9 Base address:0x1400 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:34 errors:0 dropped:0 overruns:0 frame:0 TX packets:34 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:4196 (4.0 Kb) TX bytes:4196 (4.0 Kb) pktgen# 4.6.3 Show Netstat Command This command is used to show network status on this system. pktgen#show netstat Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 *:32768 *:* LISTEN tcp 0 0 DeanOS:32769 *:* LISTEN tcp 0 0 *:cvspserver *:* LISTEN tcp 0 0 *:sunrpc *:* LISTEN tcp 0 0 *:ftp *:* LISTEN tcp 0 0 *:ssh *:* LISTEN tcp 0 0 DeanOS:ipp *:* LISTEN tcp 0 0 DeanOS:smtp *:* LISTEN tcp 0 0 192.168.110.98:ssh dean:3949 ESTABLISHED tcp 0 0 192.168.110.98:ssh dean:3950 ESTABLISHED udp 0 0 *:32768 *:* udp 0 0 *:906 *:* udp 0 0 *:sunrpc *:* udp 0 0 *:631 *:* Active UNIX domain sockets (servers and established) Proto RefCnt Flags Type State I-Node Path unix 10 [ ] DGRAM 1297 /dev/log unix 2 [ ACC ] STREAM LISTENING 1827 /dev/gpmctl unix 2 [ ACC ] STREAM LISTENING 1957 /tmp/.font-unix/fs7100 unix 2 [ ] DGRAM 2007 unix 2 [ ] DGRAM 1838 unix 2 [ ] DGRAM 1803 unix 2 [ ] DGRAM 1789 unix 2 [ ] DGRAM 1731 unix 2 [ ] DGRAM 1495 unix 2 [ ] DGRAM 1347 unix 2 [ ] DGRAM 1312 pktgen# 4.6.4 Show Packet Counter Command This command is used to check the packet counters on specified interface. pktgen#show packet ? counter Packet counter pktgen#show packet counter ? [IFNAME] Interface name pktgen#show packet counter Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR eth0 1500 0 60073 0 0 0 5962 0 0 0 BMRU eth1 1500 0 5 0 0 0 0 0 0 0 BM lo 16436 0 34 0 0 0 34 0 0 0 LRU pktgen#show packet counter [IFNAME] Interface name pktgen# 4.6.5 Show Router Command This command is used to show router information on system. pktgen#show router Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.110.0 * 255.255.255.0 U 0 0 0 eth0 169.254.0.0 * 255.255.0.0 U 0 0 0 eth0 127.0.0.0 * 255.0.0.0 U 0 0 0 lo default gateway 0.0.0.0 UG 0 0 0 eth0 pktgen# 4.6.6 Show System Command This command is used to check the system status. pktgen#show system System status: Interface: eth0 MAC address: 00:0c:29:43:5f:a0 IP address: 192.168.110.98 pktgen# 4.6.7 Show Version Command: This command is used to get version information. pktgen#show version ----------------------------------------------- Packet Generator Version Information Name : Packet Generator 0.0.4 Author: Dean Ding Date : July.25,2006 Note : Based on GNU Linux System : www.DeanSys.com ----------------------------------------------- pktgen# Chapter 5. Build Mode Commands Type ¡®build¡¯ to change to build mode. Then you will get the commands to build well-known protocol packets. pktgen#build pktgen(build)# Type ¡®?¡¯ to get commands help message: pktgen(build)# arp Build ARP packet automatically. bgp Build BGP4 packet automatically. cdp Build CDP packet automatically. dhcp Build DHCP packet automatically. dns Build DNS packet automatically. dot1x Build Dot1x packet automatically. end Back to global mode automatically. exit Exit current mode and down to previous mode gre Build GRE packet automatically. help Print command help messages. icmp Build ICMP PING OF DEATH packet automatically. ieee Build IEEE802.2 packet automatically. igmp Build IGMP_MEMBERSHIP_QUERY packet automatically. isl Build ISL packet automatically. list Print command list mpls Build MPLS packet automatically. ospf Build OSPF packet automatically.Type: IBI/MBIT/MSBIT. pim Build PIM packet automatically. raw Build packet from configuration file automatically. rip Build RIP packet automatically. stp Build STP packet automatically. tcp Build TCP packet automatically. udp Build UDP packet automatically. pktgen(build)# Type ¡®list¡¯ to get command list: pktgen(build)#list arp bgp hdr [A.B.C.D] [A.B.C.D] [type] bgp notification [dest_ip] [src_ip] [errcode] [subcode] bgp open bgp update [dest_ip] [src_ip] [withdraw_rt] [update_attr] [update_info] cdp [switchname] dhcp dns [dest_ip] [src_ip] [query] [type] dot1x end exit gre [dest_ip] [src_ip] [gre_dest_ip] [gre_src_ip] [route_info] help icmp [dest] ieee [dest_ip] [src_ip] igmp [group_ip] [source_ip] isl [dest_ip] list mpls [dest_ip] [dest_port] [src_ip] [src_port] ospf dbd [dest_ip] [src_ip] [type] ospf hello [dest_ip] [src_ip] [neighbor_ip] ospf lsa [dest_ip] [src_ip] pim hello [dest_ip] [src_ip] raw raw [filename] rip [rip_add] [rip_netmask] [next_hop] [dest_ip] stp [dest_ip] [src_ip] tcp [dest_ip] [dest_port] [src_ip] [src_port] udp [dest_ip] [dest_port] [src_ip] [src_port] pktgen(build)# Table 2 Command Description arp Build ARP packet. bgp Build BGPv4 packet. (OPEN, UPDATE, NOTIFICATION, KEEPALIVE) cdp Build CDP packet. dhcp Build DHCP packet. (REQUEST, REPLY) dns Build DNS packet. dot1x Build 802.1x EAP packet. (START, LOGOFF, EAP PACKET) end Back to global mode. exit Exit to global mode. gre Build GRE packet. help Print command help message. icmp Build ICMP packet. ieee Build IEEE 802.2/802.3 packet isl Build ISL packet. igmp Build IGMP packet. (MEMBERSHIP_QUERY, MEMBERSHIP_REPORT, LEAVE_GROUP) list Print commands list. mpls Build MPLS packet. ospf Build OSPF packet. (HELLO, UMD, LSA, DBD, LSR, LSU) pim Build PIM packet raw Build raw packets with configuration file. rip Build RIP packet. (REQUEST, RESPONSE, TRACEON, TRACEOFF, POLL, POLLENTRY, MAX) stp Build STP packet. tcp Build TCP packet. udp Build UDP packet. ? Get help message At right now ¡®auto-building¡¯ only supports few type packets comparing with all of the Ethernet packets. More support will be available in the future. Please send mail to dean@deansys.com when you find any bugs and want to share your ideas with us. 5.1 OSPF Commands: Type in ¡®ospf ?¡® in build mode, then you will find the types of OSPF. pktgen(build)#ospf ? dbd OSPF DBD packet. hello OSPF Hello packet. lsa OSPF LSA packet. pktgen(build)# The OSPF command list is : ospf dbd [dest_ip] [src_ip] [type] ospf hello [dest_ip] [src_ip] [neighbor_ip] ospf lsa [dest_ip] [src_ip] 5.1.1 OSPF DBD command The DBD type is : IBI/MBIT/MSBIT pktgen(build)#ospf dbd ? A.B.C.D Destination IP address. pktgen(build)#ospf dbd 192.168.110.1 ? A.B.C.D Source IP address. pktgen(build)#ospf dbd 192.168.110.1 192.168.110.99 ? [type] OSPF DBD type : IBI/MBIT/MSBIT. pktgen(build)#ospf dbd 192.168.110.1 192.168.110.99 ibi ? pktgen(build)#ospf dbd 192.168.110.1 192.168.110.99 ibi Src:192.168.110.99, Dst:192.168.110.1, pktgen(build)# 5.1.2 OSPF HELLO command An expmale is: pktgen(build)#ospf hello 192.168.110.254 192.168.110.2 192.168.110.23 5.1.3 OSPF LAS Command pktgen(build)#ospf lsa ? A.B.C.D Deastination IP address. pktgen(build)#ospf lsa 192.168.110.110 ? A.B.C.D Source IP address. pktgen(build)#ospf lsa 192.168.110.110 192.168.110.99 ? pktgen(build)#ospf lsa 192.168.110.110 192.168.110.99 pktgen(build)# 5.2 RIP Commands: RIP command format is : rip [rip_add] [rip_netmask] [next_hop] [dest_ip] pktgen(build)#rip 192.168.110.98 255.255.255.0 192.168.110.9 192.168.110.254 5.3 PIM Commands: Type pim in build mode, then you will be asked for source and destination IP address. It just support PIMv2 HELLO packet right now. pktgen(build)# pim hello 192.167.110.1 19.168.11.1 5.4 RAW Commands: Type in raw command in build mode to select an existed configuration file to load the packet data from. The default configuration file is ¡®packet.conf¡¯. Default will be selected if you just type raw without any parameter. For example, if you want to use the default configuration file, then just type ¡®raw¡¯: pktgen(build)#raw Select packet.conf as the default config file. If you want to use another file, just type ¡®raw filename¡¯ pktgen(build)#raw test.conf Select test.conf as the default config file. Make sure the file you have selected is in the same fold and it should be filled with correct format. An example file will look like: loada:ffffffffffff0001 02030405888e0101 loadb:0000000000000000 0000000000000000 loadc:0000000000000000 0000000000000000 loadd:0000000000000000 0000000000000000 loade:0000000000000000 0000000000000000 loadf:0000000000000000 0000000000000000 loadg:0000000000000000 0000000000000000 At present, the max length is 112 bytes. You can use ¡®length¡¯ command in configuration mode to modify the length. The default length is 60 bytes. If you want to use lager packet, please tell me that. And I will make it lager. 5.5 IGMP Command: An example is: pktgen(build)#igmp 224.0.0.1 192.168.110.1 Chapter 6. Configuration Mode Commands Type in ¡®config¡¯ to change to configuration mode to modify the configuration values. The configuration options will be: number, length, interface and pause time. You can just skip this step to keep the default value. The default value will be: Interface eth0 Length 60bytes Number 1 Pause time 0 second Commands look like: pktgen#config Enter to config mode! pktgen(config)#? pktgen(config)# end Back to global mode automatically. exit Exit current mode and down to previous mode help Print command help messages. interface Select interface to send packets. length Set packet length. list Print command list number Set packets number. time Set pause time between packets. pktgen(config)# Command list is : pktgen(config)#list end exit help interface [eth0] length [14-1518] list number [1-65535] time [0-3600] pktgen(config)# Table 3 Command Description end Back to global mode exit Back to global mode help Get help message about commands interface Select the interface you want to use. number <1-65535> Set the number of packets length <16-1518> Set the length of packet. list Get command list message. Time <0-3600> Value of seconds between packets. ¡®0¡¯ means there is no pause. ? Get help message. 6.1 Interface Command: Type in interface command to select a Network Interface Card (NIC) to send your packet. Default value is eth0. pktgen(config)#interface eth0 Device is eth0 pktgen(config)# Make sure that the name of the card is correct. Otherwise you will get error messages. 6.2 Number Command: Type number command to set the number of packets you want to build and send out. The range is 1 - 65535. Default value is 1. pktgen(config)#number 10 Packet number is 10 pktgen(config)# 6.3 Length Command: Type length command to set the value of packet length. The range is 16-1518. Default value is 60. pktgen(config)#length 64 Length is 64bytes pktgen(config)# 6.4 Time Command: Type time command to set the pause seconds between every two packets. The range is 0-3600. Default value is 0 (no pause). pktgen(config)#time 1 Pause time is 1 second. pktgen(config)# Chapter 7. Notes This is an unfinished version. Extra details will be added in the future. And if you have any suggestions or ideas, please share them with me. My mail-box is dean@deansys.com . This version specification is based on packet generator v0.0.4. 8. THANKS Thank for all the guys who share me with their ideas and suggestions. Design different system solutions for different usages.