Network Packet Generator

37
1 Network Packet Generator Final Presentation Presenting: Igor Brevdo Eugeney Ryzhyk, Supervisor: Mony Orbach

description

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. - PowerPoint PPT Presentation

Transcript of Network Packet Generator

1

Network Packet GeneratorFinal PresentationPresenting:

Igor Brevdo

Eugeney Ryzhyk,

Supervisor: Mony Orbach

2

Agenda

• Introduction

• Packet generator role in networking

• Packet Generator in details

• Usage of Packet Generator

• Results

3

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)

4

Agenda

• Introduction

• Packet generator role in networking

• Packet Generator in details

• Usage of Packet Generator

• Results

5

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 ?

6

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)

7

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

8

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

9

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?

10

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 TCP header Data

11

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

12

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

13

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

14

AgendaAgenda

• Introduction

• Packet generator role in networking

• Packet Generator in details

• Usage of Packet Generator

• Results

15

Implementation: GUI agent on PC

Written in MFC

Provides an easy interface for scenario configuration

Presents the results output

Serial communication with target

16

Implementation: user-mode agent on ML310

17

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

18

Communicating with kernel through /proc file system

in-memory file system used to provide file based communication with the kernel. o 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.

19

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

20

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,

21

Implementation: kernel-mode part of Packet Generator

22

Agenda

• Introduction

• Packet generator role in networking

• Packet Generator in details

• Usage of Packet Generator

• Results

23

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.

24

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.

25

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

26

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)

27

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.

28

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]

29

Inspecting the results

30

Another example (TCP packet)

• Here is another example

• TCP protocol is chosen

• the increment of IP addresses can be seen.

31

Another example (cont)

32

Agenda

• Introduction

• Packet generator role in networking

• Packet Generator in details

• Usage of Packet Generator

• Results

33

Results (1)

• Time unit for sending one packet consists of:SK buffer allocationPopulation 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)

34

Results: Transmitting rate as function of packets number

Sending rate (small packets)

0

2000000

4000000

6000000

8000000

10000000

12000000

10 100 1000 10,000 100,000 1,000,000

number of packets

bits

per

sec

ond

length 70 B

10 Mb per second

35

Results: Controlling the speed by artificial gaps between packets

Accuracy of artificial rate setting

0

10,000,000

20,000,000

30,000,000

40,000,000

50,000,000

60,000,000

10,000 100,000 1,000,000

Gap between packet [nsec]

Bits

per

sec

ond

Measured rate

Ideal rate

36

Improvements and expansions

o Trying the alternative to communication with kernel module through it’s own API and not by /proc files.

o Use of skb clones to utilize the sending speed of the packets

o Rewrite the packet generator for current kernel (2.6.X)

o Usage of packet generator with specially designed devices

o Usage of packet generator in large networks

o Usage of packet generator in high speed networks

37

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