1
RoutingUnicast routing protocols
Jens A AnderssonElectrical and Information
Technology
Choosing an Optimal Path
R55
A
R1
R2
R4
R3
R6
R7
R8
B
5
4010
2010
4 10
10
55
6
15
2
Router
• A router is a type of internetworking device that passes data packets between networks, based on Layer 3 or Network Layer addresses.
• A router has the ability to make intelligent decisions regarding the best path for delivery of data on the network.
Figure 21.1 Unicasting
Packet Switched Routing
3
VPN, VPC
• Virtual Private Network• Virtual Path Connection
• Build a virtual and private network overlaying a public network
• Often by tunnelling (encapsulation of packets inside packets)
• Often encrypted
Figure 8.1 Circuit-switched network
Circuit-switched routing
4
Local Routing
routerNetid: 192.168.1.0/24
.1
.105 .10
8
ARP (1)
5
9
ARP (2)
Reminder
• Routing performed on net ids• One net id per link/subnet! (at least)• (What if links/subnets without net ids?)
6
Technology of Distributed Routing
• Topology information is flooded within the routing domain
• Best end-to-end paths are computed locally at each router.
• Best end-to-end paths determine next-hops.
• Based on minimizing some notion of distance
• Works only if policy is shared and uniform
• Examples: OSPF, IS-IS
• Each router knows little about network topology
• Only best next-hops are chosen by each router for each destination network.
• Best end-to-end paths result from composition of all next-hop choices
• Does not require any notion of distance
• Does not require uniform policies at all routers
• Examples: RIP, BGP
Link StateDistance Vector
Routing Tables and Forwarding Table
Forwarding Table
OSPFDomain
RIPDomain
BGP
OS kernel
OSPF Process
OSPF Routing tables
RIP Process
RIP Routing tables
BGP Process
BGP Routing tables
Forwarding Table Manager
Static routing table
7
The Link Metric
• Possible metrics– hop count– inverse of the link bandwidth– delay– dynamically calculated – administratively assigned– combination
• Traffic should be monitored and metrics adjusted
Figure 21.2 Popular routing protocols
Routing Protocols
8
Figure 21-18The Concept of Distance
Vector Routing
Table 21.1 A distance vector routing table
Destination Hop Count
Next Router Other information
163.5.0.0 7 172.6.23.4
197.5.13.0 5 176.3.6.17
189.45.0.0 4 200.5.1.6
115.0.0.0 6 131.4.7.19
Distance Vector Routing Table
Network id Host id of interfaceMetric
9
RIP ( Routing Information Protocol)
• Distance vector algorithm• Included in BSD-UNIX Distribution in 1982• Distance metric: # of hops (max = 15 hops)
– Can you guess why there is a max?
• Distance vectors: exchanged among neighbours every 30 sec via Response Message (also called advertisement)
• Each advertisement: list of up to 25 destination nets within AS
RIP Updating Algorithm(1) if (advertised destination not in table) then
update table(2) else(2.a) if (advertised next-hop = next-hop in table) then
replace entry(2.b) else(2.b.i) if (advertised hop count < hop count in table) then
replace entry(2.b.ii) else
do nothing
10
Figure 21-23
Example 21.1
RIP: Link Failure and RecoveryIf no advertisement heard after 180 sec -->
neighbour/link declared dead– routes via neighbour invalidated– new advertisements sent to neighbours– neighbours in turn send out new advertisements (if
tables changed)– link failure info quickly propagates to entire net– split horizon and poison reverse used to prevent
ping-pong loops (infinite distance = 16 hops)
11
The Count to Infinity Problem
I can reach A at cost 1A I can reach
A at cost 2I can reach A at cost 3
I can reach A at cost 3
I don’t know A, so I will not tellA
I can reach A at cost 5A I can reach
A at cost 3
I can reach A at cost 2
I can reach A at cost 4
The Count to Infinity Problem (cont)
I can reach A at cost 6
I can reach A at cost 7A I can reach
A at cost 5
I can reach A at cost 8
I can reach A at cost 9A I can reach
A at cost 7
12
Split Horizon
A I can’t reach A
1 2 3
I can reach A at cost 2 but I won’t tell 1
A
1 2 3
I can’t reach A
I can’t reach A
A I can reach A at cost 2 but I won’t tell 1
1 2 3
I can reach A at cost 1
Split Horizon withPoison Reverse
A
I can reach A at cost 2 but I tell 1 I can’t. Tells
1 that info about A came from 1.
1 2 3
I can reach A at cost 1
13
Unsolved routing-loop
C B A
I tell D I can reach
C at cost 2,But I’ll tell
B that I can’t!
I can reach C at cost 1
DI tell A I can
reachC at cost 2,But I’ll tell
B that I can’t!
Figure 21-24
Concept of Link State Routing
14
Figure 21-28
Link State Database
The Dijkstra Algorithm
1. Identify the root (the node itself)2. Attach all neighbour nodes temporarily3. Make arc and node with least cumulative
cost permanent4. Choose this node5. Repeat 2 and 3 until all nodes are
permanent
15
Table 21.2 Link state routing table for router A
Network Cost Next Router Other Information
N1 5 C
N2 7 D
N3 10 B
N4 11 D
N5 15 C
Link State Routing Table
Network id Host id of interfaceMetric
Figure 21.7 Areas in an autonomous system
OSPF hierarchy
16
Figure 21.8 Types of links
Types of Links
Figure 21.9 Point-to-point link
Point-to-Point Link
17
Figure 21.10 Transient link
Transient Link
Figure 21.11 Stub link
Stub Link
18
Figure 21.14 Types of LSAs
Types of LSAs
Figure 21.15 Router link
Router Link
19
Figure 21.16 Network link
Network Links
Figure 21.17 Summary link to network
Summary Link to Network
20
Figure 21.18 Summary link to AS boundary router
Summary link to AS boundary router
Figure 21.19 External link
External Link
21
Comparison of LS and DV algorithms
Message complexity• LS: with n nodes, E links, O(nE)
msgs for full knowledge, changessent to all nodes
• DV: exchange - periodically or triggered - between neighbours only
Speed of Convergence• LS: O(n2) algorithm requires
O(nE) msgs– may have oscillations
• DV: convergence time varies– may be routing loops– count-to-infinity problem
Robustness: what happens if router malfunctions?
LS:– node can advertise incorrect
link cost for its “own” links– node can break broadcast path
or change broadcasted info– each node computes only its
own tableDV:
– DV node can advertise incorrect path cost to any path
– each node’s table used by others
• error propagate thru network
Flooding
• Routing without routing information• Forward each packet to all ports except
incoming port• Detect and remove looping packets• Very robust• This is not broadcast
22
Source Address routing
• Route according to source address?!• Example:
– Customers share subnet (different ISPs; unlikely)
– Customers have different traffic policies
Internet AS HierarchyIntra-AS border (exterior gateway) routers
Inter-AS interior (gateway) routers
23
Hierarchical Routing
• aggregate routers into regions, “autonomous systems” (AS)
• routers in same AS run same routing protocol– “intra-AS” routing
protocol– routers in different AS
can run different intra-AS routing protocol
• special routers in AS• run intra-AS routing
protocol with all other routers in AS
• also responsible for routing to destinations outside AS– run inter-AS routing
protocol with other gateway routers
gateway routers
Why different Intra- and Inter-AS routing ?
Policy:• Inter-AS: admin wants control over how its traffic
routed, who routes through its net. • Intra-AS: single admin, so no policy decisions neededScale:• hierarchical routing saves table size, reduced update
trafficPerformance:• Intra-AS: can focus on performance• Inter-AS: policy may dominate over performance
24
Internet inter-AS routing: BGP
• BGP (Border Gateway Protocol): the de facto standard• Path Vector protocol:
– similar to Distance Vector protocol– each Border Gateway broadcast to neighbors (peers)
entire path (i.e., sequence of AS’s) to destination– BGP routes to networks (ASs), not individual hosts– E.g., Gateway X may send its path to dest. Z:
Path (X,Z) = X,Y1,Y2,Y3,…,Z
Figure 21.21 Path vector messages
Path Vector Messages
25
Table 21.3 Path vector routing table
Network Next Router Path
N01 R01 AS14, AS23, AS67
N02 R05 AS22, AS67, AS05, AS89
N03 R06 AS67, AS89, AS09, AS34
N04 R12 AS62, AS02, AS09
Path Vector Routing Table
AS = Autonomous System = Organisation
BGP operation
Q: What does a BGP router do?• Receiving and filtering route advertisements from
directly attached neighbor(s). • Route selection.
– To route to destination X, which path (of several advertised) will be taken?
• Sending route advertisements to neighbors.
26
51
BGP Operations (Simplified)
Establish session onTCP port 179
Exchange allactive routes
Exchange incrementalupdates
AS1
AS2
While connection is ALIVE exchangeroute UPDATE messages
BGP session
52
BGP Route Processing
Best RouteSelection
Apply ImportPolicies
Best Route Table
Apply ExportPolicies
Install forwardingEntries for bestRoutes.
ReceiveBGPUpdates
BestRoutes
TransmitBGP Updates
Apply Policy =filter routes & tweak attributes
Based onAttributeValues
IP Forwarding Table
Apply Policy =filter routes & tweak attributes
Open ended programming.Constrained only by vendor configuration language
27
Tweak Tweak Tweak
• For inbound traffic– Filter outbound routes– Tweak attributes on
outbound routes in the hope of influencing your neighbor’s best route selection
• For outbound traffic– Filter inbound routes– Tweak attributes on
inbound routes to influence best route selection
outboundroutes
inboundroutes
inboundtraffic
outboundtraffic
In general, an AS has morecontrol over outbound traffic
BGP messages• BGP messages exchanged using TCP.• BGP messages:
– OPEN: opens TCP connection to peer and authenticates sender
– UPDATE: advertises new path (or withdraws old)– KEEPALIVE keeps connection alive in absence of
UPDATES; also ACKs OPEN request– NOTIFICATION: reports errors in previous msg;
also used to close connection
28
BGP AttributesValue Code Reference----- --------------------------------- ---------
1 ORIGIN [RFC1771]2 AS_PATH [RFC1771]3 NEXT_HOP [RFC1771]4 MULTI_EXIT_DISC [RFC1771]5 LOCAL_PREF [RFC1771]6 ATOMIC_AGGREGATE [RFC1771]7 AGGREGATOR [RFC1771]8 COMMUNITY [RFC1997]9 ORIGINATOR_ID [RFC2796]
10 CLUSTER_LIST [RFC2796]11 DPA [Chen]12 ADVERTISER [RFC1863]13 RCID_PATH / CLUSTER_ID [RFC1863]14 MP_REACH_NLRI [RFC2283] 15 MP_UNREACH_NLRI [RFC2283] 16 EXTENDED COMMUNITIES [Rosen]
...255 reserved for development
From IANA: http://www.iana.org/assignments/bgp-parametersNot all attributesneed to be present inevery announcement
Route Selection Summary
Highest Local Preference
Shortest ASPATH
Lowest MED
i-BGP < e-BGP
Lowest IGP cost to BGP egress
Lowest router ID
traffic engineering
Enforce relationships
Throw up hands andbreak ties
29
57
Hot Potato Routing: Go for the Closest Egress Point
192.44.78.0/24
15 56 IGP distances
egress 1 egress 2
This Router has two BGP routes to 192.44.78.0/24.
Hot potato: get traffic off of your network as Soon as possible. Go for egress 1!
Hot Potato Routing
• Also:
Routing without queuing
30
Customer-Provider Hierarchy
IP trafficprovider customer
Address aggregation!•Local•Nation•Global
Geographical
Deaggregation Due to Multihoming
AS 1
customerAS 2
provider
12.0.0.0/8
AS 3provider
12.2.0.0/1612.2.0.0/16
12.2.0.0/16
If AS 1 doesnot announce themore specific prefix,then most traffic to AS 2 will go through AS 3 because it is a longer match
AS 2 is “punching a hole” inThe CIDR block of AS 1
31
Scarry?
• BGP is not guaranteed to converge on a stable routing. Policy interactions could lead to “livelock” protocol oscillations. See “Persistent Route Oscillations in Inter-domain Routing” by K. Varadhan, R. Govindan, and D. Estrin. ISI report, 1996
• Corollary: BGP is not guaranteed to recover from network failures.
Is There A Problem?packet switching
routing
interdomain routing
Border Gateway Protocol v4
Single Point of failure!
32
Figure 19.25 NAT
19.64
Figure 19.12 NAT address translation
Alternative: External Source Address 200.24.5.8 goes here
33
19.65
Table 19.4 Five-column translation table
Alternative: External source address 200.24.5.8 goes here
Alternative: External source port goes here