# 1 IP-Lookup and Packet Classification Advanced Algorithms & Data Structures Lecture Theme 08 – Part I Prof. Dr. Th. Ottmann Summer Semester 2006.

## Presentation on theme: "1 IP-Lookup and Packet Classification Advanced Algorithms & Data Structures Lecture Theme 08 – Part I Prof. Dr. Th. Ottmann Summer Semester 2006."— Presentation transcript:

1 IP-Lookup and Packet Classification Advanced Algorithms & Data Structures Lecture Theme 08 – Part I Prof. Dr. Th. Ottmann Summer Semester 2006

2 Overview The IP-Lookup problem Generalisations of IP-Lookup: Dynamisation, conflict-free ranges Packet classification Category 1 solutions: Structure the universe Category 2 solutions: Structure the prefix set Inverted Next Lists Priority Search Trees

3 Dstn Addr ---- Dstn-prefixNext Hop Forwarding Table Forwarding Engine HEADERHEADER Lookup in an IP Router Next-Hop-Computation

4 0 2 24 2 32 -1 128.9.0.0/16 65.0.0.0 142.12.0.0/19 65.0.0.0/8 65.255.255.255 Destination IP Prefix Outgoing Port (Next-Hop) 65.0.0.0/ 83 128.9.0.0/161 142.12.0.0/197 IP prefix: 0-32 bits 128.9.16.14 Example Forwarding Table

5 128.9.16.0/21 128.9.172.0/21 128.9.176.0/24 0 2 32 -1 128.9.0.0/16 142.12.0.0/19 65.0.0.0/8 Nested intervalls Sets of intervalls corresponding to sets of prefixes of IP-addresses are nested: Any two intervalls are either disjoint or one is contained in the other! Overlaps are impossible!

6 128.9.16.0/21 128.9.172.0/21 128.9.176.0/24 Routing lookup: Find the longest matching prefix (the most specific route) among all prefixes that match the destination address. 0 2 32 -1 128.9.0.0/16 142.12.0.0/19 65.0.0.0/8 128.9.16.14 LMP-Matching

7 Example of an IP-Lookup Table PrefixNext-hop P1111*H1 P210*H2 P3101*H3 P410101H4 P5*H5 Prefixes may be considered as bitstrings of a maximal length W. Example: W = 5, p = 10111

8 Generalisations of the IP-Lookup Problem Dynamisation: Insertion, deletion of prefixes (intervalls) Conflict free sets of intervalls (not nested) Priority matching instead of LMP lookup: PrefixNext-hop R110*H3 R21001*H2 R301100H5 R40*H4 R5010*H1 R6*H6 Determine the prefix with highest priority matching a given bitstring 10011

9 Extension to higher dimensions: Classification Classify incoming packages into different flows according to different services. ServiceExample Traffic Shaping Ensure that ISP3 does not inject more than 50Mbps of total traffic on interface X, of which no more than 10Mbps is email traffic Packet Filtering Deny all traffic from ISP2 (on interface X) destined to E2 Policy Routing Send all voice-over-IP traffic arriving from E1 (on interface Y) and destined to E2 via a separate ATM network PAYLOAD L4-SP 16b L4-DP 16b PROTO 8b L3-SA 32b L3-DA 32b L3-Proto 8b L2-SA 48b L2-DA 48b

10 Example Classifier RuleDestination Address Source Address R10*10* R20*01* R30*1* R400*1* R500*11* R610*1* R7*00* Field 1Field 2 IP-Lookup is a special case of the packet classification problem. Example: (00101, 11011)

11 R1 R2 R3 R4 2-dim Classifier

12 R1 R2 R3 {R1, R2} {R2, R3} {R1, R2, R3} 7 regions For a given point p: Find the rule (region) with highest priority containing p. 2-dim Classifier

13 Solution stategies for IP-Lookup and Packet Classification Structure the universe of all bitstrings of length W: Trie based methods + Lookup becomes dependent only on the length of the given prefix - Updates expensive Structure the current set of n prefixes: Geometry based methods + Efficient updates - Lookup dependent on n Hardware-based solutions Hybrid methods

14 Binary Tries 0 0 1 1 1 0 00 A full binary tree of height W is a possible raster for storing all prefixes and bitstrings of length ≤ W. LMP: For a given bitstring p find the deepest node representing a prefix on the search path to leaf p! Time: O(W) {*, 00*, 010*, 10*,100*} 00001111

15 Compression (1) 0 0 1 10 00

16 Compression (2) 0 0 10 0 The number of nodes in a contracted binary trie storing n prefixes is ≤ 2n. CBT are similar to Ukkonen‘s implicit suffix trees. Lookup, insertion and deletion of prefixes in time O(W). Many possible variations: Increase branching factor in order to decrease height. Adapt branching factor on each level to number of prefixes. ……

17 Increasing the branching factor 00011011 0000 1111 Trie based structures are set- and order-unique, hence, oblivious structures!

18 18923456710 A F B G H CDE Structure the set of intervals Set of n nested intervals, among them the interval * representing the whole universe. n intervals partition the universe into ≤ 2n fragments. Fragments Intervals

19 18923456710 A F B G H CDE LMP For a given point p: Find the fragment f, into which p falls, and determine the smallest interval X containing f. Fragments Intervals

20 LMP and updates P1P1 P2P2 P3P3 P4P4 P5P5 P6P6 P0P0 Storing the smallest interval I containing fragment f at the fragments: LMP in time O(log n) Update:  (n)

21 18923456710 A F B G H CDE Let x be an arbitrary fragment or interval, define: next(x) = the smallest interval containing x For any given set of nested intervals: For each fragment and each interval x (except *) next(x) exists and is well defined! Fragments Definition next(x) Intervals

22 18923456710 A F B G H CDE Fragments Inverted-Next-Lists Inverted-Next-List of interval X = {Y; next(Y) = X}, sorted in l.t.r.o. A: B, 3, C, 7, D, 9, E B: 1, F C: 4, H D: 8 E: 10 F: 2 G: 5 H: G, 6 Intervals For each point p in fragment Y: If next(Y) = X, then X is the smallest interval containing p!

23 18923456710 A F B G H CDE Fragments Inverted-Next-Lists A: B, 3, C, 7, D, 9, E B: 1, F C: 4, H D: 8 E: 10 F: 2 G: 5 H: G, 6 Intervals Fragment i has direct link to the position, where i occurs in an INL. Each fragment and intervall in an INL is specified by ist start- and endpoint. Sum of lengths of all INL is at most 2 n. Inverted-Next-List of interval X = {Y; next(Y) = X}, sorted in l.t.r.o.

24 Longest Prefix Matching for point p 18923456710 A F B G H CDE Determine fragment Y, into which p falls, follow the link from Y to the INL, in which Y occurs, proceed from Y to the head of this INL, report the interval X at the header of this list! A: B, 3, C, 7, D, 9, E B: 1, F C: 4, H D: 8 E: 10 F: 2 G: 5 H: G, 6

25 18923456710 A F B G H CDE Insertion of a new interval without expansion of the fragment raster(2) A: B, 3, C, 7, D, 9, E B: 1, F C: 4, H D: 8 E: 10 F: 2 G: 5 H: G, 6 I A: B, I, 9. E I: 3, C, 7, D

26 1892 3a 456 7a 10 A F B G H CDE Fragments Insertion of a new interval with expansion of the fragment raster(1) A: B, 3, C, 7, D, 9, E B: 1, F C: 4, H D: 8 E: 10 F: 2 G: 5 H: G, 6 3b 7b I A: B, 3a, I, 7b, D, 9, E I: 3b, C, 7a Intervals

27 18923456710 A F B G H CDE Fragments Deletion of an interval without contraction of the fragment raster(1) A: B, 3, C, 7, D, 9, E B: 1, F C: 4, H D: 8 E: 10 F: 2 G: 5 H: G, 6 A: B, 3, 4, H, 7, D, 9, E Intervals

28 Implementation List of fragments: Balanced leaf-search-tree, Operations: Search, insert, delete Inverted Next Lists: Balanced leaf-search-tree Operations: Find root (marking), splitting a tree according to a given x-value, join of 2 or 3 trees to a new one. All operations can be carried out in time O(log n), n = #(intervals) Alternative implementations may use: Biased Skip Lists (for bursty access patterns): Sahni/Kim 2003 Splay Trees (self adjusting to the access pattern) ……..

29 Summary Trie-based solutions: (1-dim) static: LMP in time O(W) dynamic: insertion, deletion in time O(W) (Doeringer et al, 1996) Dynamic programming algorithm for the construction of space optimal tries of a predetermined height (optimize the strides of tries) (Sahni et al, 2003) Geometry-based solutions: (dynamic) Dimension: 1-dim, 2-dim, higher … Interval sets: nested, conflict free, general Priorities: length of intervals (LMP), general Structures: inverted lists, (balaced) search trees, skip lists segment trees, interval trees, PST Efficiency: worst case, amortized w.c., expected case

30 1-dim, nested intervals, LMP-priority, Sahni et al. 2003 search, insertion, deletion in time O(log n), inverted lists, balanced trees, skip lists 1-dim, nested intervals, general priorities, Kaplan et al. 2003 search, insertion, deletion in time O(log n) and space O(n) worst case: balanced dynamic trees amortized: self-adjusting dynamic trees 1-dim, general intervals, general priorities, Kaplan et al. 2003 search in worst-case time O(log n) insertion in amortized time O(log n) deletion in amortized time O(log n log log n) space O(n) interval trees, BB[  ] trees 2-dim, general rectangles, general priorities search, insert, delete in time O(log 2 n) and space O(n log n) dynamic segment trees

31 2-dim, nested rectangles, general priorities, Kaplan et al. 2003 search in amortized time O(log n) insertion in amortized time O(log 2 n) space O(n log n) splay trees 2-dim, general rectangles over fixed universe U, general priorities, Eppstein et al. 2001 Static case (no updates) search in time O(log |U|) conflict detection in time O(n 3/2 ) k-d-trees, Open problems: Simple, efficient solution for the general, higher-dimensional case. Bursty and clustered updates. Using other data structures, like fully dynamic segment trees, relaxed balanced search trees, relaxed balanced PST, ….

Download ppt "1 IP-Lookup and Packet Classification Advanced Algorithms & Data Structures Lecture Theme 08 – Part I Prof. Dr. Th. Ottmann Summer Semester 2006."

Similar presentations