Вы находитесь на странице: 1из 16

4.

8 Routing algorithms

Interplay between routing algorithm


routing and forwarding
local forwarding table
header value output link
0100 3
0101 2
0111 2
1001 1

value in arriving
packets header
0111 1

3 2

Dr. Vicente Alarcn Aquino


Copyright 1996-2017 J.F Kurose 190
and K.W. Ross

Graph abstraction

v 3 w
2 5
u 2 z
1
3
1
x y 2
1

Graph: G = (N,E)

N = set of routers = { u, v, w, x, y, z }

E = set of links ={ (u,v), (u,x), (u,w), (v,x), (v,w), (x,w), (x,y), (w,y), (w,z), (y,z) }

Dr. Vicente Alarcn Aquino


Copyright 1996-2017 J.F Kurose 191
and K.W. Ross
Graph abstraction: costs

5 c(x,x) = cost of link (x,x)


v 3 w
5 - e.g., c(w,z) = 5
2
u 2 z
1 cost could always be 1, or
3
1 inversely related to bandwidth,
x y 2
or inversely related to
1
congestion

Cost of path (x1, x2, x3,, xp) = c(x1,x2) + c(x2,x3) + + c(xp-1,xp)

Question: Whats the least-cost path between u and z ?

Routing algorithm: algorithm that finds least-cost path


Dr. Vicente Alarcn Aquino
Copyright 1996-2017 J.F Kurose 192
and K.W. Ross

Routing Algorithm classification

Global or decentralized Static or dynamic?


information? Static:
Global: routes change slowly
all routers have complete over time
topology, link cost info
link state algorithms
Dynamic:
routes change more
Decentralized:
quickly
router knows physically-
connected neighbors, link periodic update
costs to neighbors in response to link cost
iterative process of changes
computation, exchange of
info with neighbors
distance vector algorithms

Dr. Vicente Alarcn Aquino


Copyright 1996-2017 J.F Kurose 193
and K.W. Ross
A Link-State Routing Algorithm
Dijkstras algorithm
net topology, link costs Notation:
known to all nodes c(x,y): link cost from node x
accomplished via link to y; = if not direct
state broadcast neighbors
all nodes have same info D(v): current value of cost of
path from source to dest. v
computes least cost paths
from one node (source) p(v): predecessor node
along path from source to v
to all other nodes
N': set of nodes whose least
gives forwarding table for

cost path definitively known
that node
iterative: after k iterations,
know least cost path to k
dest.s

Dr. Vicente Alarcn Aquino


Copyright 1996-2017 J.F Kurose 194
and K.W. Ross

Dijsktras Algorithm

1 Initialization: 5
2 N' = {u}
3 for all nodes v v 3 w
2 5
4 if v adjacent to u
u 2 z
5 then D(v) = c(u,v) 1
3
6 else D(v) = 1
x y 2
7 1
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) + c(w,v) )
13 /* new cost to v is either old cost to v or known
14 shortest path cost to w plus cost from w to v */
15 until all nodes in N'

Dr. Vicente Alarcn Aquino


Copyright 1996-2017 J.F Kurose 195
and K.W. Ross
Dijkstras algorithm: example

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

v 3 w
2 5
u 2 z
1
3
1
x y 2
1

Dr. Vicente Alarcn Aquino


Copyright 1996-2017 J.F Kurose 196
and K.W. Ross

Dijkstras Algorithm Example

The first 5 steps used in computing the shortest path from A to


D. The arrows indicate the working node.
Dr. Vicente Alarcn Aquino
Copyright 1996-2017 J.F Kurose 197
and K.W. Ross
Distance Vector Algorithm
Basic idea:
Each node periodically sends its own distance vector
estimate to neighbors
When node a node x receives new DV estimate from
neighbor, it updates its own DV using B-F equation:
Bellman-Ford Equation (dynamic programming)
Define dx(y) := cost of least-cost path from x to y

dx(y) = min {c(x,v) + dv(y) } for each node y N

where min is taken over all neighbors of x

Dr. Vicente Alarcn Aquino


Copyright 1996-2017 J.F Kurose 198
and K.W. Ross

Bellman-Ford example

5
Clearly, dv(z) = 5, dx(z) = 3, dw(z) = 3
v 3 w
2 5
u 2 z B-F equation says:
1
3
1 du(z) = min { c(u,v) + dv(z),
x y 2
1 c(u,x) + dx(z),
c(u,w) + dw(z) }
= min {2 + 5,
1 + 3,
5 + 3} = 4
Node that achieves minimum is next
hop in shortest path forwarding table
Dr. Vicente Alarcn Aquino
Copyright 1996-2017 J.F Kurose 199
and K.W. Ross
Dx(y) = min{c(x,y) + Dy(y), c(x,z) + Dz(y)} Dx(z)= min{c(x,y) + Dy(z), c(x,z) + Dz(z)}
= min{2+0 , 7+1} = 2 = min{2+1 , 7+0} = 3
node x table
cost to cost to cost to
x y z x y z x y z
x 0 2 7 x 0 2 3 x 0 2 3
from

from
y y 2 0 1

from
y 2 0 1
z z 7 1 0 z 3 1 0
node y table
cost to cost to cost to
x y z x y z x y z y
2 1
x x 0 2 7
from x 0 2 3 x z
y 2 0 1 y 2 0 1
from

from
y 2 0 1 7
z z 7 1 0 z 3 1 0
node z table
cost to cost to cost to
x y z x y z x y z

x x 0 2 7 x 0 2 3
from

y 2 0 1 from y 2 0 1
from

y
z 71 0 z 3 1 0 z 3 1 0
Dr. Vicente Alarcn Aquino
time
Copyright 1996-2017 J.F Kurose 200
and K.W. Ross

Comparison

Distance vector algorithm


Very simple to implement
May have convergence problems
Used in RIP and EIGRP
Link-state algorithm
Much more complex
Switches perform independent computations
Used in OSPF (Open Shortest Path First Protocol)

Dr. Vicente Alarcn Aquino


Copyright 1996-2017 J.F Kurose 201
and K.W. Ross
4.9 Hierarchical Routing
Our routing study thus far - idealization
all routers identical administrative autonomy
network flat Internet = network of
not true in practice networks
scale: with 200 million each network admin may
destinations: want to control routing in its
cant store all dests in
own network
routing tables! aggregate routers into regions,
routing table exchange
autonomous systems (AS)
would swamp links! routers in same AS run same
routing protocol
Gateway router: Direct link to intra-AS routing protocol
router in another AS routers in different AS can
run different intra-AS
routing protocol
Dr. Vicente Alarcn Aquino
Copyright 1996-2017 J.F Kurose 202
and K.W. Ross

Classification Of Internet Routing Protocols


Two broad classes
Interior Gateway Protocols (IGPs): aka Intra-AS routing protocols.
Used among routers within autonomous system
Destinations lie within IGP
RIP: Routing Information Protocol. RIPng for IPv6
OSPF: Open Shortest Path First. OSPFv3 for IPv6
IGRP/EIGRP: Interior Gateway Routing Protocol (Cisco proprietary)
Exterior Gateway Protocols (EGPs): aka Inter-AS routing
protocols.
Used among autonomous systems (BGP)
Destinations lie throughout Internet

Dr. Vicente Alarcn Aquino


Copyright 1996-2017 J.F Kurose 203
and K.W. Ross
Interconnected ASes

3c
3a 2c
3b 2a
AS3 2b
1c AS2
1a 1b
1d AS1
Forwarding table is
configured by both intra-
and inter-AS routing
Intra-AS Inter-AS
Routing Routing algorithm
algorithm algorithm
Intra-AS sets entries for
Forwarding internal dests
table
Inter-AS & Intra-As sets
entries for external dests

Dr. Vicente Alarcn Aquino


Copyright 1996-2017 J.F Kurose 204
and K.W. Ross

RIP ( Routing Information Protocol)

Distance vector algorithm


Distance metric: # of hops (max = 15 hops)

destination hops Distance vectors:


u v
u 1 exchanged among
w v 2 neighbors every 30 sec
A B w 2
x 3 via Response Message
y 3 (also called
x z 2 advertisement)
z C D Each advertisement: list
y of up to 25 destination
nets within AS

Dr. Vicente Alarcn Aquino


Copyright 1996-2017 J.F Kurose 205
and K.W. Ross
RIP: Example
Dest Next hops
w - - Advertisement
x - - from A to D
z C 4
. ...
z
w x y
A D B

Destination Network Next Router Num. of hops to dest.


w A 2
y B 2
z B A 7 5
x -- 1
. . ....
Dr. Vicente Alarcn Aquino Routing table in D 206
Copyright 1996-2017 J.F Kurose
and K.W. Ross

An OSPF AS Consists of Multiple Areas Linked by


Routers
Illustration Of OSPF Graph

(a) an interconnect of routers and


networks, and
(b) an equivalent OSPF graph
Router corresponds to a node in the
graph
Carried in OSPF messages directly over IP
(rather than TCP or UDP): protocol number
89 for the IP Protocol field

Dr. Vicente Alarcn Aquino


Copyright 1996-2017 J.F Kurose 207
and K.W. Ross
BGP basics
Pairs of routers (BGP peers) exchange routing info over
semi-permanent TCP conctns: BGP sessions on port 179.
Note that BGP sessions do not correspond to physical
links.
When AS2 advertises a prefix to AS1, AS2 is promising it
will forward any datagrams destined to that prefix towards
the prefix.
AS2 can aggregate prefixes in its advertisement

3c
3a 2c
3b 2a
AS3 2b
1c AS2
1a 1b
AS1 1d
eBGP session
iBGP session
Dr. Vicente Alarcn Aquino
Copyright 1996-2017 J.F Kurose 208
and K.W. Ross

5. Link Layer and LANs


Some terminology: link
hosts and routers are nodes
communication channels that
connect adjacent nodes along
communication path are links
wired links
wireless links
LANs
layer-2 packet is a frame,
encapsulates datagram

data-link layer has responsibility of


transferring datagram from one node
to adjacent node over a link

Dr. Vicente Alarcn Aquino


Copyright 1996-2017 J.F Kurose 209
and K.W. Ross
Two types of networks at the data link layer

Broadcast Networks: All stations share a single


communication channel
Point-to-Point Networks: Pairs of hosts (or routers) are
directly connected

Broadcast Network Point-to-Point Network

Typically, local area networks (LANs) are broadcast and


wide area networks (WANs) are point-to-point
Dr. Vicente Alarcn Aquino
Copyright 1996-2017 J.F Kurose 210
and K.W. Ross

Local Area Networks


Local area networks (LANs) connect computers within a building or a enterprise
network
Almost all LANs are broadcast networks
Typical topologies of LANs are bus or star or ring. There are also mesh, hybrid,
hierarchical star, star-wireless.
We will work with Ethernet LANs. Ethernet has a bus or star topology.

Dr. Vicente Alarcn Aquino


Copyright 1996-2017 J.F Kurose 211
and K.W. Ross
IEEE 802 Standards
Number Description
802.1 Internetworking
802.2 Logical Link Control
802.3 Ethernet (CSMA/CD)
802.3u Fast Ethernet
802.3z Gigabit Ethernet
802.3ae 10 Gigabit Ethernet
802.4 Token Bus
802.5 Token Ring
802.6 Distributed Queue Dual Bus (MAN)
802.7 Broadband Technology
802.8 Fiber Optic Technology
802.10 LAN Security
802.11a/b/g/n Wireless LAN
802.15 Wireless Personal Area Network (WPAN)
802.15.3a UWB (Ultra-WideBand)
802.16 Wireless MAN WiMAX
802.20 Wireless WAN (Mobile Broadband Wireless Access MBWA).
802.22 Wireless RAN (Regional Area Network)

Dr. Vicente Alarcn Aquino


Copyright 1996-2017 J.F Kurose 212
and K.W. Ross

5.1 Link layer: context and services

Datagram transferred by different link protocols


over different links:
e.g., Ethernet on first link, frame relay on
intermediate links, 802.11 on last link

Framing, link access:


encapsulate datagram into frame, adding header, trailer
channel access if shared medium
MAC addresses used in frame headers to identify source,
dest
different from IP address!
Reliable delivery between adjacent nodes
seldom used on low bit error link (fiber, some twisted pair)
wireless links: high error rates
Dr. Vicente Alarcn Aquino
Copyright 1996-2017 J.F Kurose 213
and K.W. Ross
Link Layer Services (more)
Flow Control:
pacing between adjacent sending and receiving nodes
Error Detection:
errors caused by signal attenuation, noise.
receiver detects presence of errors:
signals sender for retransmission or drops frame

Error Correction:
receiver identifies and corrects bit error(s) without
resorting to retransmission
Half-duplex and full-duplex
with half duplex, nodes at both ends of link can
transmit, but not at same time

Dr. Vicente Alarcn Aquino


Copyright 1996-2017 J.F Kurose 214
and K.W. Ross

Adaptors Communicating
datagram
link layer protocol rcving
sending node
node
frame frame
adapter adapter
link layer implemented in receiving side
adaptor (aka NIC) looks for errors, rdt, flow
Ethernet card, 802.11 card control, etc
sending side: extracts datagram, passes to
encapsulates datagram in a rcving node
frame adapter is semi-autonomous
adds error checking bits, rdt link & physical layers
(reliable data transfer), flow
control, etc.

Dr. Vicente Alarcn Aquino


Copyright 1996-2017 J.F Kurose 215
and K.W. Ross
5.2 Error Detection
EDC= Error Detection and Correction bits (redundancy)
D = Data protected by error checking, may include header fields

Error detection not 100% reliable!


protocol may miss some errors, but rarely
larger EDC field yields better detection and correction

Dr. Vicente Alarcn Aquino


Copyright 1996-2017 J.F Kurose 216
and K.W. Ross

Parity Checking

Single Bit Parity: Two Dimensional Bit Parity:


Detect and correct single bit errors
Detect single bit errors

0 0

Dr. Vicente Alarcn Aquino


Copyright 1996-2017 J.F Kurose 217
and K.W. Ross
Checksumming: Cyclic Redundancy Check

view data bits, D, as a binary number


choose r+1 bit pattern (generator), G
goal: choose r CRC bits, R, such that
<D,R> exactly divisible by G (modulo 2)
receiver knows G, divides <D,R> by G. If non-zero
remainder: error detected!
can detect all burst errors less than r+1 bits
widely used in practice

Dr. Vicente Alarcn Aquino


Copyright 1996-2017 J.F Kurose 218
and K.W. Ross

CRC Example

[D.2r XOR R]/G = Q


[D.2r]/G = Q XOR R/G

if we divide by D.2r
G, want remainder R

D .2 r
R = remainder[ ]
G

Dr. Vicente Alarcn Aquino


Copyright 1996-2017 J.F Kurose 219
and K.W. Ross
Polynomials

Dr. Vicente Alarcn Aquino


Copyright 1996-2017 J.F Kurose 220
and K.W. Ross

Вам также может понравиться