520 likes | 679 Views
Outline. Recap Network components & basic mechanisms Routing Flow control Continue Basic queueing analysis Construct routing table. Network components. h osts. routers. links. Basic mechanisms. h osts. ?. routers. ?. ?. ?. ?. links. How to choose path? How fast to send?.
E N D
Outline • Recap • Network components & basic mechanisms • Routing • Flow control • Continue • Basic queueing analysis • Construct routing table
Network components hosts routers links
Basic mechanisms hosts ? routers ? ? ? ? links How to choose path? How fast to send? video packets
How to choose path? • Router by router decision • IP + routing table • Longest prefix matching
RTT 1 2 W 1 2 W data ACKs 1 2 W 1 2 W How fast to send? • window flow control • W * packet_size / RTT Source time Destination time
Outline • Recap • Network components & basic mechanisms • Routing • Flow control • Continue • Basic queueing analysis • Construct routing table
Links may get congested How long does it take for a packet to get transmitted?
Basic queueing analysis (expected) delay T Packets arrive randomly Packets arrive uniformly Arrival rate λ Queueing analysis studies what happens if arrival is random.
Poisson arrival Poisson arrival: Interpretation: time Independent, exponentially distributed with mean 1/λ. expected delay T Arrival rate λ
Poisson arrival holds more generally
Outline • Recap • Network components & basic mechanisms • Routing • Flow control • Continue • Basic queueing analysis • Construct routing table
We already know • Router by router decision • IP + routing table • Longest prefix matching What is missing? How to construct the routing table.
Two layers of routing • Choose which AS? • - BGP • How to route inside an AS? • - OSPF Autonomy system (AS) e.g., AT&T, Verizon, MIT. Internet A B
Why two layers? • Different objectives • Choose AS: special policies • Inside AS: minimize delay, # hops • Simplify routing • Choose AS: ignore details inside AS • Inside AS: only details inside AS
Inter-domain routing: BGP • Peering relation: A-B, B-C • A, B, C carry each other’s traffic free • of charge • B only advertises B to A and to C • A does not know how to reach C through this. A must have transit relation with anther ISP (not shown here) that carries its traffic to C. • Transit relation: A-B, B-C • Customer-provider relation, e.g., B is provider for A and for C. A (C) pays B for carrying to/from A (C). • B advertises {B,C} to A and {A, B} to C so that all ISP’s know how to reach all destinations.
Inter-domain routing: BGP A typical configuration
Inter-domain routing: BGP BGP is policy-based routing • Generally not shortest-path • Other factors are generally more important in determining an AS-path than performance • Peering agreement • Pricing (revenue/cost) with next hop • Reliability, security, political reasons • Can lead to oscillation and bad performance
Inter-domain routing: BGP Example BGP policy at Berkeley: If possible, avoid AT&T Choose path with smallest #hops Alphabetical Berkeley decision: use path Sprint-Verizon-MIT to reach MIT
Border Gateway Protocol (BGP) Every AS keeps a list of (Destination, Path) pairs & policies. Policy: avoid AT&T. How to reach MIT from Berkeley? Verizon (MIT, Verizon---MIT) AT&T (MIT, AT&T---MIT) Sprint (MIT, NA) Berkeley (MIT, NA)
Border Gateway Protocol (BGP) Every AS keeps a list of (Destination, Path) pairs& policies. Policy: avoid AT&T. How to reach MIT from Berkeley? Verizon (MIT, Verizon---MIT) (MIT, Verizon---AT&T---MIT) AT&T (MIT, AT&T---MIT) (MIT, AT&T---Verizon---MIT) Sprint (MIT, Sprint---Verizon---MIT) (MIT, Sprint---AT&T---MIT) Berkeley (MIT, Berkeley---AT&T---MIT)
Border Gateway Protocol (BGP) Every AS keeps a list of (Destination, Path) pairs & policies. Policy: avoid AT&T. How to reach MIT from Berkeley? Verizon (MIT, Verizon---MIT) AT&T (MIT, AT&T---MIT) Sprint (MIT, Sprint---Verizon---MIT) Berkeley (MIT, Berkeley---AT&T---MIT) (MIT, Berkeley---Sprint---Verizon---MIT)
Border Gateway Protocol (BGP) In BGP, each AS • Announces itself to other ASes and which ASes it can reach • Obtains ASes reachability info from neighboring Ases • Propagate reachability info to all routers internal to the AS • Determine “good” routes to ASes based on reachability info and AS policy
BGP: potential oscillation Example BGP policy to reach D: Prefer 2-hop path to 1-hop Avoid 3-hop paths Oscillation: Every node will alternate between choosing an 1-hop path and 2-hop path
Some questions Q1: Why not 3-level, or N-level, routing? Q2: How can a source ensure that its packets follow the inter-domain path it wants? Q3: In BGP, can one prevent a domain from lying and funneling all traffic through itself in order eavesdrop?
Lecture outline Inter-domain routing • BGP Intra-domain routing • Shortest path algortihms Coding • FEC, network coding
Shortest-path algorithm • Dijkstra • Bellman-Ford
Dijkstra Each step, add one node with shortest distance.
Pseudo code function Dijkstra(Graph, source): for each vertex v in Graph: // Initializations dist[v] := infinity ; // Unknown distance function from source to v previous[v] := undefined ; // Previous node in optimal path end for // from source dist[source] := 0 ; // Distance from source to source Q := the set of all nodes in Graph ; // All nodes in the graph are unoptimized while Q is not empty: // The main loop u := vertex in Q with smallest distance in dist[] ; // Source node in first case remove u from Q ; for each neighbor v of u: // where v has not yet been removed from Q alt := dist[u] + dist_between(u, v) ; if alt < dist[v]: // Relax (u,v,a) dist[v] := alt ; previous[v] := u ; end if end for end while return dist; endfunction
Bellman-Ford Each iteration, tell neighbor updated distance. Pick the best neighbor. Consider how to reach D (dist, next_hop) @ each node A B C E F (inf,--) (inf,--) (2,D) (4,D) (inf,--) (inf,--) (5,C) (2,D) (3,C) (5,E) (6,B) (5,B) (4,E) (4,E) (2,D) (2,D) (3,C) (3,C) (4,E) (4,E) iteration
Pseudo code procedure BellmanFord(list vertices, list edges, vertex source) // Step 1: initialize graph for each vertex v in vertices if v is source then dist[v] := 0 else dist[v] := infinity previous[v] := null // Step 2: relax edges repeatedly for i from 1 to size(vertices)-1: // # iterations is upper bounded for each edge (u, v) with weight w in edges // for each pair of neighbors if dist[u] + w < dist[v] dist[v] := dist[u] + w previous[v] := u
Compare Dijsktra & BF • Message exchange • Dijkstra: every node sends only its incident link costs to all other nodes. This requires O(|V| |E|) messages. • BF: every node sends only to its neighbors least-cost estimates from itself to all other nodes • Speed of convergence • Disjstra: above implementation takes O(|V|2); can be reduced using heap • BF: can converge slowly and have routing loops during transient; count-to-infinity problem (can be solved using poisoned reverse) • No clear winner • Both are used on Internet • RIP: distance-vector protocol • OSPF: link-state protocol (meant to be successor to RIP)
Count-to-infinity problem Example Link between B & C fails A and B will not realize it, a routing route is created and their cost estimate to C keeps going up A solution: poisoned reverse: instead of telling B its true cost (2) to reach C, A tells B that its cost to reach A is infinity because A uses B to reach C.
Compare Dijsktra & BF • Dijkstra algorithm • Needs global information (link-state alg) • Each node broadcasts link-state packets to all other nodes in network • Each node executes Dijkstraalg to calculate shortest paths to all other nodes • After k iteration, shortest paths to k destinations are known (and they are the k shortest paths among the shortest paths to all nodes) • Terminates after N-1 iterations (N = #nodes)
Compare Dijsktra & BF • Bellman-Ford algorithm • Only needs local information (distance-vector alg) • Each node exchanges with neighbors the vector of distances from itself to all other nodes • Each node then updates the next hop and associated distance to all other nodes using Bellman-Ford (DP) equation • Decentralized, asynchronous, distributed
Other questions • How can routers trust each other ? • How to deal with non-convergence in DV protocol? How often is oscillation encountered in practice? • Router R1 can route a pkt to host A through R2 or R3; R2 can route through R4 or R5 and has chosen R4. But R1 prefers R5 to R2 to R4. What happens?
Other questions • What is timescale for routing update? • What are major impediments to making significant changes to routing architecture? Would a bio-inspired routing system feasible? • Can network coding & FEC be combined?
Lecture outline Inter-domain routing • BGP Intra-domain routing • Shortest path algortihms Coding • FEC, network coding
FEC: packet erasure code Recover from packet loss Coding • Input: n packets • Output: m packets • = bit-by-bit XOR of a random subset of • Header of specifies the subset used to generate
FEC: example : received pkt Decoding: received pkts
FEC: example : received pkt Decoding:
FEC: example : received pkt Decoding:
FEC: example : received pkt Decoding:
FEC: example : received pkt Decoding:
FEC: example : received pkt Decoding:
FEC: example : received pkt Decoding:
FEC: example : received pkt Decoding:
FEC: example : received pkt Decoding:
FEC: example : received pkt Decoding:
FEC: example : received pkt Decoding:
FEC: packet erasure code Decoding • If for some i, then for all pkts that contains • Remove from the collection of rec’d pkts • Repeat until all have been decoded • If at one step, there is no then decoding fails