Download as pdf or txt
Download as pdf or txt
You are on page 1of 55

Chapter 4: Network Layer

Chapter goals:
r understand principles behind network layer
services:
❖ network layer service models
❖ forwarding versus routing
❖ subnetting and IP addressing
❖ routing algorithms (path selection)

Chapter 4, slide: 1
Network layer
r network layer protocols application
transport

run at network
data link
physical
❖ end systems & network network
data link data link
❖ routers network
data link
physical physical
physical network network
r Sender side: data link data link
physical physical
❖ get segments from
transport layer network
data link
network
data link
physical physical
❖ encapsulates segments network
data link
into IP datagrams physical
application
transport
r router examines header
network
data link network
network
physical data link
fields in all IP datagrams network
data link
data link
physical
physical
physical

r Receiver side:
❖ delivers segments to
transport layer

Chapter 4, slide: 2
Interplay between routing and forwarding
r routing algorithm:
r forwarding routing algorithm
constructs routing
table: a lookup tables
table for local forwarding table
figuring out header value output link
r forwarding process:
output port for 0100 3
0101 2 move pkts from input
each input pkt 0111 2
1001 1 to output

value in arriving
packet’s header
0111 1
Source 3 2
Destination
r routing process: find
route taken by packets
from source to dest.
Chapter 4, slide: 3
Two Key Network-Layer Functions

r forwarding: move analogy:


packets from router’s
r routing: process of
input to appropriate
planning trip from
router output
source to dest
r routing: determine
r forwarding: process
route taken by
of getting through
packets from source
single interchange
to dest.
❖ routing algorithms

Chapter 4, slide: 4
Datagram networks
r no call setup at network layer
r no state about end-to-end connections is kept in
routers
❖ no network-level concept of “connection”
r packets forwarded using dest. host address
❖ packets (same source-dest pair) may take different paths

application
application
transport
transport
network
data link 1. Send data 2. Receive data network
data link
physical
physical

Chapter 4, slide: 5
The Internet Network layer
Host, router network layer functions:

Transport layer: TCP, UDP

Routing protocols IP protocol


•path selection •addressing conventions
•RIP, OSPF, BGP •datagram format
Network •packet handling conventions
layer forwarding
ICMP protocol
table
•error reporting
•router “signaling”

Link layer

physical layer

Chapter 4, slide: 6
IP Addressing: introduction
r IP address: 32-bit 223.1.1.1 = 11011111 00000001 00000001 00000001
identifier for 223 1 1 1
❖ host,
❖ router interface
223.1.1.1

223.1.2.1
r interface: connection 223.1.1.2
between host/router and 223.1.1.4 223.1.2.9

physical link 223.1.2.2


223.1.1.3 223.1.3.27
❖ multiple interfaces per
router
❖ one interface per host
❖ one IP address per 223.1.3.1 223.1.3.2
interface

Chapter 4, slide: 7
Subnets
r IP address: 223.1.1.1

❖ subnet part (higher bits) 223.1.2.1


223.1.1.2
❖ host part (lower bits)
223.1.1.4 223.1.2.9

subnet host 223.1.2.2


part part 223.1.1.3 223.1.3.27
11001000 00010111 00010000 00000000
subnet
200.23.16.0/23
223.1.3.1 223.1.3.2

r What’s a subnet ?
❖ device interfaces with same
subnet part of IP address network consisting of 3 subnets
❖ can physically reach each
other without intervening
router
Chapter 4, slide: 8
Subnets 223.1.1.0/24
223.1.2.0/24

Recipe
r To determine the
subnets, detach each
interface from its
host or router,
creating islands of
isolated networks.
Each isolated network
is called a subnet. 223.1.3.0/24

Subnet mask: /24

Chapter 4, slide: 9
IP addressing: CIDR
Classful addressing: A, B, C
❖ A: /8
❖ B: /16
❖ C: /24
Problem: see which class is needed for 300 hosts? Issue?

CIDR: Classless InterDomain Routing


❖ subnet portion of address of arbitrary length
❖ address format: a.b.c.d/x, where x is # bits in subnet
portion of address

subnet host
part part
11001000 00010111 00010000 00000000
200.23.16.0/23 Chapter 4, slide: 10
IP addresses: how to get one?
Q: How does host get IP address?

r hard-coded by system admin in a file

r DHCP: Dynamic Host Configuration Protocol:


❖ dynamically get IP address from a server when joining the
network
❖ IP address can be reused by other hosts if released
❖ Can renew IP addresses if stayed connected

Chapter 4, slide: 11
DHCP client-server scenario

A 223.1.1.1 DHCP 223.1.2.1


serve
r
223.1.1.2
223.1.1.4 223.1.2.9
B
223.1.2.2 arriving DHCP
223.1.1.3 223.1.3.27 E client needs
address in this
223.1.3.1 223.1.3.2
network

Chapter 4, slide: 12
DHCP client-server scenario

See page: 348

Chapter 4, slide: 13
IPv6
r Initial motivation:
❖ 32-bit address space soon to be completely allocated (if not
already!)

r Additional motivation:
❖ header changes to facilitate QoS

r Major changes from IPv4:


❖ Fragmentation: no longer allowed; drop packet if too big;
send an ICMP msg back
❖ Checksum: removed to reduce processing time; already done
at transport and link layers

Chapter 4, slide: 14
Routing versus forwarding

routing algorithm

local forwarding table


header value output link
0100 3
0101 2
0111 2
1001 1

value in arriving
packet’s header
0111 1

3 2

Chapter 4, slide: 15
Graph abstraction
5
3
v w 5
2
u 2 1 z
3
1 2
Graph: G = (N,E)
x 1
y

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) }

Chapter 4, slide: 16
Graph abstraction: costs
5
• c(x,x’) = cost of link (x,x’)
3
v w 5
2 - e.g., c(w,z) = 5
u 2 1 z
3 • cost could always be 1, or
1 2 inversely related to bandwidth,
x 1
y
or inversely related to
congestion

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

Question: What’s the least-cost path between u and z ?

The routing algorithm’s job is to find this least-cost path

Chapter 4, slide: 17
A Link-State Routing Algorithm

Dijkstra’s algorithm Notation:


r Each node computes least r c(x,y): link cost from node
cost paths from it to all x to y; = ∞ if not direct
other nodes neighbors
r D(v): current value of cost
r Each node knows entire net
of path from source to
topology, all link costs
dest. v
r Each node broadcasts “link r p(v): predecessor node
state” of its neighbors along path from source to v
only, but to all r N': set of nodes whose
least cost path definitively
r iterative: after k known
iterations, know least cost
path to k dest.’s
Chapter 4, slide: 18
Dijkstra’s algorithm: example
Step N' \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
2
3
4
5
1 Initialization:
2 N' = {u}
5 3 for all nodes b
4 if b adjacent to u
3
v w 5 5 then D(b) = c(u,b)
2
6 else D(b) = ∞
u 2 1 z
3
1 2
x y
1
Chapter 4, slide: 19
Dijkstra’s algorithm: example
Step N' \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 vwy 2,u 4,x 2,x
2
3
4
5 8 Loop
9 find c not in N' such that D(c) is a minimum
10 add c to N'
5 11 update D(b) for all b adjacent to c & not in N' :
3 12 D(b) = min( D(b), D(c) + c(c,b) )
v w 5 15 until all nodes in N'
2
u 2 1 z
3
1 2
x y
1
Chapter 4, slide: 20
Dijkstra’s algorithm: example
Step N' \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 vwy 2,u 4,x 2,x ∞
2 uxy wz 2,u 3,y 4,y
3
4
5 8 Loop
9 find c not in N' such that D(c) is a minimum
10 add c to N'
5 11 update D(b) for all b adjacent to c & not in N' :
3 12 D(b) = min( D(b), D(c) + c(c,b) )
v w 5 15 until all nodes in N'
2
u 2 1 z
3
1 2
x y
1
Chapter 4, slide: 21
Dijkstra’s algorithm: example
Step N' \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 vwy 2,u 4,x 2,x ∞
2 uxy wz 2,u 3,y 4,y
3 uxyv w 3,y 4,y
4
5 8 Loop
9 find c not in N' such that D(c) is a minimum
10 add c to N'
5 11 update D(b) for all b adjacent to c & not in N' :
3 12 D(b) = min( D(b), D(c) + c(c,b) )
v w 5 15 until all nodes in N'
2
u 2 1 z
3
1 2
x y
1
Chapter 4, slide: 22
Dijkstra’s algorithm: example
Step N' \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 vwy 2,u 4,x 2,x ∞
2 uxy wz 2,u 3,y 4,y
3 uxyv w 3,y 4,y
4 uxyvw z 4,y
5 8 Loop
9 find c not in N' such that D(c) is a minimum
10 add c to N'
5 11 update D(b) for all b adjacent to c & not in N' :
3 12 D(b) = min( D(b), D(c) + c(c,b) )
v w 5 15 until all nodes in N'
2
u 2 1 z
3
1 2
x y
1
Chapter 4, slide: 23
Dijkstra’s algorithm: example
Step N' \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 vwy 2,u 4,x 2,x ∞
2 uxy wz 2,u 3,y 4,y
3 uxyv w 3,y 4,y
4 uxyvw z 4,y
5 uxyvwz - 8 Loop
9 find c not in N' such that D(c) is a minimum
10 add c to N'
5 11 update D(b) for all b adjacent to c & not in N' :
3 12 D(b) = min( D(b), D(c) + c(c,b) )
v w 5 15 until all nodes in N'
2
u 2 1 z
3
1 2
x y
1
Chapter 4, slide: 24
Dijkstra’s Algorithm
1 Initialization:
2 N' = {a}
3 for all nodes b
4 if b adjacent to a
5 then D(b) = c(a,b)
6 else D(b) = ∞
7
8 Loop
9 find c not in N' such that D(c) is a minimum
10 add c to N'
11 update D(b) for all b adjacent to c and not in N' :
12 D(b) = min( D(b), D(c) + c(c,b) )
13 /* new cost to b is either old cost to b or known
14 shortest path cost to c plus cost from c to b */
15 until all nodes in N'

Chapter 4, slide: 25
Dijkstra’s algorithm: example
Resulting shortest-path tree from u:

v w
To remember !
r Each node must have
u z complete knowledge of
x y entire network
r Broadcast all link
Resulting forwarding table in u: states
destination link r Each node constructs
v (u,v) its own table
x (u,x)
y (u,x)
w (u,x)
z (u,x)
Chapter 4, slide: 26
Dijkstra’s algorithm, discussion
Algorithm complexity: n nodes
r each iteration: need to check all nodes, w, not in N’
r n(n+1)/2 comparisons: O(n2)

Oscillations possible:
r e.g., link cost = amount of carried traffic
r Here: D, C, and B all send to A

1 A A A A
1+e 2+e 0 0 2+e 2+e 0
D 0 0 B D 1+e 1 B D B D 1+e 1 B
0 0
0 e 0 0 1 1+e 0 0
1
C C C C
1
e
… recompute … recompute … recompute
initially
routing
Chapter 4, slide: 27
Distance Vector Algorithm
Bellman-Ford Equation (dynamic programming)
Define
du(z) := cost of least-cost path from u to z
5
Then 3
v w 5
2
u 2 1 z
du(z) = min {c(u,a) + da(z) } 1
3
2
a x 1
y

where min is taken over all neighbors a of u

Chapter 4, slide: 28
Bellman-Ford example
5
3
Clearly, dv(z) = 5, dx(z) = 3, dw(z) = 3
v w 5
2
u 2 1 z B-F equation says:
3
1 du(z) = min { c(u,v) + dv(z),
2
x y
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
Chapter 4, slide: 29
Distance Vector (DV) Algorithm
r Node x knows cost to each neighbor v: c(x,v)

r Node x estimates least cost Dx(y) from it to each


node y

r Node x maintains DV Dx = [Dx(y): y є N ] for all nodes

r Node x also maintains its neighbors’ DV


❖ For each neighbor v, x maintains
Dv = [Dv(y): y є N ]

Chapter 4, slide: 30
Distance vector (DV) algorithm
Basic idea:
r Each node periodically sends its own distance
vector estimate to neighbors

r When a node x receives new DV estimate from


neighbor, it updates its own DV using B-F equation:

Dx(y) ← minv{c(x,v) + Dv(y)} for each node y ∊ N

r The estimate Dx(y) will eventually converge to the


actual least cost after a number of iterations

Chapter 4, slide: 31
Distance Vector (DV) Algorithm
Iterative, asynchronous:
each local iteration caused Each node:
by:
❖ local link cost change wait for (change in local link
❖ DV update message from cost or msg from neighbor)
neighbor

recompute estimates
Distributed:
r each node notifies if DV to any dest has
neighbors only when its DV changed, notify neighbors
changes
❖ neighbors then notify their
neighbors if necessary

Chapter 4, slide: 32
Dx(y) = min{c(x,y) + Dy(y),
c(x,z) + Dz(y)} Dx(z) = min{c(x,y)
= min{2+0 , 7+1} = 2 +
node cost cost
Dy(z), c(x,z) +
x xto y xto y
tablex z 2
0 x z0 2 3 Dz(z)}
y y 2 0

fro
7 = min{2+1 , 7+0} =
fro

∞∞ ∞

m
m

z ∞∞ ∞ z 7
1 1 3
node cost
0
xto y y
y 2 1
tablex z
∞∞∞ x z
y 7
fro

2 0
m

z ∞∞
1 ∞
node cost
z x y
to

tablx z
∞ ∞∞
ey
fro


∞∞ ∞
m

z 71 0
ti Network Layer4-3
me 3
Dx(y) = min{c(x,y) + Dy(y), +
c(x,z) + Dz(y)} Dy(z), c(x,z) +
= min{2+0 , 7+1} = 2 Dz(z)}
node cost cost cost
x xto y xto y xto= min{2+1
y , 7+0} =
tablex 0z 2 x z0 2 3 x 0 z3 2
y 7 y 2 0

fro
fro

∞∞ ∞ y 2 3 0

fro
m

m
z ∞∞ ∞ z 7
1 1 z 13 1
node cost 0cost 0cost
y
y xto y xto y xto y 2 1
tablex z∞∞∞ x 0z 2 x 0 z 2 x z
y 2 0 y 27 0 7
fro

fro

y 2 3 0

fro
m

m
z ∞∞ ∞ z 17 1 z 3
1 1 1
0cost 0cost
node cost
xto y xto y
z x to y

tablx z
∞∞∞ x 0z 2 x 0z 2
y 2 y 23 0
fro

7 0
fro

ey ∞
fro

∞∞ ∞
m

m
m

z 71 0 z 31 1 z 13 1
0 0 ti Network Layer4-3
me 4
cost to w x y z
node w w 0 ∞ 3 ∞

from
table y ∞ ∞ ∞∞

cost to w x y z
x ∞ 0 2 1
node x
y ∞ ∞ ∞∞
from

table
z ∞ ∞ ∞∞ w
3
cost to w x y z
y
3 2 0 5 2 5
y
node y x z
w ∞ ∞ ∞∞
table 1
from

x ∞ ∞ ∞∞
z ∞ ∞ ∞∞

cost to w x y z
z ∞ 1 5 0
node z
x ∞ ∞ ∞∞
from

table
y ∞ ∞ ∞∞
time
Initialization Chapter 4, slide: 35
cost to w x y z cost to w x y z
node w w 0 ∞ 3 ∞ w 0 ∞ 3 ∞

from
from
table y ∞ ∞ ∞∞ y 3 2 0 5

cost to w x y z cost to w x y z
x ∞ 0 2 1 x ∞ 0 2 1
node x
y ∞ ∞ ∞∞ y 3 2 0 5

from
from

table
z ∞ ∞ ∞∞ z ∞ ∞ ∞∞ w
3
cost to w x y z cost to w x y z
y
3 2 0 5 y 3 2 0 5 2 5
y
node y x z
w ∞ ∞ ∞∞ w ∞ ∞ ∞∞
table 1
from
from

x ∞ ∞ ∞∞ x ∞ ∞ ∞∞
z ∞ ∞ ∞∞ z ∞ ∞ ∞∞

y broadcasts DV
cost to w x y z cost to w x y z
to its neighbors x,w,z
z ∞ 1 5 0 z ∞ 1 5 0
node z
x ∞ ∞ ∞∞ x ∞ ∞ ∞∞
from
from

table
y ∞ ∞ ∞∞ y 3 2 0 5
time
Initialization Exchange Chapter 4, slide: 36
cost to w x y z cost to w x y z
node w w 0 ∞ 3 ∞ w 0 ∞ 3 ∞

from
from
table y ∞ ∞ ∞∞ y 3 2 0 5

cost to w x y z cost to w x y z
x ∞ 0 2 1 x ∞ 0 2 1
node x
y ∞ ∞ ∞∞ y 3 2 0 5

from
from

table
z ∞ ∞ ∞∞ z ∞ ∞ ∞∞ w
3
cost to w x y z cost to w x y z
y
y 3 2 0 5 2 5
y 3 2 0 5
node y x z
w ∞ ∞ ∞∞ w 0 ∞ 3 ∞
table 1
from
from

x ∞ ∞ ∞∞ x ∞ ∞ ∞∞
z ∞ ∞ ∞∞ z ∞ ∞ ∞∞

w broadcasts DV
cost to w x y z cost to w x y z
to its neighbors y
z ∞ 1 5 0 z ∞ 1 5 0
node z
x ∞ ∞ ∞∞ x ∞ ∞ ∞∞
from
from

table
y ∞ ∞ ∞∞ y 3 2 0 5
time
Initialization Exchange Chapter 4, slide: 37
cost to w x y z cost to w x y z
node w 0 ∞ 3 ∞ 0 ∞ 3 ∞

from
from
table y ∞ ∞ ∞∞ y 3 2 0 5

cost to w x y z cost to w x y z
∞ 0 2 1 ∞ 0 2 1
node x
y ∞ ∞ ∞∞ y 3 2 0 5

from
from

table
z ∞ ∞ ∞∞ z ∞ ∞ ∞∞ w
3
cost to w x y z cost to w x y z
y
3 2 0 5 3 2 0 5 2 5
node y x z
w ∞ ∞ ∞∞ w 0 ∞ 3 ∞
table 1
from
from

x ∞ ∞ ∞∞ x ∞ 0 2 1
z ∞ ∞ ∞∞ z ∞ ∞ ∞∞
x broadcasts DV
cost to w x y z cost to w x y z
∞ 1 5 0
to its neighbors y,z
∞ 1 5 0
node z
x ∞ ∞ ∞∞ x ∞ 0 2 1
from
from

table
y ∞ ∞ ∞∞ y 3 2 0 5
time
Initialization Exchange Chapter 4, slide: 38
cost to w x y z cost to w x y z
node w 0 ∞ 3 ∞ 0 ∞ 3 ∞

from
from
table y ∞ ∞ ∞∞ y 3 2 0 5

cost to w x y z cost to w x y z
∞ 0 2 1 ∞ 0 2 1
node x
y ∞ ∞ ∞∞ y 3 2 0 5

from
from

table
z ∞ ∞ ∞∞ z ∞ 1 5 0 w
3
cost to w x y z cost to w x y z
y
3 2 0 5 3 2 0 5 2 5
node y x z
w ∞ ∞ ∞∞ w 0 ∞ 3 ∞
table 1
from
from

x ∞ ∞ ∞∞ x ∞ 0 2 1
z ∞ ∞ ∞∞ z ∞ 1 5 0
z broadcasts DV
cost to w x y z cost to w x y z
∞ 1 5 0
to its neighbors x,y
∞ 1 5 0
node z
x ∞ ∞ ∞∞ x ∞ 0 2 1
from
from

table
y ∞ ∞ ∞∞ y 3 2 0 5
time
Initialization Exchange Chapter 4, slide: 39
cost to w x y z cost to w x y z
node w 0 ∞ 3 ∞ 0 ∞ 3 ∞

from
from
table y ∞ ∞ ∞∞ y 3 2 0 5

cost to w x y z cost to w x y z
∞ 0 2 1 ∞ 0 2 1
node x
y ∞ ∞ ∞∞ y 3 2 0 5

from
from

table
z ∞ ∞ ∞∞ z ∞ 1 5 0 w
3
cost to w x y z cost to w x y z
y
3 2 0 5 3 2 0 5 2 5
node y x z
w ∞ ∞ ∞∞ w 0 ∞ 3 ∞
table 1
from
from

x ∞ ∞ ∞∞ x ∞ 0 2 1
z ∞ ∞ ∞∞ z ∞ 1 5 0
All neighbor DV
cost to w x y z cost to w x y z
∞ 1 5 0
broadcasts are done
∞ 1 5 0
node z
x ∞ ∞ ∞∞ x ∞ 0 2 1
from
from

table
y ∞ ∞ ∞∞ y 3 2 0 5
time
Initialization Exchange Chapter 4, slide: 40
cost to w x y z cost to w x y z cost to w x y z
node w 0 ∞ 3 ∞ 0 ∞ 3 ∞ 0 5 3 8

from

from
from
table y ∞ ∞ ∞∞ y 3 2 0 5 y 3 2 0 5

cost to w x y z cost to w x y z
∞ 0 2 1 ∞ 0 2 1
node x
y 3 2 0 5 Dw(x) = min{c(w,y) + Dy(x)}
y ∞ ∞ ∞∞

from
from

table = min{3+2} = 5
z ∞ ∞ ∞∞ z ∞ 1 5 0
Dw(y) = min{c(w,y) + Dy(y)}
cost to w x y z cost to w x y z = min{3+0} = 3
3 2 0 5 3 2 0 5 Dw(z) = min{c(w,y) + Dy(z)}
node y = min{3+5} = 8
w ∞ ∞ ∞∞ w 0 ∞ 3 ∞
table
from
from

x ∞ ∞ ∞∞ x ∞ 0 2 1
z ∞ ∞ ∞∞ z ∞ 1 5 0 w
3
cost to w x y z cost to w x y z
y
∞ 1 5 0 ∞ 1 5 0 2 5
node z x z
x ∞ ∞ ∞∞ x ∞ 0 2 1
from
from

table 1
y ∞ ∞ ∞∞ y 3 2 0 5
time
Initialization Exchange Chapter
Update 4, slide: 41
cost to w x y z cost to w x y z cost to w x y z
node w 0 ∞ 3 ∞ 0 ∞ 3 ∞ 0 5 3 8

from

from
from
table y ∞ ∞ ∞∞ y 3 2 0 5 y 3 2 0 5

cost to w x y z cost to w x y z cost to w x y z


∞ 0 2 1 ∞ 0 2 1 5 0 2 1
node x
y ∞ ∞ ∞∞ y 3 2 0 5 y 3 2 0 5

from

from
from

table
z ∞ ∞ ∞∞ z ∞ 1 5 0 z ∞ 1 5 0

cost to w x y z cost to w x y z Dx=(z)


(y) = min{c(x,y) + Dyy(y),
(z),
Dx(w) x min{c(x,y) + D (w),
y + D (z)}
3 2 0 5 3 2 0 5 c(x,z)
c(x,z) + Dz(w)}zz(y)}
node y = min{2+5,
table
w ∞ ∞ ∞∞ w 0 ∞ 3 ∞ = min{2+3, 1+∞}1+=0
min{2+0, } = 12
55
from
from

x ∞ ∞ ∞∞ x ∞ 0 2 1
z ∞ ∞ ∞∞ z ∞ 1 5 0 w
3
cost to w x y z cost to w x y z
y
∞ 1 5 0 ∞ 1 5 0 2 5
node z x z
x ∞ ∞ ∞∞ x ∞ 0 2 1
from
from

table 1
y ∞ ∞ ∞∞ y 3 2 0 5
time
Initialization Exchange Chapter
Update 4, slide: 42
Distance Vector: link cost changes
See what happens when link cost changes:
r node detects local link cost change 1
y
r updates routing info, recalculates 4 1
distance vector x z
50
r if DV changes, notify neighbors

At time t0, y detects the link-cost change, updates its DV,


and informs its neighbors.
“good New Dy(x) = min{c(y,x), c(y,z)+Dz(x)} = min{1,1+5}=1
news At time t1, z receives the update from y and updates its DV.
travels It computes a new least cost to x and sends its neighbors its DV.
New Dz(x) = min{c(z,x), c(z,y)+Dy(x)} = min{50,1+1} = 2
fast”
At time t2, y receives z’s update and updates its DV.
New Dy(x) = min{c(y,x), c(y,z)+Dz(x)} = min{1,1+2}=1 (no change!)

y’s least costs do not change and hence y does not send any
message to z. Chapter 4, slide: 43
Distance Vector: link cost changes
Suppose link cost changes from 4 to 60
Initially: Dy(x) = 4 and Dz(x) = 5 (focus on distance from y & z to x)
r Node y: 60
❖ detects the change, computes its DV y
4 1
❖ what is the new Dy(x) ?
x z
Dy(x) = min{c(y,x), c(y,z)+Dz(x)} = min{60,1+5}=6 50
❖ sends its new DV to z
r Node z:
Dz(x) stored in
❖ receives the update from y;new Dy(x) = 6
y’s DV from a
❖ computes its DV. What is the new Dz(x) ?
Dz(x) = min{c(z,x), c(z,y)+Dy(x)} = min{50,1+6}=7
Previous update
❖ sends its new DV to y “Dz(x) = 5”
r Node y:
❖ receives the update from z; new Dz(x) = 7 Can you
❖ computes its DV. what is the new Dy(x) ? guess what
Dy(x) = min{c(y,x), c(y,z)+Dz(x)} = min{60,1+7}=8 will happen?
❖ sends its new DV to z again
Chapter 4, slide: 44
Distance Vector: link cost changes
“routing loop” problem
60
y reaches x thru z; z reaches x thru y y
4 1
x z
50
“count to infinity” problem!
44 iterations before algorithm stabilizes:
Imagine what happens if c(z,x) has cost of 10000 instead of 50 !
and c(y,x) changes from 4 to 10010

Solution: Poisoned reverse:


If z routes via y to get to x, z tells y its (z’s) distance to x
is infinite (so y won’t route to x via z)

Chapter 4, slide: 45
Poisoned reverse
60
y
4 1
x z
50

Chapter 4, slide: 46
Comparison of LS and DV algorithms
Message complexity
r LS: with n nodes, E links, O(nE) msgs sent;
each link info should be sent to each node
r DV: exchange between neighbors only

Speed of Convergence
r LS: computation grows at O(n2);
= (n-1) + (n-2) + … + 1 = n(n+1)/2
❖may have oscillations
r DV: computation grows at O(n3); in complete graph
❖ may be routing loops and count-to-infinity problem
r Link state routing converges quickly. Distance vector can take a very long time.
r Link state routing is internally much more complicated. Distance vector is brutally
simple.
r Link state has higher infrastructure requirements. More memory, more peak CPU
load.
Chapter 4, slide: 47
Routing in Internet: Hierarchical Routing

Our routing study thus far - idealization


r all routers identical

scale: with 200 million administrative autonomy


destinations: r internet = network of
r can’t store all dest’s in networks
routing tables! r each network admin may want
r routing table exchange to control routing in its own
would swamp links! network

Chapter 4, slide: 48
Hierarchical Routing
r aggregate routers into regions, “autonomous
systems” (AS)

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

Intra-AS Inter-AS
Routing Routing
algorithm algorithm

Forwarding
table

Chapter 4, slide: 49
Hierarchical Routing

Intra-AS routing Inter-AS routing


r routers in same AS run r Use inter-AS routing
same routing protocol to route across ASes

r routers in different r Across different


AS can run different ASes, routing protocol
intra-AS routing must be agreed upon
protocol

Chapter 4, slide: 50
Routing in the Internet: protocols
Intra-AS routing protocols:
r also known as Interior Gateway Protocols (IGP)
r most common Intra-AS routing protocols:
r Distance vector algorithm:
❖ RIP: Routing Information Protocol

❖ OSPF: Open Shortest Path First


Link State algorithm:
❖ IGRP: Interior Gateway Routing Protocol (Cisco
proprietary)
Inter-AS routing protocols:
❖ BGP (Border Gateway Protocol)

Chapter 4, slide: 51
RIP ( Routing Information Protocol)
r Uses Distance Vector routing

r distance vectors: exchanged among neighbors every


30 sec via Response Message (also called
advertisement)

r each advertisement: list of up to 25 destination nets


within AS

r If no advertisement heard after 180 sec -->


neighbor/link will be declared dead

r poison reverse used to prevent ping-pong loops


(infinite distance = 16 hops)
Chapter 4, slide: 52
OSPF (Open Shortest Path First)
r “open”: publicly available

r uses Link State algorithm; i.e., Dijkstra’s


algorithm

r advertisements disseminated to entire AS via


flooding

r OSPF messages carried directly over IP (rather


than TCP or UDP
Chapter 4, slide: 53
Internet inter-AS routing: BGP
r BGP (Border Gateway Protocol): the de
facto standard
r BGP provides each AS a means to:
1. Obtain subnet reachability information from
neighboring ASs.
2. Propagate reachability information to all
AS-internal routers.
3. Determine “good” routes to subnets based on
reachability information and policy.

Chapter 4, slide: 54
Why different Intra- and Inter-AS routing ?

Policy:
r Inter-AS: admin wants control over how its traffic
routed, who routes through its net.
r Intra-AS: single admin, so no policy decisions needed
Scale:
r hierarchical routing saves table size, reduced update
traffic
Performance:
r Intra-AS: can focus on performance
r Inter-AS: policy may dominate over performance

Chapter 4, slide: 55

You might also like