Outline: Routing
- Routing Problem
- Source Routing
- Distance Vector
- Link State
- Broadcast
Routing Problem
- in an internet, data has to somehow be forwarded from the source,
through a number of intermediate systems, to the destination
- some internets that require routing:
- Internet: datagrams, routing occurs for each datagram
- ATM: virtual circuits, routing occurs at connection setup time
- 1980's email: source route described path across sequence
of (occasionally) interconnected hosts
- Routing problem:
- who is responsible for determining the path from the source to
the destination?
- using what algorithm?
Routing Ideas
- minimum: each switch must know what port an item of data must
be sent on
- ports connect to topological neighbors
- maximum: each switch and host has a map of the entire network,
could do source routing
- broadcast: why not simply send data everywhere?
- doesn't scale
- doesn't handle loops
- instead, "broadcast" routing information
- how fast does the routing information change?
Distance Vector Routing
- each neighbor tells me how far it is from every host it knows about
- if a neighbor N has a shorter path than I do to host X, I will
route packets or circuits to X through N
- in case of ties, I pick one at random.
- "broadcasting": distance information about the whole network eventually
reaches the entire network
Distance Vector Algorithm
- keep a routing table indexed by destination:
- send to each neighbor both periodically and when my routing table changes
- each message contains destination, distance from my routing table
- when receiving a message on port P:
- add one (or link metric) to distance of each entry in the message
- replace entries in the table with entries from message if either:
- distance message < distance table, or
- port table = P
Distance Vector example
- My routing table:
| Destination | Distance | Port |
|
A | 4 | 1 |
|
B | 2 | 4 |
|
X | 5 | 2 |
|
|
- message on port 4: (A, 2), (B, 3), (X, 5)
- New routing table:
| Destination | Distance | Port |
|
A | 3 | 4 |
|
B | 4 | 4 |
|
X | 5 | 2 |
|
|
Link-State Routing
- each node keeps a table of its neighbors, with destination and metric
- each node broadcasts its neighborhood table whenever it changes
- from sequence of broadcasts each node can figure out the network topology
- node uses private map to route packets
- every switch must use equivalent algorithm, or we use source routing
Link-State -- Distance Vector
- LS routing allows the exchange of much more precise information than
DV does (DV exchanges a single "distance" metric).
- LS must exchange more information overall, and each host must compute
a route based on the resulting topology information. With DV,
computation of the route is automatic.
- LS requires some notion of the "age" of information. A reliable DV
also needs a way to make information obsolete, since otherwise information
takes a long time to become obsolete.
Broadcasting:
Flooding Algorithm
- Keep track of all packets received
- On receipt of a packet from port i:
- If you have received it before, discard it.
- Otherwise, forward it on all ports except port i.
More Practical Flooding
- each sender numbers all broadcast packets sequentially
- each node only needs to remember the most recent sequence number
from each sender
- only works if there is no danger of re-ordering.
Another Flooding Algorithm
- if:
- you have Link-State information, and
- all switches are running the same algorithm
can build spanning tree back to the sender of a broadcast message
- only forward the message to the nodes that are "below"
you on this spanning tree.
- no need for sequence numbers, "remembering"