Static Vs Dynamic: Routing Algorithm
Static Vs Dynamic: Routing Algorithm
The Optimality Principle Shortest Path Routing Flooding Distance Vector Routing Link State Routing Hierarchical Routing Broadcast Routing Multicast Routing Routing for Mobile Hosts Routing in Ad Hoc Networks The routing algorithm is a part of network layer software to decide which output line an incoming packet should be transmitted on. Session routing is a route remains in force for an entire user session. Routing algorithms should be correctness, simplicity, robustness, stability, fairness, and optimality Routing Algorithms Non-adaptive algorithms They do not base their routing decisions on measurements or estimates of the current traffic and topology. Choice of route is done in advance This procedure is sometimes called static routing. Adaptive algorithms They change their routing decisions to reflect changes in the topology. This procedure is sometimes called dynamic routing. routing decisions are changed as per the change in topology or load Static Manually created and maintained Does not share information Function of IP Small Dynamic Dynamically built Share information among routers Function of Routing protocol(e.g.,RIP) Large
Static vs Dynamic
Function Routing Tables Sharing Information Route Discovery Internetwork
Static Algorithm
1)Shortest Path Routing: Shortest Path Routing is a static routing algorithm
that just finds the shortest path. A graph is used to represent the network. Each node of the graph represents a router. Each arc of the graph represents a communication link. To choose the route between a given pair of routers, the algorithm just finds the shortest path between them on the graph. Metric used in the shortest path. Number of hops Geographic distance in miles/kilometers Transmission delay fastest path Each arc (link) is labeled with a weight (link distance).
Dijkstra Algorithm
Each node is labeled with the distance from the source node along the best known path and the source node. Initially, no paths are known, all nodes except the source are labeled as (, -). All labels may be either tentative or permanent. Initially, the labels are tentative. When it is discovered to be shortest possible path, the label is made permanent and never changed thereafter.. An example: find the shortest path from A to D We start out by making node A permanent indicated by a filled-in circle. Then we examine each node adjacent to A, relabeling each one. Scan all the tentatively labeled nodes in the whole graph and make the one with the smallest distance to A permanent. This node becomes the new working node. Repeat the steps till the destination becomes permanent
The first 5 steps used in computing the shortest path from A to D. The arrows indicate the working node.
2)Flooding:
Flooding is a static routing algorithm. Every incoming packet is sent out on every outgoing line except the one it arrived on.
There are several variants of flooding algorithm: most work roughly as follows. Each node acts as both a transmitter and a receiver. Each node tries to forward every message to every one of its neighbors except the source node Selective Flooding The IMPs(routers) do not send every incoming packet out on every line, only those lines that are going approximately in the right direction. Random Walk The IMP simply picks a line at random and forwards the packet on it. Also, the IMP can make some attempt to get the packet heading in roughly the right direction. Flooding has tremendous reliability and always choose the shortest delay used in applications such as military, distributed database, wireless network, and a metric compared to other routing algorithm
Dynamic Algorithm
1)Link State Routing: Link State Routing is a dynamic routing. Each router must do the following: 1. Discover its neighbors, learn their network address. 2. Measure the delay or cost to each of its neighbors. 3. Construct a packet telling all it has just learned. 4. Send this packet to all other routers. 5. Compute the shortest path to every other router
(a) A subnet. (b) Input from A, I, H, K, and the new routing table for J. Distance vector works in theory but has a serious drawback in practice. React rapidly to good news when a router comes up. Though it finally converge to correct result, it takes long time when where is a bad news. There are several attempts to solve the problem, but none is perfect. Distance vector routing was used in ARPANET until 1979 when it is replaced by link state routing. Two problems of distance vector routing: It does not take line bandwidth into account. It took too long to converge
Whether to take the load into the account? Consider the load: start measuring delay when ECHO is queued. Choosing unloaded line results in better performance. But the load might oscillate. Ignore the load: start measuring delay when the ECHO packet reaches the front of the queue.
A subnet in which the East and West parts are connected by two lines.
Build the link state packet containing: node ID, sequence number, age, a list of neighbors and the delay to the neighbor. Building the state packet is easy. The hard part is to determine when to build them. Periodically or event-driven
(a) A subnet. (b) The link state packets for this subnet Distributing the Link State Packets: The trickiest part is to
distribute link state packet. Basic idea: Use flooding to distribute the link state packets. To keep the flood in check, each packet contains a sequence number that is increased by one for each new packet. When the link state packet arrives, the router check if it is new. Yes forward it to all outgoing lines except the one it arrived.
No (duplicated or with low sequence number) discard it. Potential problems: The sequence number wrap around use the 32-bit sequence number. It takes 137 years to wrap around. The router crashes. Its sequence number starts again from 0, it is rejected. The sequence number is corrupt (e.g., 65540 is received instead of 4, then packets from 5 to 65540 will be rejected.) Use age to solve the problems: The age decreases by one per second. The packet is discarded when age = 0. Problem packets wont last for a long time. Each router uses a table to maintain the link state packets. Each row is a recently received but not processed packet. Each entry includes the source address, sequence number, age, and send/ACK flags
The packet buffer for router B in the previous slide (Fig. 5-13). Computing Routes: Once a router has accumulated a full set of link
state packets, it knows all nodes and links, thus can construct the subnet graph. Run Dijkstra algorithm to find the shortest paths from the source to all other nodes. For a network with n routers, each with k neighbors, the memory required in nk. Memory and computational time may be a problem for large subnets. But it works fine for many practical situations. The OSPF (Open Shortest Path First) protocol is used in the Internet. IS-IS (Intermediate System-Intermediate System) is used in some the Internet backbone (NSFNET With the increase of network/routers, it is infeasible to have an entry for each router. The hierarchical routing is required.
Hierarchical Routing
Divide the routers into regions. The router only knows details to route packets to the destination within the same region. But may not be optimal (e.g., The best route from 1A to 5C is via region 2, but since the route via region 3 is better for most nodes in region 5.
Broadcast Routing
Broadcasting: send a packet to all destinations. Distributing weather reports, stock, radio programs, etc. Broadcast routing algorithm Send a distinct packet to each destination (waste bandwidth) Flooding (generate too many packets) Multi-destination routing The packet includes a list of destinations The router sends the packet on an outgoing line if it is the best route for at least one of destinations (according to routing table). Broadcast routing algorithm A spanning tree is a subset of the subnet that includes all the routers but contains no loops. Copy an incoming broadcast packet onto all the spanning tree lines except the one it arrived on. excellent use of bandwidth But each router is required to know some spanning tree. Reverse path forwarding: approximate spanning tree Router check if the packet arrived on the line normally used for sending packets to the source; if so, the broadcast packet is likely following the best route, the router rebroadcast it; if no, discards it
Reverse path forwarding. (a) A subnet. (b) a Sink tree. (c) The tree built by reverse path forwarding. Multicast Routing:
Sending a packet to a group of nodes (a subset of the nodes in the network) is called multicasting. Multiple unicast or broadcast are too expensive Build spanning tree Upon receiving a packet, prune the spanning tree (cut off the routers/lines that do not lead to any member in the group) Not scalable
(a) A network. (b) A spanning tree for the leftmost router. (c) A multicast tree for group 1. (d) A multicast tree for group 2. Routing for Mobile Hosts
All hosts are assumed to have a permanent home location (home address) that never changes.
Each area has one or more foreign agents (FA), keeping track of all mobile hosts (MH) visiting the area. Each area has a home agent (HA), which keep track of hosts whose home is in the area but are currently visiting another area