View
221
Download
0
Category
Preview:
Citation preview
IP-Lookup and Packet Classification
Computational Geometry, WS 2007/08Lecture 14
Prof. Dr. Thomas Ottmann
Algorithmen & Datenstrukturen, Institut für InformatikFakultät für Angewandte WissenschaftenAlbert-Ludwigs-Universität Freiburg
Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 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
• Priority Search Trees
Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 3
Dstn Addr
--------
---- ----
--------
Dstn-prefix Next Hop
Forwarding Table
Forwarding EngineHEADER
Lookup in an IP Router
Next-Hop-Computation
Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 4
0 224
232-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/ 8 3
128.9.0.0/16 1
142.12.0.0/19 7
IP prefix: 0-32 bits
128.9.16.14
Example Forwarding Table
Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 5
128.9.16.0/21128.9.172.0/21
128.9.176.0/24
0 232-1
128.9.0.0/16142.12.0.0/19
65.0.0.0/8
Nested intervalls
Sets of intervalls corresponding to sets of prefixes of IP-addressesare nested:Any two intervalls are either disjoint or one is contained in the other!
Overlaps are impossible!
Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 6
128.9.16.0/21128.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 232-1
128.9.0.0/16142.12.0.0/19
65.0.0.0/8
128.9.16.14
LMP-Matching
Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 7
Example of an IP-Lookup Table
Prefix Next-hop
P1 111* H1
P2 10* H2
P3 101* H3
P4 10101 H4
P5 * H5
Prefixes may be considered as bitstrings of a maximal length W.
Example: W = 5, p = 10111
Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 8
Generalisations of IP-Lookup
• Dynamisation: Insertion, deletion of prefixes (intervalls)• Conflict free sets of intervalls (not nested)
• Priority matching instead of LMP lookup:
Prefix Next-hop
R1 10* H3
R2 1001* H2
R3 01100 H5
R4 0* H4
R5 010* H1
R6 * H6
Determine the prefix with highestpriority matching a given bitstring
10011
Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 9
Extension to higher dimensions
Classify incoming packages into different flows according to different services.
Service Example
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
PAYLOADL4-SP16b
L4-DP16b
PROTO8b
L3-SA32b
L3-DA32b
L3-Proto8b
L2-SA48b
L2-DA48b
Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 10
Example Classifier
Rule Destination Address
Source Address
R1 0* 10*
R2 0* 01*
R3 0* 1*
R4 00* 1*
R5 00* 11*
R6 10* 1*
R7 * 00*
Field 1 Field 2
IP-Lookup is a special case of the packet classification problem.
Example: (00101, 11011)
Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 11
R1
R2
R3R4
2-dim Classifier
Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 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
Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 13
Solution stategies
• 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
Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 14
Binary Tries
0
0
1
1 10
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 prefixon the search path to leaf p!Time: O(W)
{*, 00*, 010*, 10*,100*}
0000 1111
Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 15
Compression (1)
0
0
1
1 0
00
Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 16
Compression (2)
0
0
10
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.……
Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 17
Increasing the branching factor
00 01 10 11
0000 1111
Trie based structures are set- and order-unique, hence,oblivious structures!
Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 18
Geometric view of IP-table lookup
Find a representation of a (dynamic) set of intervals such that the following operations can be carried out efficiently:
• Insertion of an interval• Deletion of an interval• For a given point p: Find the smallest interval stabbed by p (LMP-
query)
Assumptions:
Set of intervals is nested (but not necessarily a prefix set).
Every newly inserted interval does not overlap with any interval in the set.
Conflict test: For a given interval test whether or not it overlaps (is in conflict) with any interval already in the set.
Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 19
0 5 10 15 0 5 10 15
A
BC
D
A
B
C
D
p = (d, d)
10
5d
0 5 10 15 0 5 10 15
A
BC
D
A
B
C
D
p = (d, d)
10
5d
Mapping intervals to points
Assumption: All points have pairwise distinct x-coordinates Map point (x, y) to ((x, – y), y)
Interval (l, r) is mapped to point (r, l) below the main diagonal.
Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 20
B
A
B
A
X and Y represent disjoint intervals⇔ There is no point p on the diagonal, s.t. p ≼ X und p ≼ Y
Disjoint intervals
Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 21
A
B
A
B
A ⊒ B Interval A = (lA, rA) includes interval B = (lB, rB) iff. point A is right below point B, A B ⋟
B ⊑ A ⇔ A ⊒ B ⇔ point B left above point A ⇔ B ≼ A
Geometric interpretation of interval-inclusion
Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 22
C
p
D
C
D
X and Y represent overlapping intervals⇔ There is a point p on the diagonal, s.t. p ≼ X and p ≼ Y , but X and Y are incomparable with resp. to ≼
Overlapping intervals
Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 23
BB
p
A
D
C
X is smallest intervall, that contains point p⇔ p ≼ X and for all Y with p ≼ Y : X ≼ Y
Observation: Sets of nested intervals stabbed by a point are totally ordered with resp. to ≼ Points closer to the diagonal represent smaller intervals.
Nested intervals
Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 24
Equivalent Query
For a given p, find the leftmost point whose x-value is greater than or equal to p and whose y-value is less than or equal to p.
p
p
Since the original intervals are nested, the topmost-leftmost point is also the leftmost one!
Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 25
Geometric version of the IP-lookup-problem
Maintain a set of points in the plane (below the main diagonal) s.t. the following operations can be carried out efficiently:
• insertion of points• deletion of points• minXinRectagle queries (corresponds to topmost-leftmost queries)
minXinRectangle(l, r, y0)
Data structures used:
• Priority-search-trees (Lu/Sahni, IEEE TC, 2004)• Min-augmented-search-trees• Priority-search-pennats
(Lauer, Ottmann, Datta: Update efficient data structures for dynamic IP router tables, International Journal of Foundations of Computer Science, 18(1):139--161, Feb. 2007. World Scientific Publishing Company. )
Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 26
Priority Search Trees
Priority Search trees are a 1.5-dim structure for the storage of points, they support the following operations :
Insertion of a point Deletion of a point South-grounded range queries
Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 27
83, 8
32 4 56, 9
6 71
2, 41
4, 53
5, 45 7
1, 22
8, 36
7, 14
Priority search trees are - binary leaf search trees for the x-coordinates of the points. - min heaps for the y-coordinates of the points.
Priority Search Tree
Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 28
l
y0
r
Executable in O(log n) time.
Find topmost leftmost (orleftmost topmost) point inthe range (l, r , y0)
p
l
y0
Well defined, if intervalls are nested,otherwise not!
r
minXinRectangle(l, r, y0)
Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 29
15,1
40
4,2
9
33,4
28
1
1,3
1
6,10
1317,35
302,4
2
17 28
17,9
17
Finding topmost leftmost points in PST
Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 30
Finding leftmost topmost points in PST
Recommended