• 沒有找到結果。

Network Simulation and Testing-Testing on Real Systems-dummynet

N/A
N/A
Protected

Academic year: 2021

Share "Network Simulation and Testing-Testing on Real Systems-dummynet"

Copied!
56
0
0

加載中.... (立即查看全文)

全文

(1)

Network Simulation and Testing

Polly Huang EE NTU

http://cc.ee.ntu.edu.tw/~phuang [email protected]

(2)

2

Testing on Real Systems

(3)

Let’s Take a Good Look Back

• For the Internet

– Monitor the usage

• Passive and active measurement

– Characterize the workload

• Traffic, topology, routing errors, access pattern modeling

– Predict for the future

• Scalable simulation & testing tools

– Revise original design

• Protocol and Infrastructure

– Instrument the changes

Scalable Packet-level Simulation Internet Instrumentation (IETF) Reliable Measurement Internet Characterization Structure & Design Decision

The

Internet

(4)

4

Predict for the Future

• Nature

– Find out whether a system is going to work!

• A.k.a

(5)

The Three Methods

• Analytical

• Simulation

• Life system

• Can be good or bad

• Depending on

– The problem in hand – The resource in hand

(6)

6

Analytical

• The level of detail

– Low

– Go for the average behavior

– Make assumptions to simplify for the derivation – Might not be generally applicable

• The cost

– Low

– Pen and paper

• The skill required

(7)

Simulation

• The level of detail

– Medium but flexible

– Can go with various levels of details – Can go large scale

• The cost

– Medium

– Usually 1 computer

• The required Skill

– Need solid programming skill – Vivid imagination

(8)

8

Live Testing

• The level of detail

– High

– Go with full detail

– Difficult to go large scale

• The cost

– High

– Multiple computers

• The required skill

– Need solid system skill – Vivid imagination

(9)

For Example

Obtaining TCP Throughput

(10)

10

Analytical

• J. Padhye, V. Firoiu, D. Towsley, and J. Kurose. • Modeling TCP throughput: A simple model and its

empirical validation.

• In Proceedings of the ACM SIGCOMM Conference, pages 303-314, Vancouver, Canada, September 1998. ACM

(11)

BW with Limited Window

[Padhye98a, eqn 32]

B( Wmax, RTT, p, b, To)

(12)

12

Simulation

• Lee Breslau, Deborah Estrin, Kevin Fall, Sally Floyd, John Heidemann, Ahmed Helmy, Polly Huang, Steven McCanne, Kannan Varadhan, Ya Xu, and Haobo Yu. • Advances in Network Simulation

• IEEE Computer, 33 (5 ), pp. 59-67, May, 2000. • Expanded version available as USC TR 99-702b

(13)

ns-2 Setup

set ns [new Simulator] set n0 [$ns node]

set n1 [$ns node]

set ftp [new Application/FTP] $ftp attach-agent $tcp $ns at 0.2 "$ftp start" $ns at 1.2 ”exit" $ns run $ns duplex-link $n0 $n1 1.5Mb 10ms DropTail set tcp [$ns create-connection TCP $n0 TCPSink $n1 0]

(14)

14

BW with ns-2

• Run the script

• Obtain the output file

• Process the output file

– Add the number of data bytes

– Divide by the time duration

(15)

Live Testing

• Luigi Rizzo

• Dummynet: a simple approach to the evaluation of network protocols

(16)

16

BW with dummynet

• We will figure this out during the coming 4

weeks

(17)

4 Weeks

• Week 1

– Introduction, basic features

• Week 2

– Setup and bandwidth management

• Week 3

– Advanced features

• Week 4

(18)

18

Today

• Introduction

• Basic features

(19)

Introduction

• dummynet as a software

– Part of FreeBSD kernel

• dummynet as an emulation tool

– Can do various bandwidth, delay, loss

• dummynet as a traffic filter

– Real-time on live traffic

– Filter on local and transit traffic – Filter at levels as fine as flows

• dummynet works also as a traffic shaper

(20)

20

Motivation

• To do repeatable live code experiments

– ns-2 simulations might ignore certain details

• For example, the processing time

– Live experiments not in controlled environment

• Hard to track and re-produce • Expensive to build

– Certain network components or protocols

cannot be modeled

(21)

Research Applications

• Small-scale performance testing

– Behavior in the presence of loss, delay,

bandwidth limitation

– Live user access, client-server interaction

– Evaluation of metrics subject to user perception

• Audio/video quality

(22)

22

Production Applications

• Bandwidth limitation

– Restricting services – Protecting networks

– Probably the most widely used application of dummynet

• Product/Protocol testing

– Slightly different goal from research applications

– Checking whether the implementation complies with the specification

– Checking whether the product will work in the field of heterogeneous network conditions

(23)

Design Goals

• Simplicity and ease of use

– Will see in usage

• Be realistic

– To see the network behavior as the results of how it is implemented, structured, and driven in the real world

• Flexibility and extendibility

– Orthogonal features can be added over time – Will see in basic vs. advanced features

(24)

24

Basic Features

• Two major components

– The pipe

– The packet filter

• Simple examples

• Configuration

– The pipe

– The packet filter

(25)

The Pipe

• Emulates a communication link

• Configurable with the usual pipe link

parameters

(26)

26

Optional Queue

• Input queue

– Essentially a leaky bucket

– Why it’s used frequently as a traffic shaper

pipe 10 config bw 500 Kbits/s queue 30KB delay 12ms plr 0.02 queue size

(27)

The Packet Filter

• Use the FreeBSD firewall – ipfw

• Set ipfw rules to select packets that will go

through the pipe

pipe 10 tcp from any to any 80 in

(28)

28

A Simple Example

ipfw add pipe 10 tcp from any to any 80 in

(29)

Emulating a Multi-Access Link

• One pipe

• Data going both direction content for

10Mbps bandwidth

ipfw add pipe 1 ip from any to any ipfw pipe 1 config bw 10 Mbits/s

(30)

30

Emulating a Point-to-Point Link

• Two pipes

• One for each direction

ipfw add pipe 1 ip from any to any in ipfw add pipe 2 ip from any to any out ipfw pipe 1 config bw 640 Kbits/s

ipfw pipe 2 config bw 128 Kbits/s

Modem downlink

(31)

Configuring Pipes

(32)

32

1. Bandwidth

• The rate the packets are extracted from the

queue

– Unit: bit/s, Kbit/s, Mbit/s, Bytes/s, KBytes/s,

MBytes/s

– Packet size: up to IP

• Note

(33)

2. Delay

• Propagation delay

– Unit: millisecond

• Note

(34)

34

3. Loss

• Random packet loss

– Range: 0 to 1

– Granularity: 0.01

• Note

– Used mainly for performance evaluation

– No significant drops unless the traffic rate is extremely high

(35)

4. Queue

• Input Queue

– Size unit: packets or Bytes, KBytes

• Note

– Extra queuing add up to the delay

– Typical Ethernet queues: 50 packets

(36)

36

Configuring Packet Filters

ipfw basic

(37)

ipfw

• A simple firewall utility function in

FreeBSD

(38)

38

ipfw: Adding Filters

ipfw add

[N] [prob X] [action] [PROTO]

from

[SRC] to [DST] [OPTIONS]

[N]: rule number (indexing) [prob X]: 0 to 1, default = 1 [action]: allow, deny, pipe N

N: pipe ID, 1 to 65534

[PROTO]: ip, tcp, udp, icmp etc

[SRC] [DST]: address with netmask, port, range of ports [OPTIONS]: various protocol option

(39)

Rule Examples

ipfw add 01012 allow tcp from 10.0.1.0/8 to 10.0.1.1 139

ipfw add 01012 allow udp from 10.0.1.0/8 to 10.0.1.1 137,138

ipfw add 02000 allow udp from any to any 4000-65535,domain,ntalk,ntp

ipfw add 02500 allow udp from any to any frag

ipfw add 03000 allow tcp from any to any http,https ipfw add 03000 allow tcp from any to any

4000-65535,ssh,smtp,domain,ntalk

ipfw add 03000 allow tcp from any to any auth,pop3,ftp,ftp-data

(40)

40

ipfw: Manipulating Filters

• ipfw pipe 1 show

– Show parameters of pipe 1

• ipfw pipe 1 delete

– Delete pipe 1

• ipfw pipe flush

(41)

Setting for Types of Machines

Hosts

Routers

Bridges

(42)

42

Be Aware of the Data Flow

Device Driver Upper Layer in out Through Traffic In a Bridge Through Traffic In a Router IP layer Link layer

(43)

1. Easy for the Hosts

in

out IP layer

Link layer

(44)

44

In Case of Routers:

in out Through Traffic In a Router IP layer Link layer 1 2

ipfw add pipe 1 ip from any to any in ipfw add pipe 2 ip from any to any out

(45)

Yes, Problem

• The problem

– Through traffic get filtered twice

• The solution

– Deal with through traffic separately

ipfw add pipe 1 ip from any to “my IP” in ipfw add pipe 2 ip from “my IP” to any out

(46)

46

2. Careful for the Routers

in out

Through Traffic

In a Router IP layer

Link layer

1 2

ipfw add pipe 1 ip from any to “my IP” in ipfw add pipe 2 ip from “my IP” to any out Ipfw add pipe 3 ip from any to not “my IP” in

(47)

3. Similarly, for the Bridges

in

out IP layer

Link layer

1 2

ipfw add pipe 1 ip from any to “my IP” in

Through Traffic In a Bridge

(48)

48

System Setting

Kernel Options

sysctl Variables

(49)

Kernel Options

• IPFIREWALL - enable ipfirewall

• DUMMYNET - enable dummynet

operation

(50)

50

Required Kernel Option

• options IPFIREWALL

• options DUMMYNET

• Must have the above 2 options in the kernel

configuration file

(51)

Related Kernel Option

• options HZ

– Sets the timer granularity – Default 100, meaning 10ms

– Options HZ=1000, system tick reduced to 1ms

• options NMBCLUSTERS

– Set the buffer size to store network packets – Product of bandwidth * delay

(52)

52

Minor Kernel Options

• options IPFIREWALL_VERBOSE

– Enable firewall output

• options

IPFIREWALL_VERBOSE_LIMIT

(53)

ipfw Related sysctl Variables

• net.inet.ip.fw.enable: 1

– Enable firewall in the IP stack

• net.inet.ip.fw.one_pass: 1

– Force a single pass through the firewall.

– If set to 0, packets coming out of a pipe will be re-injected into the firewall starting with the rule after the matching one.

– One could create multi-hop paths with a bit of imagination

– NOTE: there is always one pass for bridged packet

(54)

54

Bridge Related sysctl Variables

• net.link.ether.bridge_cfg: ed2:1,rl0:1

– Set of interfaces for which bridging is

enabled, and cluster they belong to

• net.link.ether.bridge: 0

– Enable bridging

• net.link.ether.bridge_ipfw: 0

(55)

dummynet Related sysctl Variables

• net.inet.ip.dummynet.hash_size: 64

– Size of hash table for dynamic pipes.

• net.inet.ip.dummynet.expire: 1

– Delete dynamic pipes when they become

empty.

• Dynamic pipes will be covered in week

3

(56)

56

Next Week

• Laptops

– Running FreeBSD

– With access to FreeBSD

• FreeBSD

參考文獻

相關文件

Binding Warning message Binding Update message AAAO: the AAA server of the old foreign network to which the OFA belongs. AAAF: the AAA server of the new foreign network to which the

„ An adaptation layer is used to support specific primitives as required by a particular signaling application. „ The standard SS7 applications (e.g., ISUP) do not realize that

¾ PCS systems can connected to Public Switched Telephone Network (PSTN)6. ¾ Goal of PCS:enabling communications with a person at anytime, at any place and in any

The roles of school management and technical support staff on implementing information and network security measures... Security

5/4 System configuration and log systems 5/11 Network Address Translation (NAT)
. and Virtual Private

The main hypothesis that we are most interested in is the research hypothesis, denoted H 1 , that the mean birth weight of Australian babies is greater than 3000g.. The other

SDP and ESDP are stronger relaxations, but inherit the soln instability relative to measurement noise. Lack soln

• Compare ρESDP as solved by LPCGD method with ESDP as solved by Sedumi 1.05 Sturm (with the interface to Sedumi coded by Wang et al )... Left: Soln of ρESDP found by