420 likes | 432 Views
Understand the concepts of learning bridges, spanning trees, and forwarding algorithms in LAN environments. Learn how to interconnect LAN nodes, scale networks, and compute spanning trees efficiently.
E N D
CSE 561 – Bridging and Routing David Wetherall djw@cs.washington.edu Spring 2000
This Lecture • Learning bridges and spanning trees • Intra-domain static routing djw // CS 561, Spring 2000
Limits of a LAN • One shared LAN can limit us in terms of: • Distance • Number of nodes • Performance • How do we scale to a larger, faster network? • We must be able to interconnect LANs nodes Hub (repeater) (wire) djw // CS 561, Spring 2000
Bridges and Extended LANs • “Transparently” interconnect LANs • Receive frames from each LAN and forward to the other • Each LAN is its own domain; a bridge is not a repeater • Could have many ports or join to a remote LAN bridge djw // CS 561, Spring 2000
Backward Learning Algorithm • To increase overall performance: • Shouldn’t forward AB or CD, should forward AC and DB • How does the bridge know? • Learn who is where by observing source addresses • Forward using destination address; age for robustness A C bridge B D djw // CS 561, Spring 2000
Why stop at one bridge? • LANs and bridges form a graph • LANs = nodes, bridges = edges • But to avoid loops we forward only on select bridge ports! • Spanning Trees A B B3 C B5 D B7 K B2 E F B1 G H B6 B4 I J djw // CS 561, Spring 2000
Spanning Tree Example • Spanning tree is a subset of the graph that spans it but has no cycles • Prune some ports • Q: How do we find a spanning tree? A B B3 C B5 D B7 K B2 E F B1 G H B6 B4 I J djw // CS 561, Spring 2000
Spanning Tree Algorithm • Distributed algorithm to compute spanning tree • Robust against failures, needs no organization • Outline: • Goal is to turn some bridge ports off • Bridges send periodic “best” configuration messages • Elect a root node of the tree (lowest address) • Grow tree as shortest distances from the root • Turn off ports that aren’t on shortest paths djw // CS 561, Spring 2000
Algorithm continued • Each bridge sends periodic messages containing: • Its address, address of the root bridge, and distance (in hops) to root • Each bridge receives messages, updates “best” config. • Smaller root address is better, then shorter distance • To break ties, bridge with smaller address is better • Initially, each bridge thinks it is the root • Sends configuration messages on all ports • Later, bridges send only “best” configs • Add 1 to distance, send configs where still “best” (designated bridge) • Turn off forwarding on ports except those that send/receive “best” djw // CS 561, Spring 2000
Algorithm Example • Message format: (root, dist to root, bridge) • Sample messages sequences to and from B3: • B3 sends (B3, 0, B3) to B2 and B5 • B3 receives (B2, 0, B2) and (B5, 0, B5) and accepts B2 as root • B3 sends (B2, 1, B3) to B5 • B3 receives (B1, 1, B2) and (B1, 1, B5) and accepts B1 as root • B3 wants to send (B1, 2, B2) but doesn’t as its nowhere “best” • B3 receives (B1, 1, B2) and (B1, 1, B5) again … stable • Data forwarding is turned off to the LAN A djw // CS 561, Spring 2000
Some other details • Configuration information is aged • If the root fails a new one will be elected • Reconfiguration is damped • Adopt new spanning trees slowly to avoid temporary loops djw // CS 561, Spring 2000
LAN Switches • LAN switches are high performance multi-port bridges • Looks like a hub, but frames are switched, not shared • Every host on a separate port, or can combine switches Ethernet Switch Ethernet Switch djw // CS 561, Spring 2000
Limitations of Bridges • LAN switches form an effective small-scale network • Plug and play for real! • Why can’t we build a large network using bridges? • Little control over forwarding paths • Size of bridge forwarding tables grows with number of hosts • Broadcast traffic flows freely over whole extended LAN • Spanning tree algorithm limits reconfiguration speed • Poor solution for connecting LANs with different MAC protocols djw // CS 561, Spring 2000
Forwarding and Routing • Forwarding is the process that each router goes through for every packet to send it on its way • Involves local decisions • Routing is the process that all routers go through to calculate the routing tables • Involves global decisions djw // CS 561, Spring 2000
Kinds of Routing Schemes • Many routing schemes have been proposed/explored … • Distributed or centralized • Hop-by-hop or source-based • Deterministic or stochastic • Single or multi-path • Static or dynamic route selection • Internet is to the left djw // CS 561, Spring 2000
Routing Questions • How to choose best path? • Defining “best” is slippery • How to scale to millions of users? • Minimize control messages and routing table size • How to adapt to failures or changes? • Node and link failures, plus message loss • We will use distributed algorithms djw // CS 561, Spring 2000
Some Pitfalls • Using global knowledge is challenging • Hard to collect • Can be out-of-date • Needs to summarize in a locally-relevant way • Inconsistencies in local/global knowledge can cause • Loops (black holes) • Oscillations, esp. when adapting to load djw // CS 561, Spring 2000
Network as a Graph • Routing is essentially a problem in graph theory 1 1 1 =router X 1 1 =link 1 1 1 =cost 1 djw // CS 561, Spring 2000
Distance Vector Routing • Assume: • Each router knows only address/cost of neighbors • Goal: • Calculate routing table of next hop information for each destination at each router • Idea: • Tell neighbors about learned distances to all destinations djw // CS 561, Spring 2000
DV Algorithm • Each router maintains a vector of costs to all destinations as well as routing table • Initialize neighbors with known cost, others with infinity • Periodically send copy of distance vector to neighbors • On reception of a vector, if neighbors path to a destination plus neighbor cost is better, then switch to better path • update cost in vector and next hop in routing table • Assuming no changes, will converge to shortest paths • But what happens if there are changes? djw // CS 561, Spring 2000
DV Example – Initial Table at A djw // CS 561, Spring 2000
DV Example – Final Table at A • Reached in a single iteration … simple example djw // CS 561, Spring 2000
What if there are changes? • One scenario: Suppose link between F and G fails • F notices failure, sets its cost to G to infinity and tells A • A sets its cost to G to infinity too, since it learned it from F • A learns route from C with cost 2 and adopts it XXXXX djw // CS 561, Spring 2000
Count To Infinity Problem • Simple example • Costs in nodes are to reach Internet • Now link between B and Internet fails … Internet A/2 B/1 djw // CS 561, Spring 2000
Count To Infinity Problem • B nears of a route to the Internet via A with cost 2 • So B switches to the “better” (but wrong!) route Internet A/2 B/3 XXX update djw // CS 561, Spring 2000
Count To Infinity Problem • A hears from B and increases its cost Internet A/4 B/3 XXX update djw // CS 561, Spring 2000
Count To Infinity Problem • B hears from A and (surprise) increases its cost • Cycle continues and we “count to infinity” • Packets caught in the crossfire loop between A and B Internet A/4 B/5 XXX update djw // CS 561, Spring 2000
Split Horizon • Solves trivial count-to-infinity problem • Router never advertises the cost of a destination back to to its next hop – that’s where it learned it from! • Poison reverse: go even further – advertise back infinity • However, DV protocols still subject to the same problem with more complicated topologies • Many enhancements suggested djw // CS 561, Spring 2000
Routing Information Protocol (RIP) • DV protocol with hop count as metric • Infinity value is 16 hops; limits network size • Includes split horizon with poison reverse • Routers send vectors every 30 seconds • With triggered updates for link failures • Time-out in 180 seconds to detect failures • RIPv1 specified in RFC1058 • www.ietf.org/rfc/rfc1058.txt • RIPv2 (adds authentication etc.) in RFC1388 • www.ietf.org/rfc/rfc1388.txt djw // CS 561, Spring 2000
Link State Routing • Same assumptions/goals, but different idea: • Tell all routers the topology and have each compute best paths • Two phases: • Topology dissemination (flooding) • Shortest-path calculation (Dijkstra’s algorithm) • Why? • In DV, routers hide their computation, making it difficult to decide what to use when there are changes • With LS, faster convergence and hopefully better stability • It is more complex though djw // CS 561, Spring 2000
Flooding • Each router maintains link state database and periodically sends link state packets (LSPs) to neighbor • Contain [router, neighbors, costs] • Each router forwards LSPs not already in its database on all ports except where received • Each LSP will travel over the same link at most once in each direction • Flooding is fast, and can be made reliable with acknowledgments djw // CS 561, Spring 2000
Example • LSP generated by X at T=0 • Nodes become yellow as they receive it X A X A T=0 T=1 C B D C B D X A X A T=2 T=3 C B D C B D djw // CS 561, Spring 2000
Complication: Sequence Numbers • When link/router fails need to remove old data … How? • LSPs carry sequence numbers to determine new data • Send a new LSP with cost infinity to signal a link down • What happens when a router fails and restarts? • What sequence number should it use? Don’t want data ignored. • One option: age LSPs and send with “cost 0” to purge • Router can listen at startup to learn right sequence number • What happens if the network is partitioned and heals? • Different LS databases must be synchronized • A version number is used! djw // CS 561, Spring 2000
Dijkstra’s Algorithm • Graph algorithm for single-source shortest path S {} Q <all nodes keyed by distance> While Q != {} u extract-min(Q) S S plus {u} for each node v adjacent to u “relax” the cost of v u is done djw // CS 561, Spring 2000
Dijkstra Example – Step 1 1 10 2 3 9 0 4 6 7 5 2 djw // CS 561, Spring 2000
Dijkstra Example – Step 2 1 10 10 2 3 9 0 4 6 7 5 5 2 djw // CS 561, Spring 2000
Dijkstra Example – Step 3 1 8 14 2 3 9 0 4 6 7 5 7 5 2 djw // CS 561, Spring 2000
Dijkstra Example – Step 4 1 8 13 2 3 9 0 4 6 7 5 7 5 2 djw // CS 561, Spring 2000
Dijkstra Example – Step 5 1 8 9 2 3 9 0 4 6 7 5 7 5 2 djw // CS 561, Spring 2000
Dijkstra Example – Done 1 8 9 2 3 9 0 4 6 7 5 7 5 2 djw // CS 561, Spring 2000
Open Shortest Path First (OSPF) • Most widely-used Link State protocol today • Basic link state algorithms plus many features: • Authentication of routing messages • Extra hierarchy: partition into routing areas • Load balancing: multiple equal cost routes djw // CS 561, Spring 2000