48
1 | 48 Internet Working 6 th  lecture Chair of Communication Systems Department of Applied Sciences University of Freiburg 2005

06 1 routing_algorithms

Embed Size (px)

Citation preview

Page 1: 06 1 routing_algorithms

1 | 48

Internet Working6th lecture

Chair of Communication SystemsDepartment of Applied Sciences

University of Freiburg2005

Page 2: 06 1 routing_algorithms

2 | 48

Internet WorkingLast lecture and practical course

● ARP (address resolution protocol), IP helper protocol for broadcast networks– Mapping 48bit MAC addresses to IP addresses

– ARP – insecure protocol

– MAC addresses assigned globally unique by vendor

– IP addresses depends on subnet where end system is located

● An other helper protocol – IP messaging and error reporting– ICMP, part of IP

– Send network error and informational messages

Page 3: 06 1 routing_algorithms

3 | 48

Internet WorkingLast lecture

● Dynamic IP address assignment– By client itself

– By centrally managed server

● DHCP, UDP based, application layer protocol for dynamic assignment of IP addresses in broadcast networks (layer 2: ethernet, TokenRing, ...)

Page 4: 06 1 routing_algorithms

4 | 48

Internet Workingplan for this lecture

● Packet routing in IP networks– Discussed address adaptation in broadcast nets for local 

delivery

– Talked of routing principles (matching destination addresses against network address of an interface)

– Mostly involves static routing (addresses, netmasks, ...) assigned by administrator directly or via DHCP

● How does routing LAN­wide or globally work?

Page 5: 06 1 routing_algorithms

5 | 48

Internet Workingdefinition of routers

● Somehow magically an IP packet travels long distances and finds its way between two end systems (from source machine to destination)

● As we talked in introduction:– IP is a packet switched network so on every intermediate 

system a routing decision is to be made

● These intermediate systems normally have more than one IP interfaces (each interface with its own IP number matching to the net the machine is member of)

● Formally: each machine with interfaces in two different IP subnets (and the ability to forward packets from one interface to the other) is called a router

Page 6: 06 1 routing_algorithms

6 | 48

Internet Workingdefinition of routers cont.

● Every router maintains a routing table● In the simplest case the router has three entries in that table

– Route to local subnet #1

– Route to local subnet #2

– Default route with the router in one of the subnets

– The routing table grows with the number of interfaces and nets connected to each

Page 7: 06 1 routing_algorithms

7 | 48

Internet Workingrouting example

Page 8: 06 1 routing_algorithms

8 | 48

Internet Workingrouting example

● The routing tables of the two routers #1, #2 are longer then routing table of end system– For each interface a routing entry is present

– We find a default route on both of them (most routers have default entry, we will see why later)

● Maintaining this routing information manually is the standard mechanism used for relatively static and very small LAN environments

● Routing tables on a larger scale are not as fixed as local ones● Remember the networking structure graphs of BelWue, DFN and 

Geant, many network nodes are connected one more than one path with each others

Page 9: 06 1 routing_algorithms

9 | 48

Internet Workingrouting cont.

● Reasons for multilink IP connections– Every ISP must have more than one uplink connection to get 

the permission to operate (fox hole principle)

– Links are of differing bandwidth, quality, latency and price

● These variables may differ over time periods (different rates for daily or night use, failing lines, congested paths, ...)

● You will need mechanisms to consider these information and compute an optimal way to every destination network

● Routing techniques and protocols working over IP are to be introduced ...

Page 10: 06 1 routing_algorithms

10 | 48

Internet Workingrouting protocols

● In general: routing protocols are not IP specific● Routing protocols may be needed on different network layers● It depends on the type of underlying networking infrastructure and 

concept of connection● We can make some general assumptions on routing algorithms 

independently of the type of network● Within connection orientated networks like ATM infrastructure we 

find virtual channel switching– ATM packets follow a previous installed route

– Route is active during the whole session

Page 11: 06 1 routing_algorithms

11 | 48

Internet Workingrouting protocols

● IP – packet orientated network

– Routing decision is renewed for every packet (introduction to static IP routing last lecture)

– No state of previous routing decisions is kept (!)

● Static routing (manual setup) is acceptable in small networks● Routing setup for end systems often by DHCP (last lecture)● These mechanisms not suitable for routing on larger scale, e.g.

– Campus­wide inter LAN routing

– DFN­wide, inter­provider­routing, ...

Page 12: 06 1 routing_algorithms

12 | 48

Internet Workingrouting protocols

● Routing tables grow relatively fast, e.g. simple subnetting in university LAN of roughly 256 class­C subnets in 132.230.X.Y IP domain produces long tables in core routers– IP subnet aggregation is often impossible

– Routers may have several links

– Network should have redundant links ...

● Routing could be defined: Algorithms to establish routing table to make widely distributed endpoints appear to be directly connected

● So mechanisms for automated setup of router tables desired● Different routing protocols run on routers implement several 

routing algorithms 

Page 13: 06 1 routing_algorithms

13 | 48

Internet Workingrouting protocols – general considerations

● In general: forwarding is local made decision, requiring only next hop information

● But: computation of best route requires global information● This information is challenging:

– Hard to collect, often outdated, huge amounts of data

– No single network owner

● General needs for routing– Compute optimal paths for each destination (we need a 

definition of term “optimal”)

– Minimize control message exchanges

– Minimize routing table space

Page 14: 06 1 routing_algorithms

14 | 48

Internet Workingrouting protocols – pitfalls

● While considering automatic setup of routing tables some risks may show up

– Loops: should local forwarding information be inconsistent with global topology – it can form loops (black holes in which packets “disappear” ­ you may have observed this phenomenon with traceroute when a route oscillated between two routers ...)

– Oscillations: dynamically adapting to load can shift load, lead to congestion and repeat (often with paths of small bandwidth – consider two ISDN lines with heavy load ...)

● Normally these scenarios unusual under normal operation, often due to misconfiguration

Page 15: 06 1 routing_algorithms

15 | 48

Internet Workingrouting protocols – theory

● Routing itself (discussed with IP addressing) is part of the network layer and responsible for deciding which output line an incoming packet should take– Routing algorithms often implemented in applications run on 

top of the underlying IP network 

● For routing decisions hence every routing algorithm certain properties are desirable:– Correctness of routes

– Simplicity of protocol

– Robustness

– Stability

– Fairness and optimality

Page 16: 06 1 routing_algorithms

16 | 48

Internet Workingrouting protocols – theory

● Correctness and simplicity are obvious requirements● Robustness

– Once a major network is set up system wide failures and outages are not desired

– Should catch up with topology changes

– Cope with hardware failures

– Route changes (because of pricing changes, new infrastructure, expanding of the network, ...)

● ... that means, not all connected hosts shouldn't be affected

Page 17: 06 1 routing_algorithms

17 | 48

Internet Workingrouting – theory cont.

● Stability – Routing algorithms should converge towards equilibrium in a 

certain amount of time

● Fairness and optimality– Obvious but often contradictory goals

– See the following picture, if the six hosts 1,1' ; 2,2' ; 3,3' communicate with each other and saturate the link the communication of X,X' should be shut off completely ...

Page 18: 06 1 routing_algorithms

18 | 48

Internet Workingrouting – theory cont.

● Conflict between Fairness and optimality (depends of course on underlying network topology)

Page 19: 06 1 routing_algorithms

19 | 48

Internet Workingrouting protocols – theory

● Before decision on trade­off between the described problem could be done – we should see what we seek to optimize:– Maximum total network throughput could be one parameter

– Minimum mean packet delay is an other

● These two goals in conflict too: since operating any queuing system near limit implies long delays

● Many networks try to compromise with minimizing the number of hops (passing a routing engine) to take from source to destination

● Such the delay is reduced and the amount of bandwidth consumed minimized

Page 20: 06 1 routing_algorithms

20 | 48

Internet Workingrouting protocols – in packet networks

● Internet doesn't have very predictable traffic flow, may have unreliable links

● Routers are assumed to know– Address of each neighbor

– Cost of reaching each neighbor

● Choices for Internet routing– Centralized vs. distributed routing

– Source based vs. hop­by­hop

– Single or multipath

– Dynamic vs. static

Page 21: 06 1 routing_algorithms

21 | 48

Internet Workingrouting strategies – (non)adaptive routing

● Routing algorithms are grouped into two major classes● Nonadaptive RA do not base their routing decisions on 

(continuous) measurements or estimates of current bandwidth usage and topology– No need for specific measurement service run continuously or 

scheduled

● The routes to use are computed in advance, off­line and downloaded to routers when network is coming up

● That is the typical scenario for networked end systems – normally the system administrator provides the routes during machine setup

● Or the routing information is transferred via DHCP (centralized setup of networking resources)

Page 22: 06 1 routing_algorithms

22 | 48

Internet Workingadaptive routing

● Routing done that way often named static (type of routing discussed yet falls into that category)

● Adaptive algorithms change their routing decisions to reflect changes in traffic/bandwidth usage and topology

● Algorithms differ in where they get their information ...– Locally from own measurements or from adjacent routers

– Or (globally) from all routers

● ... and when changes are executed

– Every T seconds when network load changes

– Or changes in topology occur

– Or event driven ...

Page 23: 06 1 routing_algorithms

23 | 48

Internet Workingadaptive routing cont.

● Measure / function needed to represent certain values● Metric can be seen as a value for measuring routing costs● These costs could be

– Physical distance between two routers

– Number of hops packets travel from source to destination

– Estimated transit time

– Monetary costs (cheap satellite link vs. expensive sea cable for continental crossing or vice versa)

● Different routing algorithms (RA) use different metrics for their routing decisions

● Different metrics have different costs of computing them

Page 24: 06 1 routing_algorithms

24 | 48

Internet Workingrouting – optimality principle

● Before discussing specific RA one can state in general there is a optimal route without regarding network topology

● The optimality principle states: If router B is optimal path from router A to router C, then route from B to C falls to the same path (measured in hops)

Page 25: 06 1 routing_algorithms

25 | 48

Internet Workingrouting – optimality principle cont.

● Proving that name the part from A to B r1 and the rest of the route r2: If there is a better route r2 (e.g. the dotted line) it would be concatenated to r1 to improve the whole route, contradicting that r1r2 is optimal

● Consequence: Set of optimal routes from all sources to given destination form a tree rooted at destination

Page 26: 06 1 routing_algorithms

26 | 48

Internet Workingrouting – optimality principle cont.

● Example of a sink tree with hop count metric● Not necessarily unique – router 12 may connected over 3 with 

same hop count

Page 27: 06 1 routing_algorithms

27 | 48

Internet WorkingICMP – further messages

● Goal of all RA is to discover such trees for all routers of a given subnet

● Since sink tree is a tree it does not contain any loops, so packets should be delivered within a finite and bounded number of hops

● In practice operation of networks is not as easy:– Links may go down and recover after a while

– Different routers may have different ideas about topology

– It was not stated how routers acquire information for tree computing (itself, predefined, centrally, ...)

Page 28: 06 1 routing_algorithms

28 | 48

Internet Workingrouting algorithms – flooding

● A relative specific routing algorithm is flooding● Every incoming packet is sent out on every outgoing line except 

the one the packet was received from● Flooding obviously generates a vast number of packets, so 

measures should be taken to damp the process– Install a hop counter, so if packet hop counter reaches zero 

the packet is discarded

– Keep track of which packets have been flooded, use sequence number and discard duplicate packets

– Each router has to keep a list which packets have been seen from which source

Page 29: 06 1 routing_algorithms

29 | 48

Internet Workingflooding cont.

– To prevent of growing lists out of bound use a counter k, meaning that all packets up to k have been seen

– When packet comes in it is easy to check if it has already be seen

– List below k is not needed, because it summarizes all packets up to that number

● Flooding is not practical in most applications, because or the very suboptimal utilization of bandwidth and network capacity

● But it finds the most effective route in every case, because every route is checked (and the fastest packet arrives first)

Page 30: 06 1 routing_algorithms

30 | 48

Internet Workingrouting algorithms – flooding

● Mechanism could be found e.g. in unswitched ethernets with hubs connecting segments – very cheap and simple principle – no complicated logic has to 

be build into components – hubs in ethernets simply regenerate and amplify passing signals

– That principle renders unswitched ethernets unusable with more than a few end systems added (generating certain amount of traffic) 

● Another advantage – no/very simple routing tables have to be kept

● Flooding can be useful in special IP routing scenarios we will see later

Page 31: 06 1 routing_algorithms

31 | 48

Internet Workingrouting algorithms – routing mechanisms

● Distance vector & link state routing– Distributed algorithms

● Distance vector– Tell neighbors about distances to each destination

– Each nodes computation depends on its neighbors

● Link state– Tell all routers distance to each neighbor

– Each router computes its best paths

● Distance vector uses shortest path– Single adaptive cost of a link

Page 32: 06 1 routing_algorithms

32 | 48

Internet Workingshortest path routing

● Routing technique widely used, because it is simple and easy to understand

● Idea: Build a graph of the subnet with each node representing a router and each arc representing a link

● To choose a route between a given pair of nodes the algorithm just finds the shortest path on the graph

● You have to explain the metric used for shortest path measuring:– Hop count, physical distance, bandwidth, latency, 

communication costs, mean queue length, ...

Page 33: 06 1 routing_algorithms

33 | 48

Internet Workingshortest path routing

● Hop count metric has same length for path 1­2­5 and 1­2­3 (nodes are fat numbers, costs smaller numbers between nodes)

● Geographic distance is for 1­2­3 much longer then for 1­2­5 (assuming the graph is drawn in scale)

● For other metrics the weighting function may be computed through hourly test packets sent and computed

● Criteria for computation of metric may combined

Page 34: 06 1 routing_algorithms

34 | 48

Internet Workingshortest path routing cont.

● One algorithm for computing the shortest path is Dijkstras● Each node is labeled with its distance from source node along the 

best known path● Initially no paths are known (and labeled accordingly)● As algorithm proceeds and paths are discovered labels may 

change reflecting better paths

Page 35: 06 1 routing_algorithms

35 | 48

Internet Workingshortest path routing cont.

● The shortest path (sp) from 1 to 4 is searched for● We are using the geographic distance for computing the sp● Started from 1 marking it permanent (big dot), then examined the 

adjacent nodes to 1 (node 2 and 7)● Whenever a node is (re)labeled the source node we come from is 

filled in (distance, source node)

Page 36: 06 1 routing_algorithms

36 | 48

Internet Workingshortest path routing cont.

● When adjacent routes are examined the smallest distance is labeled permanent (node 2)

● In the next step the process is restarted from node 2 ● We have to take the sums of the route up to here in to account 

and we get node 5 (last picture)● Note: In next step node 7 has to be relabeled { (6,1) ­> (5,5) }

Page 37: 06 1 routing_algorithms

37 | 48

Internet Workingshortest path routing cont.

● Path with 3 hops to 7 has lesser costs than direct with 1 hop● Next step shows that from node 7 the metric to 8 is higher than 

from node 5 over 6 to 8● Node 8 has to be relabeled then (see next slide)

Page 38: 06 1 routing_algorithms

38 | 48

Internet Workingshortest path routing cont.

● Step shows that from node 7 the metric to 8 is higher than from node 5 over 6 to 8 (node 8 has to be relabeled)

● There is a more optimal route to node 8– 1 – 2 – 5 – 7 – 8 (4 hops with cost of 9)

– 1 – 2 – 5 – 6 – 8 (4 hops with cost of 8)

Page 39: 06 1 routing_algorithms

39 | 48

Internet Workingshortest path routing cont.

● For getting the path we start from the destination and get the predecessor from the labels

● In the end we get a route 1 – 2 – 5 – 6 – 8 – 4● Remember: route optimal in “costs” not in hops

– Simple hop count routing would prefer 1 – 2 – 3 – 4  (cost of 12) or 1 – 7 – 8 – 4  (same cost) – 2 points higher than route named above

Page 40: 06 1 routing_algorithms

40 | 48

Internet Workingdistance vector routing

● For distance vector routing each router maintains a table (called a vector for a given destination – computed with shortest path) delivering the best known distance to each destination

● This tables are updated by regularly exchanging information with neighbors

● Other name of this algorithm is distributed Bellmann­Ford or Ford­Fulkerson

● In distance vector routing each router maintains a routing table containing the pair of each router of the (sub)net and the destination to it

● Entry contains information on outgoing line and the estimate of time, distance to destination

Page 41: 06 1 routing_algorithms

41 | 48

Internet Workingdistance vector routing cont.

● The metric might be one of the types we named earlier● Every router should know the distance to its neighbors, with hop 

count (typically used with RIP – explained next lecture in greater detail) it is just one hop

● Queue length as metric might be computed through simply checking each outgoing line

● For delay the router might ping each neighbor with special ECHO packets and compute the round trip time

● For setting up of the tables each router sends a packet with the list of distances to each router in the (sub)net

● Every router receives such packets and uses them for computing of an updated table

Page 42: 06 1 routing_algorithms

42 | 48

Internet Workingdistance vector routing cont.

● Each destination might be reachable on different paths, but the router takes the shortest distance from all packets and removes the other information to the same destination

● Such the router computes information on which line which router is reachable

● This mechanism works quite well in theory, but has some drawbacks too ...

Page 43: 06 1 routing_algorithms

43 | 48

Internet Workingcount­to­infinity problem

● Although distant vector converges to the correct answer it may doing it very slowly

● It reacts fast to positive news but leisurely to bad ones● To see how fast good news propagates see the next simple 

example (five routers on a linear subnet, hops to 1 shown)

Page 44: 06 1 routing_algorithms

44 | 48

Internet Workingcount­to­infinity problem

● With 1 down initially no router knows a path to it (in routing terms: infinite route)

● With 1 coming up ­ at the first exchange (for simplicity: all routing information is exchanged at exact the same moment) 2 gets the good news that 1 has a route of “0” to 1

● 2 adds this information to its table● In the next round of exchange 2 tells 3 that it knows a route with 

hop count “1” to 1, 3 learns that and adds the metric “2” for the route to 1

● Nexts steps are accordingly – process ends after the 4th round

Page 45: 06 1 routing_algorithms

45 | 48

Internet Workingcount­to­infinity problem

● Now compute the routes for the opposite scenario (router 1 is going down for some reason)

Page 46: 06 1 routing_algorithms

46 | 48

Internet Workingcount­to­infinity problem

● All lines where initially up, but 1 failed● The first round of packet exchange 2 hears nothing from 1, but 3 

says “no worry, I know a route to 1”● Hence 2 updates its table to the hop count of “3” for path to 1● 2 does not know that 3s route runs through itself● With second exchange router 3 has two entries for 1 with the 

same metric of “3”, therefore picks one at random and updates its table to a hop count of “4”

● Problem: No one router has a hop count greater than the minimum of all neighbors, gradually they walk up to inifinty

Page 47: 06 1 routing_algorithms

47 | 48

Internet Workingcount­to­infinity problem

● When router 1 is set “unreachable” depends on the value for infinity

● Therefor the value for infinity should set to the maximum diameter of the network plus “1”

● But even in moderate sized networks the exchanges needed for setting a router “unreachable” may regarded as to much

● If the metric is a time delay then the upper bound of the inifinity value should be set reasonable high, else simple problems within the network (congestions of a short moment, delays in queues, ...) could bring routers out of range

● One of many suggested solutions (no one solved the problem) is the “Split­Horizon­Hack” (introduced next lecture!)

Page 48: 06 1 routing_algorithms

48 | 48

Internet Workingrouting: literature list

Routing Theory● Tanenbaum: Computer Networks, 4th edition: Section 5.2 Routing Algorithms, Section 

5.2.1 The Optimality Principle

Flooding::● Tanenbaum: Computer Networks, 4th edition: Section 5.2.3 Flooding

Shortest Path Routing● Tanenbaum: Computer Networks, 4th edition: Section 5.2.2 Shorest Path Routing

Distance Vector Routing● Tanenbaum: Computer Networks, 4th edition: Section 5.2.4 Distance Vector Routing

Count­to­Infinity Problem● Tanenbaum: Computer Networks, 4th edition: Section 5.2.4 Distance Vector Routing, The 

Count­to­Infinity Problem

Routing Algorithms● Kurose & Ross: Computer Networking, 3rd edition: Section 4.5 Routing Algorithms