Chapter 2 - Introduction To Routing - Part 2

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 80

Textbook Chapter 5

Network Layer:
Control Plane
A note on the use of these PowerPoint slides:
We’re making these slides freely available to all (faculty, students,
readers). They’re in PowerPoint form so you see the animations; and
can add, modify, and delete slides (including this one) and slide content
to suit your needs. They obviously represent a lot of work on our part.
In return for use, we only ask the following:
 If you use these slides (e.g., in a class) that you mention their source
(after all, we’d like people to use our book!)
 If you post any slides on a www site, that you note that they are
adapted from (or perhaps identical to) our slides, and note our
copyright of this material.
Computer Networking: A
For a revision history, see the slide note for this page.
Top-Down Approach
Thanks and enjoy! JFK/KWR 8th edition
Jim Kurose, Keith Ross
All material copyright 1996-2020
J.F Kurose and K.W. Ross, All Rights Reserved Pearson, 2020
NET-351 Chapter 2: Introduction to
Routing
 Goal: Understand how data packets are
routed in an IP network
 Roadmap:
• Introduction
• Terminology
• Routing protocols
• Classification • Intra-ISP routing: OSPF
• Static vs. dynamic • Routing among ISPs: BGP
• Global vs. decentralized
• Hierarchical
• Algorithms’ execution / filling routing table Network Layer: 5-2
Introduction: Network-layer functions
 forwarding: move packets from router’s
input to appropriate router output data plane
 routing: determine route taken by
packets from source to destination
control plane

Two approaches to structuring network control plane:


 per-router control (traditional)
 logically centralized control (software defined networking)

Network Layer: 5-3


Per-router control plane
Individual routing algorithm components in each and every
router interact in the control plane

Routing
Algorithm
control
plane

data
plane

values in arriving
packet header
0111 1
2
3

Network Layer: 5-4


Introduction
 A layer 3 network uses IP addressing for
routing data packets to the final
destination

 Data packet delivery is achieved by


handing off the data to adjacent routers
until the data reaches its final
destination.

 Data packets delivery is made possible


by the use of a destination MAC address,
IP address, network addresses, and
routing tables
Terminology

 Default gateway vs. gateway of last resort


 Routing algorithm & best path
 Routing vs. Forwarding
 Routing table
 Next hop
Terminology: default gateway vs. gateway of last
resort
 Default gateway: is where to send data packets that need
to exit the LAN (as destination IP is in different domain)
• is typically a router interface on that LAN (also called the first-hop
router)
 Gateway of last resort: is the IP address of the router interface in
your network where data packets with unknown IP routes should
be forwarded.

• defined in the default route

PCs default gateway  src. default router: source router


 dst. default router: destination router
Terminology: routing algorithm & best path
 Routing algorithm: finds the best path from source router to
destination router
• Typically, the best path is one that has the least cost
• In practice, real-world concerns are considered
e.g., A “router y, belonging to organization Y, should not forward any
packets originating from the network owned by Y to the network owned by
the organization Z”

Organization Z
4c
networks
4a
3c 4b X
3a AS4
3b
2c
AS3 1c 2a
destination
Organization Y networks
networks 1a 2b
1b
1d AS2
AS1
Terminology: Routing vs. forwarding
Analogy: Routing: determines source-
 Routing: process of planning trip destination route taken by packets
from source to destination  Use routing algorithms to determines
 Forwarding: process of getting end-end-path through network
 network-wide process
through single interchange

Forwarding: moves
packets from router’s
input to appropriate
router output
 use forwarding table to
determine local
forwarding at this
router
 router-local action
Terminology: routing table & next hop
 A routing table is a list of the possible networks that can be
used to route the data packets.
• Each routing table entry describes a route to reach a specific network
(set of networks)
• Alternate data paths (or alternate routes) are usually provided so that
a new route can be selected and data delivery maintained even if a
network route is down.
• When a router receives a packet, it examines the destination IP
address of the packet and selects the next hop using routing table

R1: Simplified routing table (the


NET-A NET-B actual content is IP addresses)
iR32 Destination Next Cost
iR11 iR21 iR22 network hop
R1 R2 R3
NET-B iR21 ..
iR12 iR41
NET-C iR41 ..
R4 NET-C
Example: CISCO Routing Table
Routing algorithm classification
Static vs. Dynamic Global vs. Decentralized
Static: Global: (Analogy: GPS)
routes are manually  all routers have a view of the
configured (routes change complete topology of the network
slowly over time) (they have complete topology, link cost info)

Dynamic:
 “link state” algorithms
routes are calculated Decentralized: (Analogy: Street signs)
dynamically. They change  router knows physically-connected
more quickly neighbors, link costs to neighbors
 periodic update
 iterative process of computation,
 in response to events (e.g.
exchange of info with neighbors
link cost change, topology
change)  “distance vector” algorithms
Static Routing
 A static route is a data traffic route that has been manually
entered into either a router’s routing table or computer’s
routing table.

 A static route is specified in a PC computer in terms of the


computer’s default gateway

 Routers sometimes use static routes when specifying where


the network data traffic is to be forwarded.
• One of the most important applications for using a static route (on a
router) is for configuring the default route or the gateway of last resort.
Example
1) Is Router A default
gateway for LAN-A?

2) Route from Router-A to


go to LAN-B?

3) Gateway of last resort


for Router-A?

B1 C1 D1
B2 C2 12
D
Example
1) LAN A default gateway?
• Answer: 10.10.20.250

PC A1 MAC A1 2-15
Destination network Next hop

Example 2) 10.10.10.0 10.10.200.2

0.0.0.0 10.10.200.2
3)

2) Route from Router-A to go to LAN-B?


• Configure next hop from Router-A; i.e. 10.10.200.2 (Router-B
FA0/2)
• Command syntax: route destination subnet mask next hop
• Configuration command :
ip route 10.10.10.0 255.255.255.0 10.10.200.2
LAN-B Router B – FA0/2

3) Gateway of last resort for Router-A? (Router-B FA0/2)


• Command syntax: ip route 0.0.0.0 0.0.0.0 <next hop address>
• Configuration command: ip route 0.0.0.0 0.0.0.0 10.10.200.2
Static Routing
 Manual configuration is time consuming & error prone
• The time required for entering and maintaining the routes is a problem.
• Manual configuration can lead to human errors in typing IP’s or using
commands.
• Hence, the reason a static routing protocol is of limited use in large
networks. However, static routes are used in situations such as
configuring small networks with few routes.

 Usage limited to
1. Small networks
2. Stub networks
3. Special/specific configurations
o e.g. gateway of last resort, route to a given network, back up route/floating route)
Routing protocols mobile network
national or global ISP
Routing protocol goal: determine “good”
paths (equivalently, routes), from sending
hosts to receiving host, through network of application
transport
network
routers link
physical

 path: sequence of routers packets


network network
link link
physical physical

traverse from given initial source host to


final destination host network
link
physical
network
link
physical network

 “good”: least “cost”, “fastest”, “least link


physical
datacenter
network

congested”
application
 routing: a “top-10” networking challenge! transport
network
enterprise link
network physical

Network Layer: 5-18


Graph abstraction: link
costs
5
ca,b: cost of direct link connecting a and b
3
v w 5 e.g., cw,z = 5, cu,z = ∞
2
u 2 1 z
3
1 cost defined by network operator:
2
x 1
y could always be 1, or inversely related
to bandwidth, or inversely related to
congestion
graph: G = (N,E)
N: set of routers = { u, v, w, x, y, z }
E: set of links ={ (u,v), (u,x), (v,x), (v,w), (x,w), (x,y), (w,y), (w,z), (y,z) }

Network Layer: 5-19


Key concepts: Metrics
Metric : is a measure assigned to routes for ranking the routes best to
worst, the smaller the number, the better is the route.
Examples:
 Hop count – the number of routers the data packet must pass through to
reach the destination network
 Bandwidth – having to do with the data capacity of the networking link
• A fast Ethernet 100 Mbps link has greater data capacity than a 10 Mbps Ethernet link.

 Delay – the time it takes for a data packet to travel from a source to
destination
 Load - having to do with the network activity on a link or router.
 Reliability – a measure of the reliability of the link typically in terms of the
amount of errors.
 Cost – this is a value typically assigned by the network administrator that
takes into account bandwidth and expense.
Routing algorithm classification
global: all routers have complete
topology, link cost info
• “link state” algorithms
How fast
dynamic: routes change
do routes static: routes change more quickly
change? slowly over time • periodic updates or in
response to link cost
changes
decentralized: iterative process of
computation, exchange of info with neighbors
• routers initially only know link costs to
attached neighbors
• “distance vector” algorithms
global or decentralized information? Network Layer: 5-21
Dijkstra’s link-state routing algorithm
 centralized: network topology, link notation
costs known to all nodes
• accomplished via “link state
 cx,y: direct link cost from node
broadcast” x to y; = ∞ if not direct
neighbors
• all nodes have same info
 D(v): current estimate of cost
 computes least cost paths from one of least-cost-path from source
node (“source”) to all other nodes to destination v
• gives forwarding table for that node  p(v): predecessor node along
path from source to v
 iterative: after k iterations, know
least cost path to k destinations  N': set of nodes whose least-
cost-path definitively known

Network Layer: 5-22


Link State Routing Protocols: steps
Each router must do the following:
(1) Discover its neighbors, learn their network
addresses
get the
entire (2) Measure the link cost (the delay or bandwidth
topology to cost to each of its neighbors)
each node
(3) Construct the LS packet; telling all what it has
just learned (include neighbors only)
(4) Send this packet to all other routers

algorithm (5) Compute the best path to every other router


execution (using LS algorithm) and fill the routing table
Link State (LS) Packets

Example

(a) Given network (b) The link state packets for this network
Dijkstra’s link-state routing algorithm
1 Initialization:
2 N' = {u} /* compute least cost path from u to all other nodes */
3 for all nodes v
4 if v adjacent to u /* u initially knows direct-path-cost only to direct neighbors */
5 then D(v) = cu,v /* but may not be minimum cost! */
6 else D(v) = ∞
7
8 Loop
9 find w not in N' such that D(w) is a minimum
10 add w to N'
11 update D(v) for all v adjacent to w and not in N' :
12 D(v) = min ( D(v), D(w) + cw,v )
13 /* new least-path-cost to v is either old least-cost-path to v or known
14 least-cost-path to w plus direct-cost from w to v */
15 until all nodes in N'
Network Layer: 5-25
Dijkstra’s algorithm: an example
v w x y z
Step N' D(v),p(v) D(w),p(w) D(x),p(x) D(y),p(y) D(z),p(z)
0 u 2,u 5,u 1,u ∞ ∞
1 ux 2,u 4,x 2,x ∞
2 uxy 2,u 3,y 4,y
3 uxyv 3,y 4,y
4 uxyvw 4,y
5 uxyvwz
Initialization (step 0): For all a: if a adjacent to then D(a) = cu,a
5
3 find a not in N' such that D(a) is a minimum
v w 5 add a to N'
2
u 2 1 z update D(b) for all b adjacent to a and not in N' :
3 D(b) = min ( D(b), D(a) + ca,b )
1 2
x 1
y

Network Layer: 5-26


Dijkstra’s algorithm: an example
5
3
v w 5
2
u 2 1 z
3
1 2
x 1
y

resulting least-cost-path tree from u: resulting forwarding table in u:


destination outgoing link
v w
v (u,v) route from u to v directly
u z x (u,x)
y (u,x) route from u to all
x y w (u,x) other destinations
x (u,x) via x
Network Layer: 5-27
Dijkstra’s algorithm: another example
v w x y z
D(v), D(w), D(x), D(y), D(z), x
9
Step N' p(v) p(w) p(x) p(y) p(z)

0 u 7,u 3,u 5,u ∞ ∞ 5 7


4
1 uw 6,w 5,u 11,w ∞ 8
2 uwx 6,w 11,w 14,x 3 w z
u y
2
3 uwxv 10,v 14,x
3
4 uwxvy 12,y 7 4

5 uwxvyz v

notes:
 construct least-cost-path tree by tracing predecessor nodes
 ties can exist (can be broken arbitrarily)
Network Layer: 5-28
Exercise Use Dijkstra algorithm to find the best path
from home to each of the destinations (fill a trips
[routing] table, showing for each destination the distance
and next hop)

Garden

12 Domino’s Pizza
School 2
7 1
2
Home 1 5
1 Pharmacy
3 9 2
3

Mosque 10
Cinema
2-29
Dijkstra’s algorithm: discussion
algorithm complexity: n nodes
 each of n iteration: need to check all nodes, w, not in N
 n(n+1)/2 comparisons: O(n2) complexity
 more efficient implementations possible: O(nlogn)
message complexity:
 each router must broadcast its link state information to other n routers
 efficient (and interesting!) broadcast algorithms: O(n) link crossings to disseminate a
broadcast message from one source
 each router’s message crosses O(n) links: overall message complexity: O(n2)

Network Layer: 5-30


Dijkstra’s algorithm: oscillations possible
 when link costs depend on traffic volume, route oscillations possible
 sample scenario:
• routing to destination a, traffic entering at d, c, e with rates 1, e (<1), 1
• link costs are directional, and volume-dependent

a 2+e
a 0
a 2+e a
1 1+e 0 2+e 0
d b d 1+e 1 b d 0 0 b d 1+e 1 b
0 0
e 1 0 1
1 0
c 0 1 1
c 1+e 1 1 0 0 1
c 1 c
e e e
e
given these costs, given these costs, given these costs,
initially find new routing…. find new routing…. find new routing….
resulting in new costs resulting in new costs resulting in new costs

Network Layer: 5-31


Distance Vector (DV) : What do we mean by DV?

 DV  Distance Vector
 Distance: Cost
 Vector: Direction to neighbor (Next Hop)

 Compare with Street Signs Analogy!


Distance Vector Protocols: steps
Each router must do the following:
(1) Discover its neighbors, learn their network
addresses
share local (2) Measure the delay or cost to each of its
DV with
neighbors
neighbors
(3) Construct a DV packet (include all routers)
(4) Send this packet only to neighbors
algorithm
execution (5) Compute the best path to every other router
(using DV algorithm) and fill the routing table
Distance vector algorithm
Based on Bellman-Ford (BF) equation (dynamic programming):
Bellman-Ford equation

Let Dx(y): cost of least-cost path from x to y.


Then:
Dx(y) = minv { cx,v + Dv(y) }

v’s estimated least-cost-path cost to y


min taken over all neighbors v of x direct cost of link from x to v
Network Layer: 5-34
Bellman-Ford Example
Suppose that u’s neighboring nodes, x,v,w, know that for destination z:
Dv(z) = 5 Dw(z) = 3 Bellman-Ford equation says:
5
Du(z) = min { cu,v + Dv(z),
3 w
v 5 cu,x + Dx(z),
2
u 2 1 z cu,w + Dw(z) }
3
1 2
= min {2 + 5,
x 1
y 1 + 3,
5 + 3} = 4
Dx(z) = 3
node achieving minimum (x) is
next hop on estimated least-
cost path to destination (z)
Network Layer: 5-35
Distance vector algorithm
key idea:
 from time-to-time, each node sends its own distance vector estimate to
neighbors
 when x receives new DV estimate from any neighbor, it updates its
own DV using B-F equation:
Dx(y) ← minv{cx,v + Dv(y)} for each node y ∊ N

 under minor, natural conditions, the estimate Dx(y) converge to the


actual least cost dx(y)

Network Layer: 5-36


Distance vector algorithm:
each node: iterative, asynchronous: each local
iteration caused by:
wait for (change in local link  local link cost change
cost or msg from neighbor)  DV update message from neighbor

distributed, self-stopping: each


recompute DV estimates using node notifies neighbors only when
DV received from neighbor its DV changes
 neighbors then notify their
if DV to any destination has neighbors – only if necessary
changed, notify neighbors  no notification received, no
actions taken!

Network Layer: 5-37


Distance Vector Routing: Example 1

(a) Given network Topology. (b) Input from A, I, H, K, and


the new routing table for J.
Distance vector: Example 2
cost to cost to
Dx() x y z x y z
x 0 2 7 x 0 2 3

from
y ∞∞ ∞ y 2 0 1
from

Dx(z) = min{cx,y+ Dy(z), cx,z+ Dz(z)}


z ∞∞ ∞ z 7 1 0
= min{2+1 , 7+0} = 3
cost to y
Dy() x y z
Dx(y) = min{cx,y + Dy(y), cx,z+ Dz(y)}
2 1
x ∞ ∞ ∞ = min{2+0 , 7+1} = 2
x z
7
y 2 0 1
from

z ∞∞ ∞

cost to
Dz() x y z
x ∞∞ ∞
from

y ∞∞ ∞
z 7 1 0
time Network Layer: 5-39
Distance vector: Example 2 |(cont’d)
cost to cost to cost to
Dx() x y z x y z x y z
x 0 2 7 x 0 2 3 x 0 2 3

from
y ∞∞ ∞ y 2 0 1
from

y 2 0 1

from
z ∞∞ ∞ z 7 1 0 z 3 1 0

cost to cost to cost to y


Dy() x y z x y z x y z 2 1
x ∞ ∞ ∞ x 0 2 7 x 0 2 3
x z
7
y 2 0 1 y 2 0 1
from

from
y 2 0 1

from
z ∞∞ ∞ z 7 1 0 z 3 1 0

cost to cost to cost to


Dz() x y z x y z x y z

x ∞∞ ∞ x 0 2 7 x 0 2 3
from

y 2 0 1 y 2 0 1
from
from

y ∞∞ ∞
z 7 1 0 z 3 1 0 z 3 1 0
time Network Layer: 5-40
Distance vector: Example 3
DV in a:
Da(a)=0
Da(b) = 8
Da(c) = ∞ a b c
8 1
Da(d) = 1

t=0 Da(e) = ∞
Da(f) = ∞ 1 1
Da(g) = ∞
 All nodes have
Da(h) = ∞
distance estimates
Da(i) = ∞ A few asymmetries:
to nearest d e f  missing link
neighbors (only) 1 1
 larger cost
 All nodes send
their local
distance vector to 1 1 1
their neighbors

g h i
1 1

Network Layer: 5-41


Distance vector example 3: iteration

a b c
8 1

t=1 1 1
All nodes:
 receive distance
vectors from
neighbors d e f
 compute their new 1 1
local distance
vector
 send their new 1 1 1
local distance
vector to neighbors

g h i
1 1

Network Layer: 5-42


Distance vector example 3: iteration

a
compute compute
b compute
c
8 1

t=1 1 1
All nodes:
 receive distance
vectors from
neighbors d
compute e
compute compute
f
 compute their new 1 1
local distance
vector
 send their new 1 1 1
local distance
vector to neighbors

g
compute h
compute i
compute
1 1

Network Layer: 5-43


Distance vector example 3: iteration

a b c
8 1

t=1 1 1
All nodes:
 receive distance
vectors from
neighbors d e f
 compute their new 1 1
local distance
vector
 send their new 1 1 1
local distance
vector to neighbors

g h i
1 1

Network Layer: 5-44


Distance vector example 3: iteration

a b c
8 1

t=2 1 1
All nodes:
 receive distance
vectors from
neighbors d e f
 compute their new 1 1
local distance
vector
 send their new 1 1 1
local distance
vector to neighbors

g h i
1 1

Network Layer: 5-45


Distance vector example 3: iteration

compute
a compute
b compute
c
2 1

t=2 1 1
All nodes:
 receive distance
vectors from
neighbors d
compute compute
e compute
f
 compute their new 1 1
local distance
vector
 send their new 1 1 1
local distance
vector to neighbors

g
compute compute
h compute
i
8 1

Network Layer: 5-46


Distance vector example 3: iteration

a b c
8 1

t=2 1 1
All nodes:
 receive distance
vectors from
neighbors d e f
 compute their new 1 1
local distance
vector
 send their new 1 1 1
local distance
vector to neighbors

g h i
1 1

Network Layer: 5-47


Distance vector example 3: iteration

…. and so on

Let’s next take a look at the iterative computations at nodes

Network Layer: 5-48


Distance vector example: computation DV in b: DV in c:
Dc(a) = ∞
Db(a) = 8 Db(f) = ∞
Db(c) = 1 Db(g) = ∞ Dc(b) = 1
DV in a: Db(d) = ∞ Db(h) = ∞ Dc(c) = 0
Da(a)=0 Db(e) = 1 Db(i) = ∞ Dc(d) = ∞
Da(b) = 8 Dc(e) = ∞
Da(c) = ∞ a b c Dc(f) = ∞
8 1
Da(d) = 1 Dc(g) = ∞
Dc(h) = ∞
t=1 Da(e) = ∞
Da(f) = ∞ 1 1 Dc(i) = ∞
 b receives DVs Da(g) = ∞ DV in e:
from a, c, e Da(h) = ∞ De(a) = ∞
Da(i) = ∞ De(b) = 1
d e f De(c) = ∞
1 1
De(d) = 1
De(e) = 0
De(f) = 1
1 1 1
De(g) = ∞
De(h) = 1
De(i) = ∞
g h i
1 1

Network Layer: 5-49


Distance vector example: computation DV in b: DV in c:
Dc(a) = ∞
Db(a) = 8 Db(f) = ∞
Db(c) = 1 Db(g) = ∞ Dc(b) = 1
DV in a: Db(d) = ∞ Db(h) = ∞ Dc(c) = 0
Da(a)=0 Db(e) = 1 Db(i) = ∞ Dc(d) = ∞
Da(b) = 8 Dc(e) = ∞
Da(c) = ∞ a b c Dc(f) = ∞
8 compute 1
Da(d) = 1 Dc(g) = ∞
Dc(h) = ∞
t=1 Da(e) = ∞
Da(f) = ∞ 1 1 Dc(i) = ∞
 b receives DVs Da(g) = ∞ DV in e:
from a, c, e, Da(h) = ∞ De(a) = ∞
computes: e
Da(i) = ∞ De(b) = 1
d e f De(c) = ∞
1
Db(a) = min{cb,a+Da(a), cb,c +Dc(a), cb,e+De(a)} = min{8,∞,∞} =8 1
De(d) = 1
Db(c) = min{cb,a+Da(c), cb,c +Dc(c), c b,e +De(c)} = min{∞,1,∞} = 1
De(e) = 0
Db(d) = min{cb,a+Da(d), cb,c +Dc(d), c b,e +De(d)} = min{9,2,∞} = 2 De(f) = 1
1 1 1
Db(e) = min{cb,a+Da(e), cb,c +Dc(e), c b,e +De(e)} = min{∞,∞,1} = 1 De(g) = ∞
Db(f) = min{cb,a+Da(f), cb,c +Dc(f), c b,e +De(f)} = min{∞,∞,2} = 2
DV in b: De(h) = 1
Db(g) = min{cb,a+Da(g), cb,c +Dc(g), c b,e+De(g)} = min{∞, ∞, ∞} = ∞ Db(a) = 8 Db(f) =2 De(i) = ∞
g h 1Db(c) = 1 Db(g)i = ∞
1 ∞, 2} = 2
Db(h) = min{cb,a+Da(h), cb,c +Dc(h), c b,e+De(h)} = min{∞,
Db(d) = 2 Db(h) = 2
Db(i) = min{cb,a+Da(i), cb,c +Dc(i), c b,e+De(i)} = min{∞, ∞, ∞} = ∞ Db(e) = 1 Db(i) = ∞
Network Layer: 5-50
Distance vector example: computation DV in b: DV in c:
Dc(a) = ∞
Db(a) = 8 Db(f) = ∞
Db(c) = 1 Db(g) = ∞ Dc(b) = 1
DV in a: Db(d) = ∞ Db(h) = ∞ Dc(c) = 0
Da(a)=0 Db(e) = 1 Db(i) = ∞ Dc(d) = ∞
Da(b) = 8 Dc(e) = ∞
Da(c) = ∞ a b c Dc(f) = ∞
8 1
Da(d) = 1 Dc(g) = ∞
Dc(h) = ∞
t=1 Da(e) = ∞
Da(f) = ∞ 1 1 Dc(i) = ∞
 c receives DVs Da(g) = ∞ DV in e:
from b Da(h) = ∞ De(a) = ∞
Da(i) = ∞ De(b) = 1
d e f De(c) = ∞
1 1
De(d) = 1
De(e) = 0
De(f) = 1
1 1 1
De(g) = ∞
De(h) = 1
De(i) = ∞
g h i
1 1

Network Layer: 5-51


Distance vector example: computation DV in b: DV in c:
Dc(a) = ∞
Db(a) = 8 Db(f) = ∞
Db(c) = 1 Db(g) = ∞ Dc(b) = 1
Db(d) = ∞ Db(h) = ∞ Dc(c) = 0
Db(e) = 1 Db(i) = ∞ Dc(d) = ∞
Dc(e) = ∞
a b c
compute Dc(f) = ∞
8 1
Dc(g) = ∞
Dc(h) = ∞
t=1 1 1 Dc(i) = ∞
 c receives DVs
from b computes:

d b(a}} = 1 + 8 = 9
Dc(a) = min{cc,b+D e f
DV in c:
Dc(b) = min{cc,b+Db(b)} = 1 + 0 = 1
Dc(a) = 9
Dc(d) = min{cc,b+Db(d)} = 1+ ∞ = ∞ Dc(b) = 1
Dc(e) = min{cc,b+Db(e)} = 1 + 1 = 2 Dc(c) = 0
Dc(f) = min{cc,b+Db(f)} = 1+ ∞ = ∞ Dc(d) = 2
Dc(g) = min{cc,b+Db(g)} = 1+ ∞ = ∞ Dc(e) = ∞ * Check out the online interactive
Dc(f) = ∞ exercises for more examples:
g b(h)} = 1+ ∞ = ∞
Dc(h) = min{cbc,b+D h i http://gaia.cs.umass.edu/kurose_ross/interactive/
Dc(g) = ∞
Dc(i) = min{cc,b+Db(i)} = 1+ ∞ = ∞
Dc(h) = ∞
Network Layer: 5-52
Dc(i) = ∞
Distance vector example: computation DV in b:
Db(a) = 8 Db(f) = ∞
Db(c) = 1 Db(g) = ∞
Db(d) = ∞ Db(h) = ∞ DV in e:
DV in d:
Db(e) = 1 Db(i) = ∞ De(a) = ∞
Dc(a) = 1
De(b) = 1
Dc(b) = ∞ a b c De(c) = ∞
Dc(c) = ∞ 8 1
De(d) = 1
Dc(d) = 0
t=1 Dc(e) = 1
1
Q: what is new DV computed in e at
1t=1?
De(e) = 0
De(f) = 1
 e receives DVs Dc(f) = ∞
De(g) = ∞
from b, d, f, h Dc(g) = 1
De(h) = 1
Dc(h) = ∞
De(i) = ∞
Dc(i) = ∞ d compute
e f DV in f:
1 1
DV in h: Dc(a) = ∞
Dc(a) = ∞ Dc(b) = ∞
Dc(b) = ∞ Dc(c) = ∞
Dc(c) = ∞ 1 1 1
Dc(d) = ∞
Dc(d) = ∞ Dc(e) = 1
Dc(e) = 1 Dc(f) = 0
Dc(f) = ∞ g h i Dc(g) = ∞
1 1
Dc(g) = 1 Dc(h) = ∞
Dc(h) = 0 Dc(i) = 1 Network Layer: 5-53
Distance vector: state information
diffusion
Iterative communication, computation steps diffuses information through network:
t=0 c’s state at t=0 is at c only
a b c
8 1
c’s state at t=0 has propagated to b, and
t=1 may influence distance vector computations
up to 1 hop away, i.e., at b 1 1 t=1
t=2
c’s state at t=0 may now influence distance
t=2 vector computations up to 2 hops away, i.e.,
d e f
at b and now at a, e as well 1 1
c’s state at t=0 may influence distance vector
t=3 computations up to 3 hops away, i.e., at b,a,e
1 1 1 t=3
and now at c,f,h as well
c’s state at t=0 may influence distance vector
t=4 computations up to 4 hops away, i.e., at b,a,e, g h i
c, f, h and now at g,i as well 1 1
t=4
Distance vector: link cost changes
link cost changes: 1
y
4 1
 node detects local link cost change x z
 updates routing info, recalculates local DV 50

 if DV changes, notify neighbors

t0 : y detects link-cost change, updates its DV, informs its neighbors.


“good news t1 : z receives update from y, updates its table, computes new least
travels fast”
cost to x , sends its neighbors its DV.
t2 : y receives z’s update, updates its distance table. y’s least costs
do not change, so y does not send a message to z.

Network Layer: 5-55


Distance vector: link cost changes
link cost changes: 60
y
4 1
 node detects local link cost change x z
 “bad news travels slow” – count-to-infinity problem: 50

• y sees direct link to x has new cost 60, but z has said it has a path at cost of 5. So
y computes “my new cost to x will be 6, via z); notifies z of new cost of 6 to x.
• z learns that path to x via y has new cost 6, so z computes “my new cost to
x will be 7 via y), notifies y of new cost of 7 to x.
• y learns that path to x via z has new cost 7, so y computes “my new cost to
x will be 8 via y), notifies z of new cost of 8 to x.
• z learns that path to x via y has new cost 8, so z computes “my new cost to
x will be 9 via y), notifies y of new cost of 9 to x.

 see text for solutions. Distributed algorithms are tricky!
Network Layer: 5-56
Exercise: Use DV to find the best path from R1 to each of the
destinations (fill the routing table)
R7
From From From
R2 R3 R5
1 R2 R6 R1 1 3 10
R2 0 8 15
I1
R5
R1 I2 R3 11 0 20
3 25
I3 R4 4 20
Destination Cost Next Hop ExitR4
Interface R5 5 25
R3 0
R1 0 ---- --- R6 30 20 30
R2 1 R2 I1
R7 20 18 8
R3 3 R3 10 I2
R4 5 R2 I1 DV’s received from neighbors
R5 6 R2 I1
R6 23 R3 I2
R7 18 R5 I3
Introduction to routing 2-57
Comparison of LS and DV algorithms
message complexity robustness: what happens if router
LS: n routers, O(n2) messages sent malfunctions, or is compromised?
DV: exchange between neighbors; LS:
convergence time varies • router can advertise incorrect link cost
• each router computes only its own
speed of convergence table
LS: O(n2) algorithm, O(n2) messages DV:
• may have oscillations
• DV router can advertise incorrect path
DV: convergence time varies cost (“I have a really low cost path to
• may have routing loops everywhere”): black-holing
• count-to-infinity problem
• each router’s table used by others:
error propagate thru network

Network Layer: 5-58


Making routing scalable
our routing study thus far - idealized
 all routers identical
 network “flat”
… not true in practice
scale: billions of destinations: administrative autonomy:
 can’t store all destinations in  Internet: a network of networks
routing tables!  each network admin may want to
 routing table exchange would control routing in its own network
swamp links!

Network Layer: 5-59


Internet approach to scalable routing
aggregate routers into regions known as “autonomous
systems” (AS) (a.k.a. “domains”)

intra-AS (aka “intra-domain”): inter-AS (aka “inter-domain”):


routing among within same AS routing among AS’es
(“network”)  gateways perform inter-domain
 all routers in AS must run same intra- routing (as well as intra-domain
domain protocol routing)
 routers in different AS can run different
intra-domain routing protocols
 gateway router: at “edge” of its own AS,
has link(s) to router(s) in other AS’es
Network Layer: 5-60
Interconnected AS’s (Autonomous Systems)
forwarding table configured by intra-
and inter-AS routing algorithms
Intra-AS Inter-AS
Routing Routing  intra-AS routing determine entries for
forwarding destinations within AS
table
 inter-AS & intra-AS determine entries
for external destinations

intra-AS
3c
routing3a inter-AS routing intra-AS
2c
3b 2a routing
2b
1c
intra-AS
AS3
1a routing 1b AS2
1d
AS1

Network Layer: 5-61


Inter-AS routing: a role in intradomain forwarding
 suppose router in AS1 receives AS1 inter-domain routing must:
datagram destined outside of AS1: 1. learn which destinations reachable
• router should forward packet to through AS2, which through AS3
gateway router in AS1, but which 2. propagate this reachability info to all
one? routers in AS1

3c
3a other
2c
3b 2a networks
2b
1c
AS3
other 1a 1b AS2
networks
1d
AS1

Network Layer: 5-62


Inter-AS routing: routing within an AS
most common intra-AS routing protocols:
 RIP: Routing Information Protocol [RFC 1723]
• classic DV: DVs exchanged every 30 secs
• no longer widely used
 EIGRP: Enhanced Interior Gateway Routing Protocol
• DV based
• formerly Cisco-proprietary for decades (became open in 2013 [RFC 7868])
 OSPF: Open Shortest Path First [RFC 2328]
• link-state routing
• IS-IS protocol (ISO standard, not RFC standard) essentially same as OSPF

Network Layer: 5-63


OSPF (Open Shortest Path First) routing
 “open”: publicly available
 classic link-state
• each router floods OSPF link-state advertisements (directly over IP
rather than using TCP/UDP) to all other routers in entire AS
• multiple link costs metrics possible: bandwidth, delay
• each router has full topology, uses Dijkstra’s algorithm to compute
forwarding table
 security: all OSPF messages authenticated (to prevent malicious
intrusion)

Network Layer: 5-64


Hierarchical OSPF
 two-level hierarchy: local area, backbone.
• link-state advertisements flooded only in area, or backbone
• each node has detailed area topology; only knows direction to reach
other destinations
area border routers: boundary router:
“summarize” distances to connects to other ASes
backbone
destinations in own area, backbone router:
advertise in backbone runs OSPF limited
to backbone
local routers:
• flood LS in area only area 3
• compute routing within
area
• forward packets to outside internal
area 1 routers
via area border router
area 2 Network Layer: 5-65
Hierarchical routing
 aggregate routers into gateway router:
regions, “autonomous  at “edge” of its own AS
systems” (AS)  has link to router in another AS
 routers in same AS run
same routing protocol
• “intra-AS” routing
protocol
 routers in different AS
can run different intra-
AS routing protocol
Internet inter-AS routing: BGP
 BGP (Border Gateway Protocol): the de facto inter-domain routing
protocol
• “glue that holds the Internet together”
 allows subnet to advertise its existence, and the destinations it can
reach, to rest of Internet: “I am here, here is who I can reach, and how”
 BGP provides each AS a means to:
• eBGP: obtain subnet reachability information from neighboring ASes
• iBGP: propagate reachability information to all AS-internal routers.
• determine “good” routes to other networks based on reachability information
and policy

Network Layer: 5-67


eBGP, iBGP connections
2b

2a 2c

1b 3b
2d
1a 1c ∂
3a 3c
AS 2
1d 3d

AS 1 eBGP connectivity AS 3
logical iBGP connectivity

1c gateway routers run both eBGP and iBGP protocols

Network Layer: 5-68


BGP basics
 BGP session: two BGP routers (“peers”) exchange BGP messages over
semi-permanent TCP connection:
• advertising paths to different destination network prefixes (BGP is a “path
vector” protocol)
 when AS3 gateway 3a advertises path AS3,X to AS2 gateway 2c:
• AS3 promises to AS2 it will forward datagrams towards X
AS 3 3b
AS 1 1b 3a 3c
1a 1c AS 2 3d
2b
1d BGP advertisement:
2a 2c X
AS3, X
2d
Network Layer: 5-69
Path attributes and BGP routes
 BGP advertised route: prefix + attributes
• prefix: destination being advertised
• two important attributes:
• AS-PATH: list of ASes through which prefix advertisement has passed
• NEXT-HOP: indicates specific internal-AS router to next-hop AS
 policy-based routing:
• gateway receiving route advertisement uses import policy to
accept/decline path (e.g., never route through AS Y).
• AS policy also determines whether to advertise path to other other
neighboring ASes

Network Layer: 5-70


BGP path advertisement
AS 3 3b
AS 1 1b 3a 3c
1a 1c AS 2 3d X
2b
1d AS3, X
AS2,AS3,X 2a 2c

2d

 AS2 router 2c receives path advertisement AS3,X (via eBGP) from AS3 router 3a
 based on AS2 policy, AS2 router 2c accepts path AS3,X, propagates (via iBGP) to all
AS2 routers
 based on AS2 policy, AS2 router 2a advertises (via eBGP) path AS2, AS3, X to
AS1 router 1c
Network Layer: 5-71
BGP path advertisement (more)
AS 3 3b
AS 1 1b AS3,X 3a 3c
AS3,X
AS3,X
1a 1c AS 2 3d X
2b
AS3,X
1d AS3, X
AS2,AS3,X 2a 2c

2d

gateway router may learn about multiple paths to destination:


 AS1 gateway router 1c learns path AS2,AS3,X from 2a
 AS1 gateway router 1c learns path AS3,X from 3a
 based on policy, AS1 gateway router 1c chooses path AS3,X and advertises path
within AS1 via iBGP
Network Layer: 5-72
BGP messages
 BGP messages exchanged between peers over TCP connection
 BGP messages:
• OPEN: opens TCP connection to remote BGP peer and authenticates
sending BGP peer
• 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

Network Layer: 5-73


BGP path advertisement
AS 3 3b
AS 1 1b AS3,X 3a 3c
AS3,X
1
AS3,X
1a 1c AS 2 3d X
2 2b
local link AS3,X
2 1 AS3, X
interfaces 1d
at 1a, 1d AS2,AS3,X 2a 2c

2d

dest interface  recall: 1a, 1b, 1d learn via iBGP from 1c: “path to X goes through 1c”
… …
1c 1
 at 1d: OSPF intra-domain routing: to get to 1c, use interface 1
X 1  at 1d: to get to X, use interface 1
… …

Network Layer: 5-74


BGP path advertisement
AS 3 3b
AS 1 1b 3a 3c
1
1a 1c AS 2 3d X
2 2b
1d
2a 2c

2d

dest interface
… …  recall: 1a, 1b, 1d learn via iBGP from 1c: “path to X goes through 1c”
1c 2
 at 1d: OSPF intra-domain routing: to get to 1c, use interface 1
X 2
… …  at 1d: to get to X, use interface 1
 at 1a: OSPF intra-domain routing: to get to 1c, use interface 2
 at 1a: to get to X, use interface 2
Network Layer: 5-75
Why different Intra-, Inter-AS routing ?
policy:
 inter-AS: admin wants control over how its traffic routed, who
routes through its network
 intra-AS: single admin, so policy less of an issue
scale:
 hierarchical routing saves table size, reduced update traffic
performance:
 intra-AS: can focus on performance
 inter-AS: policy dominates over performance

Network Layer: 5-76


Hot potato routing
AS 3 3b
AS 1 1b 3a 3c
1a 1c AS 2 3d X
2b 112
1d AS1,AS3,X AS3,X
2a 2c
201 263

2d
OSPF link weights

 2d learns (via iBGP) it can route to X via 2a or 2c


 hot potato routing: choose local gateway that has least intra-domain
cost (e.g., 2d chooses 2a, even though more AS hops to X): don’t worry
about inter-domain cost!
Network Layer: 5-77
BGP: achieving policy via advertisements
A,w
B provider
x network
w A legend:
A,w C y customer
network:

ISP only wants to route traffic to/from its customer networks (does not want
to carry transit traffic between other ISPs – a typical “real world” policy)
 A advertises path Aw to B and to C
 B chooses not to advertise BAw to C!
 B gets no “revenue” for routing CBAw, since none of C, A, w are B’s customers
 C does not learn about CBAw path
 C will route CAw (not using B) to get to w
Network Layer: 5-78
BGP: achieving policy via advertisements (more)
B provider
x network
w A legend:
C y customer
network:

ISP only wants to route traffic to/from its customer networks (does not want
to carry transit traffic between other ISPs – a typical “real world” policy)
 A,B,C are provider networks
 x,w,y are customer (of provider networks)
 x is dual-homed: attached to two networks
 policy to enforce: x does not want to route from B to C via x
 .. so x will not advertise to B a route to C
Network Layer: 5-79
BGP route selection
 router may learn about more than one route to destination
AS, selects route based on:
1. local preference value attribute: policy decision
2. shortest AS-PATH
3. closest NEXT-HOP router: hot potato routing
4. additional criteria

Network Layer: 5-80

You might also like