Chapter 4: Network Layer Introduction IP: Internet Protocol Routing in the Internet

advertisement
Chapter 4: Network Layer
 Introduction
 IP: Internet Protocol
 IPv4 addressing
 NAT
 IPv6
 Routing algorithms
 Link state
 Distance Vector
 Routing in the Internet
 RIP
 OSPF
 BGP
Chapter 4, slide: 1
Routing versus forwarding
routing algorithm
local forwarding table
header value output link
0100
0101
0111
1001
3
2
2
1
value in arriving
packet’s header
0111
1
3 2
Chapter 4, slide: 2
Destination / next hop
 Destination address in IP datagram is always ultimate
destination
 Router masks destination address to obtain the network address
 Routing table relates network address to next-hop address
 Router looks up network address and forwards datagram to
next-hop address
 Sending host puts destination internet address into packet
 Destination address can be interpreted by any intermediate
router
 Routers examine address and forward packet toward the
destination
3
Chapter 4, slide: 3
Static routing
 Static routing table is loaded with values
when the system starts
 Routes don't change unless an error is
detected
 Static routing table on each host can be very
small
One entry for the hosts in the same local segment
 One entry for the rest of the traffic which is
forwarded to the router

 Many small networks use this type of routing
table
 Static routing is easy, but it doesn't scale up
4
Chapter 4, slide: 4
Dynamic routing
 Dynamic routing table is loaded with values
when the system starts
 Route propagation software (routing
software) is also loaded
 The routing software on one router interacts
with routing software on other routers to
"learn" about optimal routes to each location
 The routing software updates the local table
to ensure datagrams follow optimal routes
5
Chapter 4, slide: 5
Dynamic routing
 Each router runs routing software
according to specified protocol
 Each router "learns" what neighboring
routers can be reached
 The routers periodically exchange routing
information
 Local routing tables are updated
continuously
 More later on router “learning”
6
Chapter 4, slide: 6
Optimal routes
 Many algorithms
Find shortest path
 Find path with least traffic
 Etc.

 Routers can establish optimal routes
7
Chapter 4, slide: 7
Computing shortest path
 Represent WAN as a graph
 Compute shortest path from each node to
every other node
 Extract next-hop information from resulting
path information
 Insert next-hop information into routing
tables
8
Chapter 4, slide: 8
Weights
 Represent costs as weights on edges in graph
 Weights are determined by speed, distance,
additional hardware, bottlenecks, etc.
 Shortest path is the path with lowest total
weight (sum of weights of all edges in the
path)
 Shortest path is not necessarily fewest edges
or fewest hops
9
Chapter 4, slide: 9
Graph abstraction
5
2
u
2
1
Graph: G = (N,E)
v
x
3
w
3
1
5
z
1
y
2
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: 10
Graph abstraction: costs
5
2
u
v
2
1
x
• c(x,x’) or weight=cost of link (x,x’)
3
w
3
1
z
1
y
- e.g., c(w,z) = 5
5
2
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 the least-cost path
Chapter 4, slide: 11
Chapter 4: Network Layer
 Introduction
 Virtual circuit and
datagram networks
 IP: Internet Protocol
 IPv4 addressing
 NAT
 IPv6
 Routing algorithms
 Link state
 Distance Vector
 Hierarchical routing
 Routing in the Internet
 RIP
 OSPF
 BGP
Chapter 4, slide: 12
A Link-State Routing Algorithm
Dijkstra’s algorithm
 Each node computes least
cost paths from it to all
other nodes
Notation:
 c(x,y): link cost from node
x to y; = ∞ if not direct
neighbors
 Each node knows entire net
 D(v): current value of cost
of path from source to
dest. v
 Each node broadcasts “link
 p(v): predecessor node
along path from source to v
topology, all link costs
state” of its neighbors
only, but to all
 iterative: after k
iterations, know least cost
path to k dest.’s
 N': set of nodes whose
least cost path definitively
known
Chapter 4, slide: 13
Dijkstra’s algorithm: example
Step
0
1
2
3
4
5
D(v),p(v) D(w),p(w)
2,u
5,u
N'
u
5
2
u
v
2
1
x
3
w
3
1
5
z
1
y
D(x),p(x) D(y),p(y) D(z),p(z)
∞
∞
1,u
1 Initialization:
2 N' = {u}
3 for all nodes b
4
if b adjacent to u
5
then D(b) = c(u,b)
6
else D(b) = ∞
2
Chapter 4, slide: 14
Dijkstra’s algorithm: example
Step
0
1
2
3
4
5
D(v),p(v) D(w),p(w)
2,u
5,u
2,u
4,x
N'
u
ux
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 & not in N' :
12
D(b) = min( D(b), D(c) + c(c,b) )
15 until all nodes in N'
5
2
u
v
2
1
x
3
w
3
1
5
z
1
y
D(x),p(x) D(y),p(y) D(z),p(z)
∞
∞
1,u
2,x
2
Chapter 4, slide: 15
Dijkstra’s algorithm: example
Step
0
1
2
3
4
5
D(v),p(v) D(w),p(w)
2,u
5,u
2,u
4,x
2,u
3,y
N'
u
ux
uxy
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 & not in N' :
12
D(b) = min( D(b), D(c) + c(c,b) )
15 until all nodes in N'
5
2
u
v
2
1
x
3
w
3
1
5
z
1
y
D(x),p(x) D(y),p(y) D(z),p(z)
∞
∞
1,u
∞
2,x
4,y
2
Chapter 4, slide: 16
Dijkstra’s algorithm: example
Step
0
1
2
3
4
5
D(v),p(v) D(w),p(w)
2,u
5,u
2,u
4,x
2,u
3,y
3,y
N'
u
ux
uxy
uxyv
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 & not in N' :
12
D(b) = min( D(b), D(c) + c(c,b) )
15 until all nodes in N'
5
2
u
v
2
1
x
3
w
3
1
5
z
1
y
D(x),p(x) D(y),p(y) D(z),p(z)
∞
∞
1,u
∞
2,x
4,y
4,y
2
Chapter 4, slide: 17
Dijkstra’s algorithm: example
D(v),p(v) D(w),p(w)
2,u
5,u
2,u
4,x
2,u
3,y
3,y
Step
N'
0
u
1
ux
2
uxy
3
uxyv
4 uxyvw
5
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 & not in N' :
12
D(b) = min( D(b), D(c) + c(c,b) )
15 until all nodes in N'
5
2
u
v
2
1
x
3
w
3
1
5
z
1
y
D(x),p(x) D(y),p(y) D(z),p(z)
∞
∞
1,u
∞
2,x
4,y
4,y
4,y
2
Chapter 4, slide: 18
Dijkstra’s algorithm: example
D(v),p(v) D(w),p(w)
2,u
5,u
2,u
4,x
2,u
3,y
3,y
Step
N'
0
u
1
ux
2
uxy
3
uxyv
4 uxyvw
5 uxyvwz
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 & not in N' :
12
D(b) = min( D(b), D(c) + c(c,b) )
15 until all nodes in N'
5
2
u
v
2
1
x
3
w
3
1
5
z
1
y
D(x),p(x) D(y),p(y) D(z),p(z)
∞
∞
1,u
∞
2,x
4,y
4,y
4,y
2
Chapter 4, slide: 19
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: 20
Dijkstra’s algorithm: example
Resulting shortest-path tree from u:
v
To remember !
w
u
z
x
y
Resulting forwarding table in u:
destination
link
v
x
(u,v)
(u,x)
y
(u,x)
w
(u,x)
z
(u,x)
 Each node must have
complete knowledge of
entire network
 Broadcast all link
states
 Each node constructs
its own table
Chapter 4, slide: 21
Dijkstra’s algorithm, discussion
Algorithm complexity: n nodes
 each iteration: need to check all nodes, w, not in N’
 n(n+1)/2 comparisons: O(n2)
Oscillations possible:
 e.g., link cost = amount of carried traffic
 Here: D, C, and B all send to A
D
1
1
0
A
0 0
C
e
1+e
e
initially
B
1
2+e
A
0
D 1+e 1 B
0
0
C
… recompute
routing
0
D
1
A
0 0
C
2+e
B
1+e
… recompute
2+e
A
0
D 1+e 1 B
0
0
C
… recompute
Chapter 4, slide: 22
Chapter 4: Network Layer
 Introduction
 Virtual circuit and
datagram networks
 IP: Internet Protocol
 IPv4 addressing
 NAT
 IPv6
 Routing algorithms
 Link state
 Distance Vector
 Routing in the Internet
 RIP
 OSPF
 BGP
Chapter 4, slide: 23
Distance Vector Algorithm
Bellman-Ford Equation (dynamic programming)
Define
du(z) := cost of least-cost path from u to z
5
Then
du(z) = min {c(u,a) + da(z) }
a
2
u
v
2
1
x
3
w
3
1
5
z
1
y
2
where min is taken over all neighbors a of u
Chapter 4, slide: 24
Bellman-Ford example
5
2
u
v
2
1
x
3
w
3
1
5
z
1
y
Clearly, dv(z) = 5, dx(z) = 3, dw(z) = 3
2
B-F equation says:
du(z) = min { c(u,v) + dv(z),
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: 25
Distance Vector (DV) Algorithm
 Node x knows cost to each neighbor v: c(x,v)
 Node x estimates least cost Dx(y) from it to each
node y
 Node x maintains DV Dx = [Dx(y): y є N ] for all nodes
 Node x also maintains its neighbors’ DV

For each neighbor v, x maintains
Dv = [Dv(y): y є N ]
Chapter 4, slide: 26
Distance vector (DV) algorithm
Basic idea:
 Each node periodically sends its own distance
vector estimate to neighbors
 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
 The estimate Dx(y) will eventually converge to the
actual least cost after a number of iterations
Chapter 4, slide: 27
Distance Vector (DV) Algorithm
Iterative, asynchronous:
each local iteration caused
by:


local link cost change
DV update message from
neighbor
Distributed:
 each node notifies
neighbors only when its DV
changes

Each node:
wait for (change in local link
cost or msg from neighbor)
recompute estimates
if DV to any dest has
changed, notify neighbors
neighbors then notify their
neighbors if necessary
Chapter 4, slide: 28
node w
table
from
cost to
w x y z
0 ∞ 3 ∞
y ∞ ∞ ∞∞
cost to w x y z
from
node x
table
∞ 0 2 1
y ∞ ∞ ∞∞
z ∞ ∞ ∞∞
w
3
cost to w x y z
from
node y
table
3 2 0 5
w ∞ ∞ ∞∞
x ∞ ∞ ∞∞
z ∞ ∞ ∞∞
x
2
y
1
5
z
cost to w x y z
from
node z
table
∞ 1 5 0
x ∞ ∞ ∞∞
y ∞ ∞ ∞∞
Initialization
time
Chapter 4, slide: 29
w x y z
0 ∞ 3 ∞
y ∞ ∞ ∞∞
cost to
from
node w
table
from
cost to
w x y z
0 ∞ 3 ∞
y 3 2 0 5
∞ 0 2 1
∞ 0 2 1
node x
table
y ∞ ∞ ∞∞
z ∞ ∞ ∞∞
from
cost to w x y z
from
cost to w x y z
y 3 2 0 5
z ∞ ∞ ∞∞
3 2 0 5
3 2 0 5
node y
table
w ∞ ∞ ∞∞
x ∞ ∞ ∞∞
z ∞ ∞ ∞∞
from
cost to w x y z
from
cost to w x y z
w ∞ ∞ ∞∞
x ∞ ∞ ∞∞
z ∞ ∞ ∞∞
∞ 1 5 0
node z
table
x ∞ ∞ ∞∞
y ∞ ∞ ∞∞
Initialization
from
∞ 1 5 0
from
cost to w x y z
cost to w x y z
x ∞ ∞ ∞∞
y 3 2 0 5
Exchange
w
3
x
2
y
1
5
z
y broadcasts DV
to its neighbors x,w,z
time
Chapter 4, slide: 30
w x y z
0 ∞ 3 ∞
y ∞ ∞ ∞∞
cost to
from
node w
table
from
cost to
w x y z
0 ∞ 3 ∞
y 3 2 0 5
∞ 0 2 1
∞ 0 2 1
node x
table
y ∞ ∞ ∞∞
z ∞ ∞ ∞∞
from
cost to w x y z
from
cost to w x y z
y 3 2 0 5
z ∞ ∞ ∞∞
3 2 0 5
3 2 0 5
node y
table
w ∞ ∞ ∞∞
x ∞ ∞ ∞∞
z ∞ ∞ ∞∞
from
cost to w x y z
from
cost to w x y z
w 0 ∞ 3 ∞
x ∞ ∞ ∞∞
z ∞ ∞ ∞∞
∞ 1 5 0
node z
table
x ∞ ∞ ∞∞
y ∞ ∞ ∞∞
Initialization
from
∞ 1 5 0
from
cost to w x y z
cost to w x y z
x ∞ ∞ ∞∞
y 3 2 0 5
Exchange
w
3
x
2
y
5
1
z
w broadcasts DV
to its neighbors y
time
Chapter 4, slide: 31
w x y z
0 ∞ 3 ∞
y ∞ ∞ ∞∞
cost to
from
node w
table
from
cost to
w x y z
0 ∞ 3 ∞
y 3 2 0 5
∞ 0 2 1
∞ 0 2 1
node x
table
y ∞ ∞ ∞∞
z ∞ ∞ ∞∞
from
cost to w x y z
from
cost to w x y z
y 3 2 0 5
z ∞ ∞ ∞∞
3 2 0 5
3 2 0 5
node y
table
w ∞ ∞ ∞∞
x ∞ ∞ ∞∞
z ∞ ∞ ∞∞
from
cost to w x y z
from
cost to w x y z
w 0 ∞ 3 ∞
x ∞ 0 2 1
z ∞ ∞ ∞∞
∞ 1 5 0
node z
table
x ∞ ∞ ∞∞
y ∞ ∞ ∞∞
Initialization
from
∞ 1 5 0
from
cost to w x y z
cost to w x y z
x ∞ 0 2 1
y 3 2 0 5
Exchange
w
3
x
2
y
1
5
z
x broadcasts DV
to its neighbors y,z
time
Chapter 4, slide: 32
w x y z
0 ∞ 3 ∞
y ∞ ∞ ∞∞
cost to
from
node w
table
from
cost to
w x y z
0 ∞ 3 ∞
y 3 2 0 5
∞ 0 2 1
∞ 0 2 1
node x
table
y ∞ ∞ ∞∞
z ∞ ∞ ∞∞
from
cost to w x y z
from
cost to w x y z
y 3 2 0 5
z ∞ 1 5 0
3 2 0 5
3 2 0 5
node y
table
w ∞ ∞ ∞∞
x ∞ ∞ ∞∞
z ∞ ∞ ∞∞
from
cost to w x y z
from
cost to w x y z
w 0 ∞ 3 ∞
x ∞ 0 2 1
z ∞ 1 5 0
∞ 1 5 0
node z
table
x ∞ ∞ ∞∞
y ∞ ∞ ∞∞
Initialization
from
∞ 1 5 0
from
cost to w x y z
cost to w x y z
x ∞ 0 2 1
y 3 2 0 5
Exchange
w
3
x
2
y
1
5
z
z broadcasts DV
to its neighbors x,y
time
Chapter 4, slide: 33
w x y z
0 ∞ 3 ∞
y ∞ ∞ ∞∞
cost to
from
node w
table
from
cost to
w x y z
0 ∞ 3 ∞
y 3 2 0 5
∞ 0 2 1
∞ 0 2 1
node x
table
y ∞ ∞ ∞∞
z ∞ ∞ ∞∞
from
cost to w x y z
from
cost to w x y z
y 3 2 0 5
z ∞ 1 5 0
3 2 0 5
3 2 0 5
node y
table
w ∞ ∞ ∞∞
x ∞ ∞ ∞∞
z ∞ ∞ ∞∞
from
cost to w x y z
from
cost to w x y z
w 0 ∞ 3 ∞
x ∞ 0 2 1
z ∞ 1 5 0
∞ 1 5 0
node z
table
x ∞ ∞ ∞∞
y ∞ ∞ ∞∞
Initialization
from
∞ 1 5 0
from
cost to w x y z
cost to w x y z
x ∞ 0 2 1
y 3 2 0 5
Exchange
w
3
x
2
y
1
5
z
All neighbor DV
broadcasts are done
time
Chapter 4, slide: 34
0 ∞ 3 ∞
y ∞ ∞ ∞∞
cost to
w x y z
0 ∞ 3 ∞
y 3 2 0 5
∞ 0 2 1
∞ 0 2 1
node x
table
y ∞ ∞ ∞∞
z ∞ ∞ ∞∞
from
cost to w x y z
from
cost to w x y z
y 3 2 0 5
z ∞ 1 5 0
3 2 0 5
3 2 0 5
node y
table
w ∞ ∞ ∞∞
x ∞ ∞ ∞∞
z ∞ ∞ ∞∞
from
cost to w x y z
from
cost to w x y z
w 0 ∞ 3 ∞
x ∞ 0 2 1
z ∞ 1 5 0
∞ 1 5 0
∞ 1 5 0
node z
table
x ∞ ∞ ∞∞
y ∞ ∞ ∞∞
Initialization
from
cost to w x y z
from
cost to w x y z
x ∞ 0 2 1
y 3 2 0 5
Exchange
w x y z
cost to
from
w x y z
from
node w
table
from
cost to
0 5 3 8
y 3 2 0 5
Dw(x) = min{c(w,y) + Dy(x)}
= min{3+2} = 5
Dw(y) = min{c(w,y) + Dy(y)}
= min{3+0} = 3
Dw(z) = min{c(w,y) + Dy(z)}
= min{3+5} = 8
w
3
x
2
y
1
5
z
time
Chapter
4, slide: 35
Update
0 ∞ 3 ∞
y ∞ ∞ ∞∞
cost to
w x y z
0 ∞ 3 ∞
y 3 2 0 5
w x y z
cost to
from
w x y z
from
node w
table
from
cost to
0 5 3 8
y 3 2 0 5
∞ 0 2 1
∞ 0 2 1
5 0 2 1
node x
table
y ∞ ∞ ∞∞
z ∞ ∞ ∞∞
y 3 2 0 5
z ∞ 1 5 0
3 2 0 5
3 2 0 5
node y
table
w ∞ ∞ ∞∞
x ∞ ∞ ∞∞
z ∞ ∞ ∞∞
from
cost to w x y z
from
cost to w x y z
w 0 ∞ 3 ∞
x ∞ 0 2 1
z ∞ 1 5 0
∞ 1 5 0
∞ 1 5 0
node z
table
x ∞ ∞ ∞∞
y ∞ ∞ ∞∞
Initialization
from
cost to w x y z
from
cost to w x y z
x ∞ 0 2 1
y 3 2 0 5
Exchange
from
cost to w x y z
from
cost to w x y z
from
cost to w x y z
y 3 2 0 5
z ∞ 1 5 0
Dxx=(z)
= min{c(x,y)
Dyy(z),
(y)
(y),
Dx(w)
min{c(x,y)
+ Dy+(w),
c(x,z)
Dzz(z)}
(y)}
c(x,z)
+ Dz+(w)}
= min{2+5,
} = 12
min{2+0,
55
= min{2+3,
1+∞}1+=0
w
3
x
2
y
1
5
z
time
Chapter
4, slide: 36
Update
Distance Vector: link cost changes
See what happens when link cost changes:
 node detects local link cost change
 updates routing info, recalculates
distance vector
 if DV changes, notify neighbors
“good
news
travels
fast”
1
x
4
y
1
50
z
At time t0, y detects the link-cost change, updates its DV,
and informs its neighbors.
New Dy(x) = min{c(y,x), c(y,z)+Dz(x)} = min{1,1+5}=1
At time t1, z receives the update from y and updates its DV.
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
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: 37
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)
 Node y:
60
y
 detects the change, computes its DV
4
1
 what is the new Dy(x) ?
x
z
50
Dy(x) = min{c(y,x), c(y,z)+Dz(x)} = min{60,1+5}=6
 sends its new DV to z

Node z:




receives the update from y; w/ new Dy(x) = 6
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
sends its new DV to y
Node y:



receives the update from z; w/ new Dz(x) = 7
computes its DV. what is the new Dy(x) ?
Dy(x) = min{c(y,x), c(y,z)+Dz(x)} = min{60,1+7}=8
sends its new DV to z again
Dz(x) stored in
y’s DV from a
Previous update
“Dz(x) = 5”
Can you
guess what
will happen?
Chapter 4, slide: 38
Distance Vector: link cost changes
“routing loop” problem
y reaches x thru z; z reaches x thru y
“count to infinity” problem!
60
x
4
y
1
50
z
44 iterations before algorithm stabilizes:
Imagine what happens if we have a cost of 10000 instead of 4!
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: 39
Comparison of LS and DV algorithms
Message complexity
 LS: with n nodes, E links, O(nE) msgs sent;
each link info should be sent to each node
 DV: exchange between neighbors only
Speed of Convergence
 LS: computation grows at O(n2);
= (n-1) + (n-2) + … + 1 = n(n+1)/2
may have oscillations
 DV: convergence time varies
 may be routing loops and count-to-infinity problem

Chapter 4, slide: 40
Chapter 4: Network Layer
 Introduction
 IP: Internet Protocol
 IPv4 addressing
 NAT
 IPv6
 Routing algorithms
 Link state
 Distance Vector
 Routing in the Internet
 RIP
 OSPF
 BGP
Chapter 4, slide: 41
Routing in Internet: Hierarchical Routing
Our routing study thus far - idealization
 all routers identical
 network “flat”
… not true in practice
scale: with 200 million
destinations:
 can’t store all dest’s in
routing tables!
 routing table exchange
would swamp links!
administrative autonomy
 internet = network of
networks
 each network admin may
want to control routing in its
own network
Chapter 4, slide: 42
Hierarchical Routing
 aggregate routers into regions, “autonomous
systems” (AS)
3c
3a
3b AS3
1a
Gateway router
 Direct link to router in
another AS
2a
1c
1d
1b AS1
2c
 forwarding table
2b
AS2
configured by both
intra- and inter-AS
routing algorithm

Intra-AS
Routing
algorithm
Inter-AS
Routing
algorithm
Forwarding
table

intra-AS sets entries
for internal dests
inter-AS & intra-As
sets entries for
external dests
Chapter 4, slide: 43
Hierarchical Routing
Intra-AS routing
 routers in same AS run
same routing protocol
Inter-AS routing
 Use inter-AS routing
to route across ASes
 routers in different
 Across different
AS can run different
intra-AS routing
protocol
ASes, routing protocol
must be agreed upon
Chapter 4, slide: 44
Inter-AS tasks
AS1 must:
1. learn which dests are
reachable through
AS2, which through
AS3
2. propagate this
reachability info to all
routers in AS1
Job of inter-AS routing!
 suppose router in AS1
receives datagram
destined outside of
AS1:
 router should
forward packet to
gateway router, but
which one?
3c
3b
3a
AS3
1a
2a
1c
1d
1b
AS1
2c
2b
AS2
Chapter 4, slide: 45
Example: Setting forwarding table in router 1d
 suppose AS1 learns (via inter-AS protocol) that subnet
x reachable via AS3 (gateway 1c) but not via AS2.
 inter-AS protocol propagates reachability info to all
internal routers.
 router 1d determines from intra-AS routing info that
its interface I is on the least cost path to 1c.
 installs forwarding table entry (x,I)
x
3c
3a
3b
AS3
1a
2a
1c
1d
1b AS1
2c
2b
AS2
Chapter 4, slide: 46
Example: Choosing among multiple ASes
 now suppose AS1 learns from inter-AS protocol that
subnet x is reachable from AS3 and from AS2.
 to configure forwarding table, router 1d must
determine towards which gateway it should forward
packets for dest x.
 this is also job of inter-AS routing protocol!
x
3c
3a
3b
AS3
1a
2a
1c
1d
1b
AS1
2c
2b
AS2
Chapter 4, slide: 47
Example: Choosing among multiple ASes
 now suppose AS1 learns from inter-AS protocol that
subnet x is reachable from AS3 and from AS2.
 to configure forwarding table, router 1d must
determine towards which gateway it should forward
packets for dest x.
 this is also job of inter-AS routing protocol!
 hot potato routing: send packet towards closest of
two routers.
Learn from inter-AS
protocol that subnet
x is reachable via
multiple gateways
Use routing info
from intra-AS
protocol to determine
costs of least-cost
paths to each
of the gateways
Hot potato routing:
Choose the gateway
that has the
smallest least cost
Determine from
forwarding table the
interface I that leads
to least-cost gateway.
Enter (x,I) in
forwarding table
Chapter 4, slide: 48
Routing in the Internet: protocols
Intra-AS routing protocols:
 also known as Interior Gateway Protocols (IGP)
 most common Intra-AS routing protocols:

RIP: Routing Information Protocol

OSPF: Open Shortest Path First

IGRP: Interior Gateway Routing Protocol (Cisco
proprietary)
Inter-AS routing protocols:
 BGP (Border Gateway Protocol)
Chapter 4, slide: 49
RIP ( Routing Information Protocol)
 distance vector algorithm
 distance metric: # of hops (max = 15 hops)
From router A to subsets:
u
v
A
z
C
B
D
w
x
y
destination hops
u
1
v
2
w
2
x
3
y
3
z
2
Chapter 4, slide: 50
RIP advertisements
 distance vectors: exchanged among
neighbors every 30 sec via Response
Message (also called advertisement)
 each advertisement: list of up to 25
destination nets within AS
Chapter 4, slide: 51
RIP: Example
z
w
A
x
Destination Network
w
y
z
x
….
D
B
C
y
Next Router
Num. of hops to dest.
….
....
A
B
B
--
Routing table in D
2
2
7
1
Chapter 4, slide: 52
RIP: Example
Dest
w
x
z
….
Next
C
…
w
hops
1
1
4
...
A
Advertisement
from A to D
z
x
Destination Network
w
y
z
x
….
D
B
C
y
Next Router
Num. of hops to dest.
….
....
A
B
B
--
Routing table in D
2
2
7
1
Chapter 4, slide: 53
RIP: Example
Dest
w
x
z
….
Next
C
…
w
hops
1
1
4
...
A
Advertisement
from A to D
z
x
Destination Network
w
y
z
x
….
D
B
C
y
Next Router
Num. of hops to dest.
….
....
A
B
B A
--
Routing table in D
2
2
7 5
1
Chapter 4, slide: 54
RIP: Link Failure and Recovery
If no advertisement heard after 180 sec -->
neighbor/link will be declared dead




new advertisements sent to neighbors
neighbors in turn send out new advertisements (if
tables changed)
link failure info quickly propagates to entire net
poison reverse used to prevent ping-pong loops
(infinite distance = 16 hops)
Chapter 4, slide: 55
OSPF (Open Shortest Path First)
 “open”: publicly available
 uses Link State algorithm; i.e., Dijkstra’s
algorithm
 advertisements disseminated to entire AS via
flooding
 OSPF messages carried directly over IP (rather
than TCP or UDP
Chapter 4, slide: 56
Internet inter-AS routing: BGP
 BGP (Border Gateway Protocol): the de
facto standard
 BGP provides each AS a means to:
1.
2.
3.
4.
Obtain subnet reachability information from
neighboring ASs.
Propagate reachability information to all ASinternal routers.
Determine “good” routes to subnets based on
reachability information and policy.
allows subnet to advertise its existence to
rest of Internet: “I am here”
Chapter 4, slide: 57
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 needed
Scale:
 hierarchical routing saves table size, reduced update
traffic
Performance:
 Intra-AS: can focus on performance
 Inter-AS: policy may dominate over performance
Chapter 4, slide: 58
Download