380 likes | 662 Views
Network Packet Generator. Final Presentation Presenting: Igor Brevdo Eugeney Ryzhyk, Supervisor: Mony Orbach. Agenda. Introduction Packet generator role in networking Packet Generator in details Usage of Packet Generator Results. Project goals.
E N D
Network Packet Generator Final Presentation Presenting: Igor Brevdo Eugeney Ryzhyk, Supervisor: Mony Orbach
Agenda • Introduction • Packet generator role in networking • Packet Generator in details • Usage of Packet Generator • Results
Project goals • Building network packet generator (using ML310 board and Linux OS as a platform). • Allow customization and fine-tuning of the various packet generation parameters at different network stack layers (Ethernet frame, IP packet, TCP/UDP packet)
Agenda • Introduction • Packet generator role in networking • Packet Generator in details • Usage of Packet Generator • Results
The use of packet generator in networking (1) • Test resistance and durability of networks connecting/serving devices as routers, servers or switches • Are some sort of packets get lost in particular device ? • What is the maximum rate of packets per second that a specific router can route ? • What is maximum open connections a target server can handle ?
The use of packet generator in networking (2) • Physical device transmitting capability • Test the maximum speed of physical networking card attached to system • Creation of artificial packet saturation in particular network • Test firewall for penetrability (port scan)
General approach to solution (1) • On one hand, freedom of OS constraints such as • Will not use OS TCP/IP stack • Eliminate context switches • Complete freedom in packet crafting • Talking to network device directly • On other hand, exploit the full advantages of running within OS • Use running environment • Use networking services and data structures
General approach to solution (2) • As in our case the OS is Linux, the self evident solution is use a kernel loadable modules mechanism • That way the kernel networking stack is not forced but offered to our use (skb buffers, netdevice structure) • Running in kernel mode – no context switches and system calls overpays • Direct access to network card • Accurate timing measurement • On fly inserting to running kernel
General approach to solution (3) • Disadvantages to this approach • Various libraries are not provided when running kernel code – not even C standard library. Only kernel API can be used • The debugging is tricky: no debugger for kernel, only special printk() function • How to tell kernel module what we want?
Project requirements (1) • A Packet Generator should be able to craft standard networking packets of type UDP, TCP, IP, Ethernet • Full control over UDP and TCP ports should be provided to user of Packet Generator • Full control over IP addresses should be provided to user of Packet Generator • UDP and TCP and IP checksums must be calculated and set in packets headers • A user should be able to insert a data in packets which can allow faster packet recognition Ethernet header IP header Data TCP header
Project requirements (2) • Provide a way to configure a stream of packets of particular protocol type when both IP addresses and UDP/TCP addresses limits are set by user. • Packet Generator will provide for user configuration • number of packets in stream, • the desired rate (speed) of packets • network device to use for transmitting. • Easy to use and detailed user interface which runs on PC will be provided to configure Packet Generator tasks
Development Environment (1) • Xilinx ML310 • Two PowerPC 405 cores • 256 MB DDR • Onboard 10/100 Ethernet NIC • Standard output through COM serial connection (on RS-232 cable) • Sansa Flash as storage device • Cross LAN network cable • Linux with kernel 2.4.20 • Bash shell
Development Environment (2) • Monta Vista development environment • Cross compilation for PPC 405 • Linux tools on Windows like bash, make and gcc • Linux kernel sources – must be used to compile the kernel module • Microsoft Visual studio – developing Packet Generator GUI and COM serial communicator • Ethereal Network sniffer – great (and free) tool for receiving and checking the packet streams • Putty – free program for serial communication with the target while debugging
Agenda Agenda • Introduction • Packet generator role in networking • Packet Generator in details • Usage of Packet Generator • Results
Implementation: GUI agent on PC • Written in MFC • Provides an easy interface for scenario configuration • Presents the results output • Serial communication with target
Implementation: kernel-mode part of Packet Generator • Implemented as kernel loadable module • Communicates with user mode through /proc file system • Uses SK buffers to build networks packets • Activates NIC directly through net device interface
Communicating with kernel through /proc file system • in-memory file system used to provide file based communication with the kernel. • Any kernel component that wants to communicate with the user can create a file under the proc and that can be used to exchange data • Common operations like reading from or writing to file are accessible to all user processes. • All the files under the proc file system reside in memory.
Building the packets with help of SK buffers (1) • "SKB" is the most fundamental data structure in the Linux networking code. • Every packet sent or received is handled using this data structure. • Skbuffers are held within list data structure
Building the packets with help of SK buffers (2) • Four pointers that responsible for data handling inside sk buffer • Functions that manipulate these pointers are in heavy use by packet engine and are participate in building of every packet,
Agenda • Introduction • Packet generator role in networking • Packet Generator in details • Usage of Packet Generator • Results
Usage of Packet Generator (1) • Step 0: Set up ml310 board(power, memory, network connection, serial COM connection) • Step 1: Run Packet Generator GUI from the pc and turn on board’s power supply.
Usage of Packet Generator: starting serial connection • Step 2: Invoke serial connection • Connect/Disconnect will establish serial connection to board and also will start kernel booting and Linux OS will load.
Usage of Packet Generator: Module initialization • Step 3: Inserting module and initialization • Pressing Init Generator button will insert Packet Generator module into running kernel and bring up the network card
Scenario configuration • Step 4: Configure the scenario • choose transport layer protocol type TCP or UDP • Choose minimum and maximum ports numbers (destination and source) • Choose minimum and maximum IP addresses (destination and source)
Scenario configuration • Step 4(continued): Scenario configuration • Choose MAC layer addresses, destination and source • Insert the data of the generated packets • General configurations. • network device to use • number of packets to generate • a time gap between every two packets • Randomization flags: random transportation ports, random IP addresses.
Running the scenario • Step 5: Run the scenario • Start ethereal sniffer on destination machine and press start to begin the generation and sending process. • When the scenario will stop running the packet generator will print it’s performance results: • Time to do the job consisting of idle and working time • Packets length in [Bytes] • Sending rate in [packets/second] • Speed of sending in [bytes/second]
Another example (TCP packet) • Here is another example • TCP protocol is chosen • the increment of IP addresses can be seen.
Agenda • Introduction • Packet generator role in networking • Packet Generator in details • Usage of Packet Generator • Results
Results (1) • Time unit for sending one packet consists of: • SK buffer allocation • Population of buffer by packet’s data, including adjustment of header fields. (work time) • Waiting for device and sending it through device or if device is busy going to next iteration (work time) • Checking whether process rescheduling is needed (goes to idle time) • Waiting inter packet gap time it done by user (goes to idle time)
Results: Controlling the speed by artificial gaps between packets
Improvements and expansions • Trying the alternative to communication with kernel module through it’s own API and not by /proc files. • Use of skb clones to utilize the sending speed of the packets • Rewrite the packet generator for current kernel (2.6.X) • Usage of packet generator with specially designed devices • Usage of packet generator in large networks • Usage of packet generator in high speed networks
Bibliography • TCP/IP Illustrated Volume 1 – The Protocols, Richard Stevens • Linux Device Drivers, 2nd edition – Alessandro Rubini, Jonathan Corbet • Linux Kernel Sources (version 2.4) • Linux Kernel Modules Programming Guide • Transmission Control Protocol, RFC 793 • http://tools.ietf.org/html/rfc793 • Proc file system guide • http://www.geocities.com/ravikiran_uvs/articles/proc.html • How SKB work • http://vger.kernel.org/~davem/skb_data.html