Download Optimal Routes & Adaptive Routing: Distance Vector, Link State, and Hierarchical - Prof. E and more Study notes Computer Science in PDF only on Docsity!
Routing
CSC 343· 643 WAKE FORESTU N I V E R S I T Y Department of Computer Science Fall 2008
Internet Protocols CSC 343· 643 Routing 1
Routing Algorithms
- A primary function of the network layer is routing packets
- Routing algorithm is responsible for deciding which output line incoming packets should be transmitted
- If a datagram network
- Routing decision is new for every packet
- If a VC network
- Routing decision made for a VC request
- Thereafter, packets follow established path
- Routing algorithm goals include: correctness, simplicity, robustness, stability, fairness, and optimality
What is Optimal
General statement about optimal routes
- Optimality principle - If router j is on the optimal path from router i to router k, then the optimal path from j to k falls on this route
- As a result the set of optimal routes from all destinations to a source is in the form of a sink tree B A F
D E^ C J N
O
H I
G
L M
K network
B A F
D E C J N
O
H I
G
L M
K sink tree
- The sink tree in not necessarily unique, but a tree never has...
E. W. Fulp Fall 2008
Internet Protocols CSC 343· 643 Routing 3
Routing Algorithm Classifications
- Performance criterion
- Number of hops, cost, delay, ...
- Decision time
- Decision place
- Each node or central node
- Strategy
- Nonadaptive (static routing) - Routes calculated off-line in advance
- Adaptive (dynamic routing) - Routes calculated based on measurements or topology (that change)
- Get next cheapest node and incorporate into set M
- Find neighboring node not in M that has least cost path from s and add to M (also incorporate edge)
Find w /∈ M such that Dw = min ∀j /∈M {Dj }
- Update least cost paths using w
Dn = min {Dn, Dw + dw,n} ∀n /∈ M
- Go to step 2 and repeat until all nodes incorporated in M
E. W. Fulp Fall 2008
Internet Protocols CSC 343· 643 Routing 7
Dijkstra Example
3
^ ^ ^
1
^ ^2
^ ^ ^
^ ^4
^ ^ ^
Iter. M D 2 Path D 3 Path D 4 Path 1 2 3 4
Bellman-Ford Algorithm
Summary: Find the shortest paths from a given source node subject to the constraint that the paths contain at most one link; then find the shortest paths with a constraint of paths that contain at most two links, and so on ...
- For the algorithm, let s = source node di,j = link cost from i → j, di,i = 0, di,j = ∞ if not directly connected, di,j > 0 otherwise h = maximum number of hops allowed in any path Dnh = cost of least cost path s → n using h hops
E. W. Fulp Fall 2008
Internet Protocols CSC 343· 643 Routing 9
- Initialization
- D^0 n = ∞ ∀n = s
- Dhs = 0 ∀h
- Update for each successive h ≥ 0 for each n = s D nh+1 = min∀j {Dhj + dj,n}
Host A
1, 2 3 , 2
2, 1
4, 2
5, 1
G R
R
R
R
G
G1 G
Host B
Time
R3 R
R
R3 R
R
R
G
R4 R
R2 R
1st broadcast
2nd broadcast
3rd broadcast
Limit value reached
E. W. Fulp Fall 2008
Internet Protocols CSC 343· 643 Routing 13
Random Routing
- Random routing has the simplicity and robustness of flooding, but requires far less resources
- Algorithm details
- Node randomly selects outgoing link for an arriving packet (exclude the link packet arrived on)
- If links equally probable, then utilization of links is round-robin
- Performance modification for links with different rates
- Assign a probability to each link based on its data rate pi = ∑ri j rj
- Yields better utilization of links What are the advantages and disadvantages?
Adaptive Routing
- Adaptive routing is used in packet switched networks
- Routes will change based on network conditions
- Network state information needed by all nodes, as a result
- Routing decisions are more complex
- Must trade-off overhead and freshness
- Classic control problem
- Control problem
- Changing too quickly will cause oscillations
- Changing too slowly never converging
- Two adaptive routing methods
- Distance vector and link state
E. W. Fulp Fall 2008
Internet Protocols CSC 343· 643 Routing 15
Distance Vector
- Each node (router) maintains a table (vector), indicates
- Best known distance to a destination
- Next link (hop) to take to get there
- Tables updated by exchanging info with neighbors
- A form of distributed Bellman-Ford
- Each node i maintains two vectors
delay vector = Di =
di, 1 di, 2 .. . di,n
next node vector = Si =
si, 1 si, 2 .. . si,n di,j = current minimum delay from i → j si,j = next node in the current route from i → j
D 2 =
d 2 , 1 = 1 d 2 , 2 = 0 d 2 , 3 = 2
D 3 =
d 3 , 1 = 4 d 3 , 2 = 2 d 3 , 3 = 0
- Above two vectors are sent to node 1, which calculates routes
d 1 ,j = min i∈{ 2 , 3 }
{l 1 ,i + di,j } j = all other nodes
j = 2 d 1 , 2 = min {l 1 , 2 + d 2 , 2 , l 1 , 3 + d 3 , 2 } ⇒ s 1 , 2 = 2
j = 3 d 1 , 3 = min {l 1 , 2 + d 2 , 3 , l 1 , 3 + d 3 , 3 } ⇒ s 1 , 3 = 2
E. W. Fulp Fall 2008
Internet Protocols CSC 343· 643 Routing 19
Count to Infinity Problem
- Distance vector routing
- Given n is the longest path in the network, with n exchanges all nodes will know about any good news
- Bad news will take infinite exchanges
- Consider the following full-duplex network 1 1 2 1 3
- Initially 1 → 2 is 1 unit and 3 → 1 is 2 units
- Assume node 1 goes down... what happens on the exchanges?
- Node 2 gets nothing from node 1 therefore cost is ∞
- However, cost to node 1 via node 3 is 2, so node 2 uses path via node 3 to get to 1, cost is 3
- Node 3 gets update cost from node 1, path to node 1 is 3, must update its cost to 4
- Node 2 get updated cost from node 3, path to node 1 is 4, must update its cost to 5
This repeats until cost is ∞
- Several changes to the DV routing have been proposed
- Split horizon and reverse poison are two examples where minimum distance information is not sent to a neighbor if the neighbor is on the minimum path
- Unfortunately these fixes do not always work
E. W. Fulp Fall 2008
Internet Protocols CSC 343· 643 Routing 21
Link State
Has the following steps
- Discover neighbors and learn addresses
- Measure cost (delay) to neighbors
- Create packet containing cost information
- Send packet to all nodes (not just neighbors)
- Compute shortest path to all other nodes (Dijkstra’s Algorithm) Any problems with link state?
Region 1 Region 2
Region 3 Region 4 Region 5
1B 1A 1C
2A 2B 2C
5A5B^ 5C 5E 5D
2D
4A 4B (^) 4C
3A 3B
1B 1 1C 1 1B 2 1B 3 1B 3 1B 4 1C 3 1C 2 1C 3 1C 4 1C 4 1C 4 1C 5 1B 5 1C 6 1C 5
1A –^ – 1C 2A 2B 2C 2D 3A 3B 4A 4B 4C 5A 5B 5C 5D 5E
1B
Dest. Line Hops
Full table for 1A 1A 1C 2 3 4 5
1B
Dest. Line Hops
Hierarchical table for 1A
1B 1 1C 1 1B 2 1C 2 1C 3 1C 4
Example network non-hierarchical routing table hierarchical table
- Example network is a two-level hierarchy
- Source-based routing table has 17 entries
- 2-level hierarchy has 7 entries
E. W. Fulp Fall 2008
Internet Protocols CSC 343· 643 Routing 25
- Hierarchical tables
- One entry for each router in same region (AS)
- One entry for all routers in another region ∗ All traffic from region 1 to region 2 traverse 1B-2A link Given a destination address in another region, how does a router know which region to route?
- Addresses are hierarchical ∗ In the example network, router addresses have the form region-number followed by router-letter
- Hierarchical routing disadvantages
- May result in increased path lengths
- For example, best route from 1A to 5C is via region 2, but hierarchical routing uses region 3
How Many Hierarchies
Consider a network with 720 routers
- No hierarchy, each router has 720 entries
- Partition into 24 regions each with 30 routers
- This is a two-level hierarchy
- Each routing table has entries
- Using a three-level hierarchy, with 8 domains, each containing 9 regions of 10 routers - Each routing table ∗ 10 entries for local routers ∗ 8 entries for routing to other regions inside of own domain ∗ 7 entries for other domains - Total of 25 entries
E. W. Fulp Fall 2008
Internet Protocols CSC 343· 643 Routing 27
Static versus Dynamic IP Routing
- Already know how IP packets are routed using routing tables
- How were the entries generated... statically or dynamically?
- In static routing entries are manually adjusted
- Acceptable for small networks
- For larger networks, dynamically change table entries
- Routes should change based on network conditions
- Allow routers to pass route information to one another
- Use variations of Bellman-Ford and Dijkstra’s
- N.B. This will not change the way IP datagrams are routed, just how/when the routing table contents change
Intra-AS Routing
- Used to configure and maintain routing tables within an AS
- Also called Interior Gateway Protocols (IGP)
- Historically three routing protocols have been used
- Routing Information Protocol (RIP)
- Open Shortest Path First (OSPF)
- Enhanced Interior Gateway Routing Protcol (EIGRP) Cisco propriety
E. W. Fulp Fall 2008
Internet Protocols CSC 343· 643 Routing 31
Routing Information Protocol
- RIP was one of the earliest intra-AS protocols
- Still in use, popular since it was included BSD Unix
- Two versions, original [RFC1058], and version 2 [RFC1723]
- Distance vector protocol
- Neighboring routers exchange messages every 30 seconds
- Message called RIP response message or RIP advertisement
- In original version cost metric → hop-count Which shortest-path algorithm is it based-on?
What problem is associated with this algorithm?
RIP Messages
- Messages are carried in UDP datagrams (transport layer) IP datagram RIP Message
UDP Header
IP Header
- RIP messages have the format 32 Bits
up to 24 more routes, with same format as previous 20 bytes
command version must be zero address family must be zero
must be zero
32-bit IP address
must be zero
20 bytes metric (1-16)
E. W. Fulp Fall 2008
Internet Protocols CSC 343· 643 Routing 33
- RIP message fields
- Command field, 1 = request or 2 = reply
- Version field, 1 or 2
- Next 20 bytes specify address family, an IP address, and an associated metric
- 25 routes can be advertised in a RIP message
- Total size of RIP message is 20 × 25 + 4 = 504 bytes, less than 512 bytes
- Why so much wasted space per entry? “The packet format is intended to allow RIP to carry routing informa- tion for several different protocols... None of the RIP implementations available to the author implement any other type of address... How- ever, to allow for future development, implementations are required to skip entries that specify address families that are not supported by the implementation.” [RFC1058]
Open Shortest Path First
- OSPF is another intra-AS routing protocol [RFC1247, 2328]
- Primary characteristics
- Open protocol, specification is public domain
- Link-state protocol, Dijkstra’s algorithm used for SPF What is the disadvantage to using a link-state algorithm?
- OSPF can operate within a hierarchy
- Largest entity is the AS
- AS is divided into area
- Routing algorithm will operate in each area What problem does this attempt to avoid?
E. W. Fulp Fall 2008
Internet Protocols CSC 343· 643 Routing 37
OSPF Routing Hierarchy
- OSPF allows an AS to broken into areas
- Areas do not overlap, but are not exhaustive Therefore we are reducing...
- Outside an area, topology and details are not known
- Area is generalization of a subnet
- Within an area each router must
- Have the same link-state database and run the same SPA
- Know the shortest path to any other router in its area
- Router classification
- Internal routers, within an area
- Area border routers, connect outside of area (within AS)
- AS boundary routers, connect to other autonomous systems
- The diagram show all the different types of routers
- Routers R2, R3, R5, R6, and R7 are internal routers
- Routers are area border routers
- Router R0 is the AS boundary router
R
area 1
area 2
area 3
autonomous sytem
R R R R R
R R
R
- A backbone area also exists, consists of all area border routers, boundary routers, and any networks/routers not inside an area
E. W. Fulp Fall 2008
Internet Protocols CSC 343· 643 Routing 39
OSPF Operation
- Determine neighbors by sending hello messages
- Hello messages are multicast every 10 seconds
- Failure to receive hello from neighbor for 40 seconds, assume link/neighbor failed
- Each router in an area distributes information about its local environment in datagrams called link state advertisements - Information about neighboring routers (links and costs) - LSA are distributed via reliable flooding (explicitly ACKed, sequenced, and time-stamped) ∗ Sent if: new neighbor found, link failure, cost change, refresh every 30 minutes - Using this information, shortest tree path can be determined