Term Project Detail Design 2 Traffic Generator 2003-12-1 So Jung LEE Dpnm Lab. CSE POSTECH...

25
Term Project Detail Design 2 Traffic Generator 2003-12-1 So Jung LEE Dpnm Lab. CSE POSTECH [email protected]

Transcript of Term Project Detail Design 2 Traffic Generator 2003-12-1 So Jung LEE Dpnm Lab. CSE POSTECH...

Term Project Detail Design 2

Traffic Generator

2003-12-1

So Jung LEEDpnm Lab. CSE POSTECH

[email protected]

2

Contents Introduction System Requirement Traffic Generator System Overall Architecture XML schema definition for Configuration File Module Design Detail Q & A

3

Introduction Motivation

현재 dpnm lab. 에서 개발 중인 NG-MON 과 NSAA 에 대한 performance test.

Goal 원하는 Application traffic 에 대하여 type 과 bandwidt

h 를 정하여 packet 들을 보냄으로써 network 상에 traffic 을 generate 하는 것 .

4

System Requirement (1/2)

Functional Requirements

구현할 Protocol 은 IP, TCP, UDP, ICMP 의 네 가지이다 . 사용자는 원하는 protocol 내에 있는 header field 값을 직접 정할 수 있어야 한다 . 사용자는 bandwidth 는 직접 정할 수 있어야 한다 . header field 값과 bandwidth 에 대해 set/increment / random option 을

설정할 수 있다 . 사용자는 보내고자 하는 총 packet 의 갯수를 조절할 수 있어야 한다 . 사용자는 traffic 을 generate 하여 보내는 시간 (period) 을 조 절 할 수 있어야 한다 .

5

System Requirement (2/2) Non-Functional Requirements

Consistency Extensibility user-friendly 한 User Interface

6

Traffic Generator SystemOverall Architecture

CLI (Command Line Interface)

Configuration File

Flow specification

Configuration file

Flooder

Xml File ParserTraffic Generator

7

각각의 Module 설명 Configuration file

사용자는 CLI 를 통해 정의된 XML schema 에 따라 직접 generate하고자 하는 flow 에 대한 구성 정보들을 저장 .

Configuration file 을 xml schema 로 정의하는 이유 - 사용자가 한눈에 알아볼 수 있음 . - xml tag 의 내용만 숙지하면 쉽게 사용할 수 있음 .

Traffic generator Xml file parser - xml file 을 parsing 하여 원하는 값들을 가져와 flow 구성을 정의함 . Flooder - 정의된 flow 구성에 따라 flow 들을 생성하여 소켓을 통해 보냄 .

8

XML schema definitionfor configuration file (1/2)

Sample configuration file <flows>

<srcIP> <type> set | inc | random </type> <startIP> 141.223.82.152 </startIP> <endIP> 141.223.82.255 </endIP> </srcIP> <dstIP> <type> set | inc | random </type> <startIP> 141.223.82.152 </startIP> <endIP> 141.223.82.255 </endIP> </dstIP> <Protocol> tcp | udp | icmp </Protocol>

<srcPort> <type> set | inc | random </type> <startIP> 141.223.82.152 </startIP> <endIP> 141.223.82.255 </endIP> </srcPort> <dstPort> <type> set | inc | random </type> <startIP> 141.223.82.152 </startIP> <endIP> 141.223.82.255 </endIP> </dstPort>

9

XML schema definitionfor configuration file (2/2)

<Options> <icmptype> 3 </icmptype> <icmptcode> 3 </tcmpcode> </Options>

<pktLength> <type> set | inc | random </type> <startLength> 60 </startLength> <endLength> 80 </endLength> </pktLength>

<pps> 1000 </pps>

<period> <type> second | minute | hour | continue| count </type> <second> 5 </second> <minute> 3 </minute> <hour> 4 </hour> <count> 10000 </count></period>

</flows>

10

Flooder Module Design

Client

Sockaddr_in 구성

Flow 구조체 선언

Packet count module

PPS module

Send module

Sock 개설

close

서버의 IP 주소와 Port 번호

Packet 을 보냄

Timer module

Packet 구조체 선언

Header module

Packet Length module

period

SecondMinute,Hour,continue

count

11

Flooder Module Design

1. Flow 구조체 (1/2)Xml File Parser module

Flow 구조체

Flow specification

TCP Packet 구조체

Protocol

UDP Packet 구조체 ICMP Packet 구조체

TCP UDP ICMP

12

Flooder Module Design

1. Flow 구조체 (2/2)

Flow 구조체 생성 Protocol Source IP ( type, start IP, end IP ) Destination IP ( type, start IP, end IP ) Source Port ( type , start Port, end Port ) Destination Port ( type , start Port, end Port ) Packet Length ( type, start Length, end Length) PPS Options ( icmp type, icmp code, ttl, tcp flag ) Period ( second, minute, hour, packet count )

13

Flooder Module Design

2. Packet 구조체 Packet 구조체 생성

TCP Packet - IP header (source IP, destination IP) - TCP header (source Port, destination Port) - payload UDP Packet - IP header (source IP, destination IP) - UDP header (source Port, destination Port) - payload ICMP Packet - IP header (source IP, destination IP) - ICMP message (type , code)

14

Flooder Module Design

3. Timer module

Timer 구조체 구성

Signal(SIGALRM, end)

setitimer()

Flow 구조체

PPS module

Send module

Header module

Packet Length module

End()

Timer 가 종료되어 alarm 발생

Exit(1) 함수 호출

Signal (SIGINT, end)

second, minute, hour Continue

PPS module

Send module

Header module

Packet Length module

사용자가 Ctral+C 누름

종료

종료

15

Flooder Module Design

4. Packet count modulepacket count=0

PPS module

Send module

Header module

Packet Length module

Packet count++

Packet Count= count

End()

Exit(1) 로 프로그램을 종료시킴

yes

no

Flow 구조체

count

16

Flooder Module Design

5. Header Module (1/4) 각 Header field 에 3 option 을 적용하는 rule

Set Source IP, Destination IP, Source Port, Destination Port , Pro

tocol, Packet Size, pps, timer, packet count, options 에 모두 적용 Increment Source IP, Destination IP, Source Port, Destination Port, Packet Length

들에만 적용 Random Source IP, Destination IP, Source Port, Destination Port, Packet Length

들에만 적용

17

Flooder Module Design

5. Header Module (2/4)

TCP

Header module

TCP Header module

srcIP module

dstIP Module

protocol

UDP Header module ICMP Header module

type module

code Module

TCP UDP ICMP

srcPort module

dstPort module

srcIP module

dstIP Module

srcPort module

dstPort module

18

Flooder Module Design

5. Header Module (3/4)

Flow 구조체

TCP / UDP srcIP module

Set module Increment Module Random Module

TCP / UDP srcPort module

Set module

Increment Module

Random Module

TCP / UDP dstIP module

Set module Increment Module Random Module

Set module

Increment Module

Random Module

TCP/UDP dstPort module

startIP startIP,endIP

startIP,endIP

startPort,endPort

startPort,endPort

startPort,endPort

startPort,endPort

startIP,endIP

startIP,endIP

startPortstartPort

startIP

19

Flooder Module Design

5. Header Module (4/4)

Flow 구조체

Set module Set module

ICMP type module ICMP code module

Icmp type Icmp code

20

Flooder Module Design

6. Packet Length module (1/3)

TCP

Packet Length module

TCP pkt_len module

Set module

Increment Module

Random Module

protocol

UDP pkt_len module

Set module

Increment Module

Random Module

ICMP pkt_len module

Set module

TCP UDP ICMP

21

Flooder Module Design

6. Packet Length module (2/3)

TCP / UDP pkt_len module

Set module Increment Module Random Module

Flow 구조체

Packet Length (start Length)

Packet Length (start Length, end Length)

Packet Length (start Length, end Length)

TCP 와 UDP 는 packet 구조체에서 payload 값을 변화시킴 . TCP packet Length = IP header(20)+ TCP header(20) + payload UDP packet Length = IP header(20)+ UDP header(8) + payload

ICMP 의 경우 type 과 code 에 따른 format 이 정해져 있음 . ICMP packet Length = IP header(20)+ ICMP message ICMP message 종류에 따라 packet Length 가 달라짐 .

Set module

ICMP pkt_len module

type,code

22

Flooder Module Design

6. Packet Length module (3/3)

type code description byte

0 0 Echo reply (ping) 64

3 0-15 Destination unreachable 36

4 0 Source quench 36

5 0-3 Redirect 36

8 0 Echo request (ping) 64

11 0 Time exceeded 36

13-14 0 Timestamp request/ reply 20

17-18 0 Address mask request/ response 12

30 0-1 Traceroute 20

37 0 Domain Name request 8

각 ICMP message 별 bytes 수

23

Flooder Module Design

7. PPS module (1/2)

Flow 구조체

PPS (packet per second) 값

Set module

PPS module

24

Flooder Module Design

7. PPS module (2 /2)

ti: 처음 packet 을 보낸 시간 tc: 현재 시간 PA: (tc-ti) 의 시간 동안 받아야 하는 이상적인 packet 의 개수 . (packet 들이 대체적으로 1ms 안에 보내졌다고 가정한 경우 ) PC: (tc-ti) 의 시간 동안 보낸 실질적인 packet 의 개수 . 한 packet 을 보낼 때마다 PA 와 PC 값을 비교하여 nanosleep time 을 다르게 적용 . (case 1) PC = PA 일 경우 : 1ms 만큼 sleep 한다 . (case 2) PC > PA 일 경우 : PC 의 packet 을 보내기 위해 이상적으로 도착할 시 까지 sleep 하고 1ms 만큼 더 sleep. (case 3) PC < PA 일 경우 : sleep 하지 않는다 .

ti tc

PA, PC

pps = 1000 이라고 가정 (1 초에 1000 개의 packet 을 보내야 함 .) 1 packet 이 1ms 안에 보내져야 함 .

time

25

Q & A