Packet Classification George Varghese. Original Motivation: Firewalls Firewalls use packet filtering...

24
Packet Classification George Varghese
  • date post

    21-Dec-2015
  • Category

    Documents

  • view

    217
  • download

    0

Transcript of Packet Classification George Varghese. Original Motivation: Firewalls Firewalls use packet filtering...

Page 1: Packet Classification George Varghese. Original Motivation: Firewalls Firewalls use packet filtering to block say ssh and force access to web and mail.

Packet Classification

George Varghese

Page 2: Packet Classification George Varghese. Original Motivation: Firewalls Firewalls use packet filtering to block say ssh and force access to web and mail.

Original Motivation: Firewalls

• Firewalls use packet filtering to block say ssh and force access to web and mail via proxies.

• Still part of “defense in depth” today. Need fast wire speed packet filtering

Page 3: Packet Classification George Varghese. Original Motivation: Firewalls Firewalls use packet filtering to block say ssh and force access to web and mail.

Simplified Internet Message Format

• Dest and Src IP address (telephone numbers).• Dst and Src Ports (extensions): indicate protocol• For instance, Port 80 = Web, Mail = 25

Page 4: Packet Classification George Varghese. Original Motivation: Firewalls Firewalls use packet filtering to block say ssh and force access to web and mail.

Sample Firewall Database

Page 5: Packet Classification George Varghese. Original Motivation: Firewalls Firewalls use packet filtering to block say ssh and force access to web and mail.

Beyond firewalls today

Page 6: Packet Classification George Varghese. Original Motivation: Firewalls Firewalls use packet filtering to block say ssh and force access to web and mail.

Service differentiation via classification

• Every router in world: if packet addressed to router, do packet classification before LPM.

• Extract 5 (or more fields). If there is a match, treat packet as specified by highest match rule.

• Can use to drop packets, give some applications more QoS, different routes for some apps etc.

• Standard solution: CAMs. But lets look at some algorithmic solutions some of which are used.

• Routers often support 1000s of rules so linear search (despite parallel logic) is too slow.

Page 7: Packet Classification George Varghese. Original Motivation: Firewalls Firewalls use packet filtering to block say ssh and force access to web and mail.

Plan of Attack

• First, 2-field (2D) packet classification. Useful for measurement and multicast.

• Then we introduce a nice geometric model and move on to general K-field classification.

Page 8: Packet Classification George Varghese. Original Motivation: Firewalls Firewalls use packet filtering to block say ssh and force access to web and mail.

2D (two field) example

Page 9: Packet Classification George Varghese. Original Motivation: Firewalls Firewalls use packet filtering to block say ssh and force access to web and mail.

First attempt: Set Pruning Tries

• Each destination prefix D points to a trie containing all source prefixes in rules whose destination field is a prefix of D. O(N^2) memory!

Page 10: Packet Classification George Varghese. Original Motivation: Firewalls Firewalls use packet filtering to block say ssh and force access to web and mail.

Worst-case example for storage

Page 11: Packet Classification George Varghese. Original Motivation: Firewalls Firewalls use packet filtering to block say ssh and force access to web and mail.

Less memory via backtracking

• Source tries now only contain sources in rules whose destination is equal to D. O(W^2) time.

Page 12: Packet Classification George Varghese. Original Motivation: Firewalls Firewalls use packet filtering to block say ssh and force access to web and mail.

Grid of Tries (Srinvasan-Varghese)

• Use pre-computed switch pointers (dashed line). No backtracking and linear space.

Page 13: Packet Classification George Varghese. Original Motivation: Firewalls Firewalls use packet filtering to block say ssh and force access to web and mail.

Geometric Model (Lakshman-Staliadis)

• Example: F1 = (0*, 10*). Each field is a dimension in geometric space

Page 14: Packet Classification George Varghese. Original Motivation: Firewalls Firewalls use packet filtering to block say ssh and force access to web and mail.

Beyond 2D

• Bad News: Lower bound (computational geometry): O((W^k)/k!) time for linear storage.

• Good news: (Gupta-Mckeown): # of Disjoint classification regions in real databases is small.

• For example: theoretically in 2D we can have N^2 disjoint regions but practically we have O(N)

• Can we exploit this observation for speed with small storage. Yes, but not provably. Heuristics.

Page 15: Packet Classification George Varghese. Original Motivation: Firewalls Firewalls use packet filtering to block say ssh and force access to web and mail.

Divide and Conquer?

• Natural to try LPM in each field separately and combine. Concatenation does not work!

Page 16: Packet Classification George Varghese. Original Motivation: Firewalls Firewalls use packet filtering to block say ssh and force access to web and mail.

Aside: Range to Prefix Matches

• Real classifiers use ranges (e.g., < 1024 for well known ports).

• Theorem: Can write any range as the union of a logaritmic number of prefix ranges.

• Example: [8,12] in 5 bits. 01* does not work but 0100* and 0101* and 011000 does!

• Useful theorem for CAM vendors as well as they only support prefix ranges. Recall hardware!

Page 17: Packet Classification George Varghese. Original Motivation: Firewalls Firewalls use packet filtering to block say ssh and force access to web and mail.

Bit Vector (Lakshman-Staliadis)

• Store an N-bit vector with each field value M with bit J set in Field I if M matches Rule I in field J.

• AND and find first bit set. Priority Encoder.

Page 18: Packet Classification George Varghese. Original Motivation: Firewalls Firewalls use packet filtering to block say ssh and force access to web and mail.

Why is Lucent Fast?

• Since the bit vectors are O(N), from a CS perspective it is O(N), as bad as linear search.

• Really reduces constants uses wide memories.• Nk/W memory accesses where W is width.• Recall W = 1000 is feasible 1000 rule tables in

a few accesses, many of which are parallel.• Moral: Know hardware complexity measures!

Page 19: Packet Classification George Varghese. Original Motivation: Firewalls Firewalls use packet filtering to block say ssh and force access to web and mail.

Cross-Products (Srinivasan-Varghese)

• Theorem: Best matching rule for crossproduct is best matcing rule for packet.

Page 20: Packet Classification George Varghese. Original Motivation: Firewalls Firewalls use packet filtering to block say ssh and force access to web and mail.

Equivalenced Crossproducts (Gupta-Mckeown): aka RFC

• Idea: Instead of “multiplying” in 1 fell swoop, do 2 at a time and equivalence at each step. GSR

16 crossproducts

but only 8 classes!

Page 21: Packet Classification George Varghese. Original Motivation: Firewalls Firewalls use packet filtering to block say ssh and force access to web and mail.

Hi Cuts (Gupta-Mckeown)

• Different idea: Decision tree in geemetric space to “zero in” on narrowest matching region.

Page 22: Packet Classification George Varghese. Original Motivation: Firewalls Firewalls use packet filtering to block say ssh and force access to web and mail.

State of Art

• Woo algorithm: Like HiCuts but uses bit testing and not range testing.

• Hypercuts (Singh): beyond Woo to test multiple bits at a time using arrays. Cisco CRS

• Space usage of Hypercuts/HiCuts can be employed using 2 parallel trees (Brian Alleyne)

• Efficuts (Purdue, SIGCOMM 2010) is a publicly available implementation of best ideas so far.

• CAMs still easier though need algorithmic tricks to reduce power.

Page 23: Packet Classification George Varghese. Original Motivation: Firewalls Firewalls use packet filtering to block say ssh and force access to web and mail.

Principles Used

• P1: Relax Specification (heuristics beyond 2D)• P2: Degrees of freedom (HiCuts Hypercuts)• P3: Shift Computation in Time (grid-of-tries)• P4: Avoid Waste seen (Crossproducts RFC)• P5: Add State for efficiency (switch pointers)• P6: Hardware parallelism (Bit vector)• P8: Finite universe methods (Bit vector)• P9: Use algorithmic thinking (decision trees)

Page 24: Packet Classification George Varghese. Original Motivation: Firewalls Firewalls use packet filtering to block say ssh and force access to web and mail.

Students like you . . .

• PANKAJ CHEENU SUMEET

Stanford Sahasra Netlogic Twitter

UCSD Sahasra Netlogic Google

UCSD NetSift Cisco

SO DO A GREAT PROJECT! SOME MORE PAPERS UP