Post on 14-Dec-2015
CSE 561 – Bridging and Routing
David Wetheralldjw@cs.washington.edu
Spring 2000
djw // CS 561, Spring 2000 L3.2
This Lecture
1. Learning bridges and spanning trees2. Intra-domain static routing
djw // CS 561, Spring 2000 L3.3
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
(wire)Hub
(repeater)
djw // CS 561, Spring 2000 L3.4
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 L3.5
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
bridgeB
A
D
C
djw // CS 561, Spring 2000 L3.6
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
B3
A
C
E
DB2
B5
B
B7 K
F
H
B4
J
B1
B6
G
I
djw // CS 561, Spring 2000 L3.7
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?
B3
A
C
E
DB2
B5
B
B7 K
F
H
B4
J
B1
B6
G
I
djw // CS 561, Spring 2000 L3.8
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 L3.9
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 L3.10
Algorithm Example
• Message format: (root, dist to root, bridge)
• Sample messages sequences to and from B3:1. B3 sends (B3, 0, B3) to B2 and B52. B3 receives (B2, 0, B2) and (B5, 0, B5) and accepts B2 as root
3. B3 sends (B2, 1, B3) to B54. B3 receives (B1, 1, B2) and (B1, 1, B5) and accepts B1 as root
5. B3 wants to send (B1, 2, B2) but doesn’t as its nowhere “best”6. 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 L3.11
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 L3.12
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
EthernetSwitch
EthernetSwitch
djw // CS 561, Spring 2000 L3.13
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 L3.14
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 L3.15
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 L3.16
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 L3.17
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 L3.18
• Routing is essentially a problem in graph theory
D
G
A
F
E
B
C=router
=link
Network as a Graph
X
11
1
1
1
1
1
11 =cost
djw // CS 561, Spring 2000 L3.19
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 L3.20
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 L3.21
DV Example – Initial Table at A
D
G
A
F
E
B
C
Dest
Cost Next
B 1 B
C 1 C
D -
E 1 E
F 1 E
G -
djw // CS 561, Spring 2000 L3.22
DV Example – Final Table at A
• Reached in a single iteration … simple example
D
G
A
F
E
B
C
Dest
Cost Next
B 1 B
C 1 C
D 2 C
E 1 E
F 1 E
G 2 F
djw // CS 561, Spring 2000 L3.23
What if there are changes?
• One scenario: Suppose link between F and G fails1. F notices failure, sets its cost to G to infinity and tells A2. A sets its cost to G to infinity too, since it learned it
from F3. A learns route from C with cost 2 and adopts it
D
G
A
F
E
B
C
XXXXX
Dest Cost Next
B 1 B
C 1 C
D 2 C
E 1 E
F 1 E
G 3 C
djw // CS 561, Spring 2000 L3.24
• Simple example– Costs in nodes are to reach Internet
• Now link between B and Internet fails …
Count To Infinity Problem
InternetA/2 B/1
djw // CS 561, Spring 2000 L3.25
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
update
InternetA/2 B/3 XXX
djw // CS 561, Spring 2000 L3.26
Count To Infinity Problem
• A hears from B and increases its cost
update
InternetA/4 B/3 XXX
djw // CS 561, Spring 2000 L3.27
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
update
InternetA/4 B/5 XXX
djw // CS 561, Spring 2000 L3.28
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 L3.29
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 L3.30
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 L3.31
• 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
Flooding
djw // CS 561, Spring 2000 L3.32
Example
• LSP generated by X at T=0• Nodes become yellow as they receive it
X A
C B D
X A
C B D
X A
C B D
X A
C B D
T=0 T=1
T=2 T=3
djw // CS 561, Spring 2000 L3.33
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 L3.34
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 L3.35
Dijkstra Example – Step 1
10
2 3
5
2
1
4 6
7
90
djw // CS 561, Spring 2000 L3.36
Dijkstra Example – Step 2
10
2 3
5
2
1
4 6
7
90
5
10
djw // CS 561, Spring 2000 L3.37
Dijkstra Example – Step 3
8
2 3
5
2
1
4 6
7
90
5 7
14
djw // CS 561, Spring 2000 L3.38
Dijkstra Example – Step 4
8
2 3
5
2
1
4 6
7
90
5 7
13
djw // CS 561, Spring 2000 L3.39
Dijkstra Example – Step 5
8
2 3
5
2
1
4 6
7
90
5 7
9
djw // CS 561, Spring 2000 L3.40
Dijkstra Example – Done
8
2 3
5
2
1
4 6
7
90
5 7
9
djw // CS 561, Spring 2000 L3.41
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