introduction to computer networking guy leduc chapter 5 ... · 5 network layer control plane 5-9...
TRANSCRIPT
1
Network Layer Control Plane 5-1
Introduction to Computer Networking
Guy Leduc
Chapter 5 Network Layer: The Control Plane
Computer Networking: A Top Down Approach, 7th edition. Jim Kurose, Keith RossAddison-Wesley, April 2016.
© From Computer Networking, by Kurose&Ross Network Layer Control Plane 5-2
Chapter 5: Network Layer Control Plane
Chapter goals: ❒ understand principles behind network control
plane :❍ traditional routing algorithms
❒ and their instantiation, implementation in the Internet:❍ OSPF, RIP, BGP
2
Network Layer Control Plane 5-3
Chapter 5: outline
❒ 5.1 Introduction❒ 5.2 ICMP: The Internet Control Message Protocol❒ 5.3 Intra-domain routing algorithms
❍ Graph abstraction and routing metrics❍ Link state routing
• OSPF❍ Distance Vector routing
• RIP
❒ 5.4 Inter-domain routing❍ BGP
© From Computer Networking, by Kurose&Ross Network Layer Control Plane 5-4
Key Network-Layer Functions❒ forwarding: move packets
from router’s input to appropriate router output
❒ routing: determine route taken by packets from source to destination
data plane
control plane
Two approaches to structuring network control plane:! per-router control (traditional)! logically centralized control (software defined networking)(Only the first one will be studied in this course)
3
Per-router control plane
RoutingAlgorithm
Individual routing algorithm components in each and every router interact in the control plane
dataplane
controlplane
4.1 • OVERVIEW OF NETWORK LAYER 309
tables. In this example, a routing algorithm runs in each and every router and both forwarding and routing functions are contained within a router. As we’ll see in Sec-tions 5.3 and 5.4, the routing algorithm function in one router communicates with the routing algorithm function in other routers to compute the values for its forward-ing table. How is this communication performed? By exchanging routing messages containing routing information according to a routing protocol! We’ll cover routing algorithms and protocols in Sections 5.2 through 5.4.
The distinct and different purposes of the forwarding and routing functions can be further illustrated by considering the hypothetical (and unrealistic, but technically feasible) case of a network in which all forwarding tables are configured directly by human network operators physically present at the routers. In this case, no routing protocols would be required! Of course, the human operators would need to interact with each other to ensure that the forwarding tables were configured in such a way that packets reached their intended destinations. It’s also likely that human configu-ration would be more error-prone and much slower to respond to changes in the net-work topology than a routing protocol. We’re thus fortunate that all networks have both a forwarding and a routing function!
Values in arrivingpacket’s header
1
23
Local forwardingtable
header
0100011001111001
1101
3221
output
Control plane
Data plane
Routing algorithm
Figure 4.2 ♦ Routing algorithms determine values in forward tables
M04_KURO4140_07_SE_C04.indd 309 11/02/16 3:14 PM
5-5Network Layer: Data Plane
1
2
0111
values in arriving packet header
3
© From Computer Networking, by Kurose&Ross
© From Computer Networking, by Kurose&Ross Network Layer Control Plane 5-6
Chapter 5: outline
❒ 5.1 Introduction❒ 5.2 ICMP: The Internet Control Message Protocol❒ 5.3 Intra-domain routing algorithms
❍ Graph abstraction and routing metrics❍ Link state routing
• OSPF❍ Distance Vector routing
• RIP
❒ 5.4 Inter-domain routing❍ BGP
4
© From Computer Networking, by Kurose&Ross Network Layer Control Plane 5-7
ICMP: Internet Control Message Protocol
❒ used by hosts & routers to communicate network-level information❍ error reporting: unreachable
host, network, port, protocol❍ echo request/reply (used by
ping)❒ network-layer “above” IP:
❍ ICMP messages carried in IP datagrams
❒ ICMP message: type, code plus first 8 bytes of IP datagram causing error
Type Code description0 0 echo reply (ping)3 0 dest. network unreachable3 1 dest host unreachable3 2 dest protocol unreachable3 3 dest port unreachable3 6 dest network unknown3 7 dest host unknown4 0 source quench (congestion control - not used)8 0 echo request (ping)9 0 route advertisement10 0 router discovery11 0 TTL expired12 0 bad IP header
© From Computer Networking, by Kurose&Ross Network Layer Control Plane 5-8
Traceroute and ICMP❒ source sends series of UDP
segments to dest❍ first set has TTL=1❍ second set has TTL=2, etc.❍ unlikely port number
❒ when nth set of datagrams arrives to nth router:❍ router discards datagrams❍ and sends source ICMP
messages (type 11, code 0)❍ ICMP messages include name
of router & IP address
❒ when ICMP messages arrive, source records RTTs
stopping criterion:" UDP segment eventually
arrives at destination host" destination returns ICMP “port
unreachable” message (type 3, code 3)
" source stops
3 probes
3 probes
3 probes
5
Network Layer Control Plane 5-9
Chapter 5: outline
❒ 5.1 Introduction❒ 5.2 ICMP: The Internet Control Message Protocol❒ 5.3 Intra-domain routing algorithms
❍ Graph abstraction and routing metrics❍ Link state routing
• OSPF❍ Distance Vector routing
• RIP
❒ 5.4 Inter-domain routing❍ BGP
Routing protocolsRouting protocol goal: determine “good” paths (equivalently, routes), from sending hosts to receiving host, through network of routers
# path: sequence of routers packets will traverse in going from given initial source host to given final destination host
# “good”: least “cost”, “fastest”, “least congested”# routing: a “top-10” networking challenge!
5-10Network Layer Control Plane© From Computer Networking, by Kurose&Ross
6
© From Computer Networking, by Kurose&Ross Network Layer Control Plane 5-11
u
yx
wv
z2
21
3
1
1
2
53
5
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) }
Graph abstraction of the network
aside: graph abstraction is useful in other network contexts,e.g., P2P, where N is set of peers and E is set of TCP connections
© From Computer Networking, by Kurose&Ross Network Layer Control Plane 5-12
Graph abstraction: costs
u
yx
wv
z2
21
3
1
1
2
53
5 c(x,x’) = cost of link (x,x’) e.g., c(w,z) = 5
cost could always be 1, or inversely related to bandwidth,or 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 ?
Routing algorithm: algorithm that finds least-cost path
7
Network Layer Control Plane 5-13
How to set link costs?❒ Many possible ways to define routing metrics,
i.e. to set link costs❒ To achieve minimum hop routing:
❍ Set all link costs to 1❍ Will also minimize (average) link load (and node processing)
• See next slide❍ Does not necessarily minimize delay, nor congestion!
❒ Changing link costs will surely change the least-cost paths!❒ Link costs can be engineered to optimize the network to
some extent❍ But this usually requires to know the traffic matrix (TM)❍ What is a TM?
• For every pair of nodes (i,j), TM(i,j) is the amount of traffic entering the network at node i and exiting the network at node j
Network Layer Control Plane 5-14
Minimum hop routing minimises the average link load (for any TM)
❒ Minimizing the average link load (in bps) is equivalent to minimizing the sum of all the link loads. So, remove denominator N from the score.
❒ Routing a new flow of rate R along a given path P will increase the score:
❒ Therefore, minimizing the average link load is equivalent to setting the path P so as to minimize the number of hops
❒ So to achieve this, each link will simply get the static cost = 1❒ Does not depend on Traffic Matrix (why?)
€
Score = Avg _link _ load =
loadii∈links
∑
N
€
Score _ increase =i∈P
∑ R = R ×nb _hops(P )
8
Network Layer Control Plane 5-15
InvCap routing minimises the average link utilisation (for any TM)
❒ Equivalent to minimizing the sum of all the link utilisations❒ Routing a new flow of rate R along a given path P will increase the
score:
❒ Therefore, minimizing the average link utilisation is equivalent to setting the path P so as to minimize
(for all P)
❒ So, to achieve this, each link will simply get the static cost = 1/Ci❒ InvCap routing = link cost is proportional to the inverse of its capacity❒ Does not depend on Traffic Matrix (why?)
€
Score = Avg _link _util =
utilii∈links
∑
N=
loadi
capacity ii∈links
∑
N
€
Score _ increase =i∈P
∑ RCi
= R ×i∈P
∑ 1Ci
€
i∈P
∑ 1Ci
Network Layer Control Plane 5-16
❒ Link delay metric❍ Minimizes delay❍ But delay has several components:
• Propagation delay• Transmission delay (= packet_size / link_capacity)• Queuing delay (variable, depends on the load, difficult to take into
account)❒ Administrative link cost
❍ Any link cost computed so as to optimise a given network score❍ For example to better balance the network load
• but is traffic matrix dependent in general!❒ Basically any summable quantity
❍ Summable = cost of a path is the sum of the costs of all the links composing this path
Other possible routing metrics
9
Network Layer Control Plane 5-17
B
A CD E
FG
HI
J
KL
M
N
O
B
A CD E
FG
HI
J
KL
M
N
O
A network A sink tree for router B based onthe hop count metric
❒ If a router J is on the optimal path from router I to router K, then the optimal path from J to K also falls along the same route
❒ Consequence: the set of optimal routes from all sources to a destination form a tree rooted at the destination
❒ Similarly: the set of optimal routes from one source to all destinations form a tree rooted at the source
Optimality principle
From Computer Networks, by Tanenbaum © Prentice Hall
© From Computer Networking, by Kurose&Ross Network Layer Control Plane 5-18
Routing Algorithm classificationQ: global or decentralized
information?Global:❒ all routers have complete
topology, link cost info❒ “link state” algorithmsDecentralized: ❒ router knows physically-
connected neighbors, link costs to neighbors
❒ iterative process of computation, exchange of info with neighbors
❒ “distance vector” algorithms
Q: Static or dynamic?Static: ❒ routes change slowly over
timeDynamic: ❒ routes change more
quickly❍ periodic update❍ in response to link cost
changes
10
Network Layer Control Plane 5-19
Chapter 5: outline
❒ 5.1 Introduction❒ 5.2 ICMP: The Internet Control Message Protocol❒ 5.3 Intra-domain routing algorithms
❍ Graph abstraction and routing metrics❍ Link state routing
• OSPF❍ Distance Vector routing
• RIP
❒ 5.4 Inter-domain routing❍ BGP
Network Layer Control Plane 5-20
A Link-State Routing Algorithm
Principle❒ Graph topology discovery:
❍ “link state broadcast”, see next slides❍ So, all nodes have the same complete topological info
❒ Least-cost path computation❍ Every node computes least-cost paths to all other nodes❍ It uses Dijkstra’s algorithm (see later)❍ This gives forwarding table for that node
11
© From Computer Networking, by Kurose&Ross Network Layer Control Plane 5-21
❒ Link State Packets are composed of❍ the source node, a sequence number and an age (see later)❍ a distance vector limited to the neighbours
Source ofpackets
Neighboursof the source
From Computer Networks, by Tanenbaum © Prentice Hall
Building link state packets
© From Computer Networking, by Kurose&Ross Network Layer Control Plane 5-22
The packet buffer for router BSend flags ACK flags
Source Seq. Age A C F A C F DataA 21 60 0 1 1 1 0 0F 21 60 1 1 0 0 0 1E 21 59 0 1 0 1 0 1C 20 60 1 0 1 0 1 0D 21 59 1 0 0 0 1 1
2
875
34
1 6A
B C
D
E F
❒ Packets are flooded selectively❍ Packets are not forwarded on the links they arrived on❍ Duplicate (or older) packets are detected by the sequence number
❒ Packets are acknowledged
Packet received from D via C and F
Clearly, routers do not forward the received Link State packets immediately but put them for a short while in a packet buffer (holding area). Why?
Distributing Link State Packets
From Computer Networks, by Tanenbaum © Prentice Hall
12
© From Computer Networking, by Kurose&Ross Network Layer Control Plane 5-23
❒ What if the sequence number wraps around?❍ Solution: choose 32-bit sequence number❍ Needs 137 years to wrap around if one link state packet is sent
every second (in practice one packet per e.g. 10 seconds)❒ What if a router crashes?
❍ It restarts with sequence number 0 and its packets are ignored until the sequence number reaches the previous value
❍ Solution: the age field is decremented by 1 every second and the entry removed when age hits 0
❒ What if a sequence number is corrupted?❍ Same consequence, same solution
Potential problems
From Computer Networks, by Tanenbaum © Prentice Hall
© From Computer Networking, by Kurose&Ross Network Layer Control Plane 5-24
A Link-State Routing Algorithm
Dijkstra’s algorithm❒ net topology, link costs
known to all nodes❍ accomplished via “link
state broadcast” ❍ all nodes have same info
❒ computes least-cost paths from one node (“source”) to all other nodes❍ gives forwarding table for
that node❒ iterative: after k iterations,
know least-cost path to k destinations
Notation:❒ c(x,y): link cost from node x
to y; = ∞ if not direct neighbors
❒ D(v): current value of cost of path from source to destination v; = ∞ if v not reachable
❒ p(v): predecessor node along path from source to v
❒ N': set of nodes whose least-cost path definitively known
13
© From Computer Networking, by Kurose&Ross Network Layer Control Plane 5-25
Dijkstra’s Algorithm1 Initialization: 2 N' = {u} 3 for all nodes v 4 if v adjacent to u 5 then D(v) = c(u,v) 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) + 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'
(as executed in node u)
© From Computer Networking, by Kurose&Ross Network Layer Control Plane 5-26
w3
4
v
x
u
5
37 4
y
8
z2
7
9
Step N'D(v)
p(v)012345
D(w)p(w)
D(x)p(x)
D(y)p(y)
D(z)p(z)
u ∞ ∞ 7,u 3,u 5,uuw ∞ 11,w 6,w 5,u
14,x 11,w 6,wuwxuwxv 14,x 10,v
uwxvy 12,y
notes:# construct shortest path tree
by tracing predecessor nodes
# ties can exist (can be broken arbitrarily)
uwxvyz
Dijkstra’s algorithm: example
14
© From Computer Networking, by Kurose&Ross Network Layer Control Plane 5-27
Dijkstra’s algorithm: example (2) Resulting shortest-path tree from u:
vwxyz
wwxww
destination next hop
Resulting forwarding table in u:
w3
4
v
x
u
5
37 4
y
8
z2
7
9
© From Computer Networking, by Kurose&Ross Network Layer Control Plane 5-28
Dijkstra’s algorithm, discussionAlgorithm complexity: n nodes❒ each iteration: need to check all nodes, w, not in N❒ n(n+1)/2 comparisons: O(n2)❒ more efficient implementations possible: O(nlogn)Oscillations possible when link cost are traffic dependent:❒ e.g., suppose link cost = amount of carried traffic
AD
CB
1 1+ε
ε0
ε
1 1
0 0
initially
AD
CB
given these costs,find new routing….
resulting in new costs
2+ε 0
001+ε 1
AD
CB
given these costs,find new routing….
resulting in new costs
0 2+ε
1+ε10 0
AD
CB
given these costs,find new routing….
resulting in new costs
2+ε 0
001+ε 1
2+ε
15
Network Layer Control Plane 5-29
Chapter 5: outline
❒ 5.1 Introduction❒ 5.2 ICMP: The Internet Control Message Protocol❒ 5.3 Intra-domain routing algorithms
❍ Graph abstraction and routing metrics❍ Link state routing
• OSPF❍ Distance Vector routing
• RIP
❒ 5.4 Inter-domain routing❍ BGP
© From Computer Networking, by Kurose&Ross Network Layer Control Plane 5-30
OSPF (Open Shortest Path First)❒ “open”: publicly available
❒ uses Link State (LS) algorithm ❍ LS packet dissemination: router floods OSPF messages to all
other routers in entire domain❍ topology map at each node❍ route computation using Dijkstra’s algorithm
❒ OSPF messages (called LSAs, Link-State Advertisements) are carried directly over IP
16
© From Computer Networking, by Kurose&Ross Network Layer Control Plane 5-31
OSPF “advanced” features❒ designated router: when several routers are connected to the same
subnet, one of them can be designated to exchange LSAs with the others (the latter do not exchange LSAs between themselves, to reduce traffic)
❒ security: LSAs can be authenticated (to prevent malicious intrusion) ❒ multiple same-cost paths allowed
❍ ECMP = Equal Cost MultiPath❒ for each link, multiple cost metrics can be defined for different ToS
(e.g., satellite link cost set “low” for best effort ToS; high for real time ToS)
❒ integrated uni- and multicast support: ❍ Multicast OSPF (MOSPF) uses same topology data base as
OSPF❒ hierarchical OSPF in large domains
© From Computer Networking, by Kurose&Ross Network Layer Control Plane 5-32
Hierarchical OSPFboundary router
backbone router
area 1area 2
area 3
backbone(area 0)
areaborderrouters
internalrouters
17
© From Computer Networking, by Kurose&Ross Network Layer Control Plane 5-33
Hierarchical OSPF
❒ two-level hierarchy: local area, backbone❍ link-state advertisements (LSA) only flooded in area ❍ each node has detailed area topology; only knows
direction (shortest path) to nets in other areas❒ area border routers: “summarize” distances to nets in
own area, advertise to other Area Border routers❒ backbone routers: run OSPF routing limited to backbone❒ boundary routers: connect to other domains
Network Layer Control Plane 5-34
Chapter 5: outline
❒ 5.1 Introduction❒ 5.2 ICMP: The Internet Control Message Protocol❒ 5.3 Intra-domain routing algorithms
❍ Graph abstraction and routing metrics❍ Link state routing
• OSPF❍ Distance Vector routing
• RIP
❒ 5.4 Inter-domain routing❍ BGP
18
© From Computer Networking, by Kurose&Ross Network Layer Control Plane 5-35
Distance vector algorithm
Bellman-Ford equation (dynamic programming)
let dx(y) := cost of least-cost path from x to ythen dx(y) = min {c(x,v) + dv(y) } v
cost to neighbor v
min taken over all neighbors v of x
cost from neighbor v to destination y
© From Computer Networking, by Kurose&Ross Network Layer Control Plane 5-36
Bellman-Ford example
u
yx
wv
z2
21
3
1
1
2
53
5Knowing dv(z) = 5, dx(z) = 3, dw(z) = 3
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 achieving minimum is next hop in shortest path, used in forwarding table
B-F equation says:
19
© From Computer Networking, by Kurose&Ross Network Layer Control Plane 5-37
Distance Vector Algorithm
❒ Dx(y) = estimate of least cost from x to y❒ Node x maintains its distance vector
Dx = [Dx(y): y є N ]❒ Node x:
❍ knows cost to each neighbor v: c(x,v)❍ also maintains its neighbors’ distance vectors:
for each neighbor v, x maintains Dv = [Dv(y): y є N ]
© From Computer Networking, by Kurose&Ross Network Layer Control Plane 5-38
Distance vector algorithm
Key idea: ❒ From time-to-time, each node sends its own distance
vector estimate to neighbors❍ Asynchronous
❒ When node x receives new DV estimate from neighbor, it updates its own DV using B-F equation (thus erasing its previous vector):
Dx(y) ← minv{c(x,v) + Dv(y)} for each node y ∊ N
❒ Under minor, natural conditions, the estimate Dx(y) converges to the actual least cost dx(y)
20
© From Computer Networking, by Kurose&Ross Network Layer Control Plane 5-39
Distance Vector Algorithm
Iterative, asynchronous:each local iteration caused by: ❒ local link cost change ❒ DV update message from
neighbor
Distributed:each node notifies neighborsonly when its DV changes
❍ neighbors then notify their neighbors if necessary
wait for (change in local link cost or msg from neighbor)
recompute estimates
if DV to any dest has changed, notify neighbors
Each node:
© From Computer Networking, by Kurose&Ross Network Layer Control Plane 5-40
x y zxyz
0 2 7∞ ∞ ∞∞ ∞ ∞
from
cost to
from
from
x y zxyz
0
from
cost to
x y zxyz
∞ ∞
∞ ∞ ∞
cost to
x y zxyz
∞ ∞ ∞7 1 0
cost to
∞2 0 1
∞ ∞ ∞
2 0 17 1 0
time
x z12
7
y
node xtable
node ytable
node ztable
Dx(y) = min {c(x,y) + Dy(y), c(x,z) + Dz(y)} = min {2+0, 7+1} = 2
Dx(z) = min {c(x,y) + Dy(z), c(x,z) + Dz(z)} = min {2+1, 7+0} = 3
32
21
© From Computer Networking, by Kurose&Ross Network Layer Control Plane 5-41
x y zxyz
0 2 7∞ ∞ ∞∞ ∞ ∞
from
cost to
from
from
x y zxyz
0 2 3
from
cost tox y z
xyz
0 2 3
from
cost to
x y zxyz
∞ ∞
∞ ∞ ∞
cost tox y z
xyz
0 2 7
from
cost tox y z
xyz
0 2 3
from
cost to
x y zxyz
0 2 3
from
cost tox y z
xyz
0 2 7
from
cost tox y z
xyz
∞ ∞ ∞7 1 0
cost to
∞2 0 1
∞ ∞ ∞
2 0 17 1 0
2 0 17 1 0
2 0 13 1 0
2 0 13 1 0
2 0 1
3 1 02 0 1
3 1 0
time
x z12
7
y
Dx(y) = min {c(x,y) + Dy(y), c(x,z) + Dz(y)} = min {2+0, 7+1} = 2
Dx(z) = min {c(x,y) + Dy(z), c(x,z) + Dz(z)} = min {2+1, 7+0} = 3
node xtable
node ytable
node ztable
© From Computer Networking, by Kurose&Ross Network Layer Control Plane 5-42
Distance Vector: link cost changes
Link cost changes:❒ node detects local link cost change ❒ updates routing info, recalculates
distance vector❒ if DV changes, notify neighbors
“goodnews travelsfast”
x z14
50
y1
At time t0, y detects the link-cost change, updates its DV (Dy(x) ← 1), and informs its neighbors
At time t1, z receives the update from y. It computes a new least cost to x (Dz(x) ← 2) and sends its neighbors its DV
At time t2, y receives z’s update and updates its distance table. y’s least costs do not change and hence y does not send any message to z
22
© From Computer Networking, by Kurose&Ross Network Layer Control Plane 5-43
Distance Vector: link cost changesLink cost changes:❒ good news travels fast ❒ bad news travels slow -
“count to infinity” problem!
❒ Other example (see book):❍ 44 iterations before algorithm
stabilizes
A B
1335577!
∞
C
2244668!
∞
D
3335577!
∞
E
4444668!
∞
InitiallyAfter 1 exchangeAfter 2 exchangesAfter 3 exchangesAfter 4 exchangesAfter 5 exchangesAfter 6 exchanges
Propagation of bad news(link A-B is down, c(B,A) = ∞)
x z14
50
y60
From Computer Networks, by Tanenbaum © Prentice Hall
Distance to Ain nr. of hops
Dy(x) = 4, 6, 8, … 48, 50, 51Dz(x) = 5, 7, 9, … 49, 50
© From Computer Networking, by Kurose&Ross Network Layer Control Plane 5-44
A patch: Poisoned reverse❒ Also called “split-horizon”❒ If C routes through B to get to A, then C lies to B, namely
❍ C tells B its (C’s) distance to A is infinite• (so B won’t route to A via C)
❒ With poisoned reverse, we get (when link A-B goes down):
❒ Q: Will this completely solve count-to-infinity problem?
A B
1∞∞∞∞
C
22∞∞∞
D
333∞∞
E
4444∞
InitiallyAfter 1 exchangeAfter 2 exchangesAfter 3 exchangesAfter 4 exchanges
23
Network Layer Control Plane 5-45
A B
C
D
Router
Suppose link CD fails
Evolution of the routing tables in A, B and C for destination D:A B C
(2,C) (2,C) (1,D) Initially(2,C) (2,C) (∞, –) After C’s recomputation, C will notify A and B (3,B) (3,A) (∞, –) After A and B’s recomputations(∞, –) (∞, –) (4,A) After 3 exchanges(∞, –) (5,C) (∞, –) After 4 exchanges(6,B) (∞, –) (∞, –) After 5 exchanges
… … … …
From Computer Networks, by Tanenbaum © Prentice Hall
Poisoned reverse is not a panacea
Distance to D Next hopto reach D
Network Layer Control Plane 5-46
Chapter 5: outline
❒ 5.1 Introduction❒ 5.2 ICMP: The Internet Control Message Protocol❒ 5.3 Intra-domain routing algorithms
❍ Graph abstraction and routing metrics❍ Link state routing
• OSPF❍ Distance Vector routing
• RIP
❒ 5.4 Inter-domain routing❍ BGP
24
© From Computer Networking, by Kurose&Ross Network Layer Control Plane 5-47
RIP (Routing Information Protocol)❒ included in BSD-UNIX distribution in 1982❒ distance vector algorithm
❍ distance metric: # hops (max = 15 hops), each link has cost 1❍ DVs exchanged with neighbors every 30 sec in response
message (aka advertisement)❍ each advertisement: list of up to 25 destination subnets (in IP
addressing sense)
DC
BA
u vw
x
yz
subnet hops u 1 v 2 w 2 x 3 y 3 z 2
From router A to destination subnets:
© From Computer Networking, by Kurose&Ross Network Layer Control Plane 5-48
RIP: example
destination subnet next router # hops to dest w A 2
y B 2 z B 7
x - 1… … …
routing table in router D (≠ the forwarding table)
w x yz
A
C
D B
25
© From Computer Networking, by Kurose&Ross Network Layer Control Plane 5-49
w x yz
A
C
D B
destination subnet next router # hops to dest w A 2
y B 2 z B 7
x - 1… … ...
routing table in router D
A 5
RIP: example A-to-D advertisement (contains also the next router)
dest next router # hops w - 1 x - 1 y D 3 z C 4 … … ...
entry discarded by D that sees itself as next-hop, equivalent to “Poisoned reverse”
© From Computer Networking, by Kurose&Ross Network Layer Control Plane 5-50
Comparison of LS and DV algorithms
Message complexity❒ LS: with n nodes, E links, O(nE) messages sent ❒ DV: exchange between neighbors only, but
❍ depends on number of iterations
Speed of Convergence❒ LS: O(nlogn) algorithm to compute least-cost paths to all other
nodes by Dijkstra❒ DV: number of BF updates depends on number of iterations
❍ possible count-to-infinity
26
© From Computer Networking, by Kurose&Ross Network Layer Control Plane 5-51
Intra-domain Routing Protocols❒ are also known as Interior Gateway Protocols (IGP)❒ most common Intra-domain routing protocols:
❍ OSPF: Open Shortest Path First • Link State Protocol, recommended by IETF, deployed
❍ IS-IS: Intermediate System to Intermediate System • Nearly identical to OSPF, standardized by ISO, deployed
❍ RIP: Routing Information Protocol• Distance Vector Protocol, IETF, only used in small networks
❍ (E)IGRP: (Enhanced) Interior Gateway Routing Protocol• Distance Vector Protocol, improves RIP, from Cisco
Network Layer Control Plane 5-52
Chapter 5: outline
❒ 5.1 Introduction❒ 5.2 ICMP: The Internet Control Message Protocol❒ 5.3 Intra-domain routing algorithms
❍ Graph abstraction and routing metrics❍ Link state routing
• OSPF❍ Distance Vector routing
• RIP
❒ 5.4 Inter-domain routing❍ BGP
27
© From Computer Networking, by Kurose&Ross Network Layer Control Plane 5-53
Making routing scalable
scale: with billions of destinations:
❒ can’t store all destinations 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
Our routing study thus far - idealization ❒ all routers identical❒ network “flat” (not considering areas in OSPF)… not true in practice
aggregate routers into regions known as “autonomous systems” (AS) (aka “domains”)
inter-AS routing❒ routing among ASes❒ gateway routers perform
inter-domain routing (as well as intra-domain routing)
Internet approach to scalable routing
intra-AS routing# routing among hosts, routers in
same AS (“network”)# all routers in AS must run same
intra-domain protocol# routers in different AS can run
different intra-domain routing protocol
# gateway router: at “edge” of its own AS, has link(s) to router(s) in other ASes
5-54Network Layer Control Plane© From Computer Networking, by Kurose&Ross
28
© From Computer Networking, by Kurose&Ross Network Layer Control Plane 5-55
3b
1d
3a
1c2aAS3
AS1AS21a
2c2b
1b
Intra-ASRouting algorithm
Inter-ASRouting algorithm
Forwardingtable
3c
Interconnected ASes
❒ forwarding table configured by both intra- and inter-AS routing algorithms❍ intra-AS sets entries for
internal destinations❍ inter-AS and intra-AS set
entries for external destinations
© From Computer Networking, by Kurose&Ross Network Layer Control Plane 5-56
Inter-AS tasks❒ suppose router in AS1
receives datagram destined outside of AS1❍ router should forward
packet to gateway router, but which one?
AS1 must:1. learn which destinations
reachable through AS2, which through AS3
2. propagate this reachability info to all routers in AS1
Job of inter-AS routing!
AS3
AS2
3b
3c3a
AS1
1c1a
1d1b
2a2c
2bothernetworks
othernetworks
29
Network Layer Control Plane 5-57
Chapter 5: outline
❒ 5.1 Introduction❒ 5.2 ICMP: The Internet Control Message Protocol❒ 5.3 Intra-domain routing algorithms
❍ Graph abstraction and routing metrics❍ Link state routing
• OSPF❍ Distance Vector routing
• RIP
❒ 5.4 Inter-domain routing❍ BGP
Internet inter-AS routing: BGP❒ BGP (Border Gateway Protocol): the de facto inter-
domain routing protocol❍ “glue that holds the Internet together”
❒ BGP provides each AS a means to:❍ obtain subnet reachability information from neighboring
ASes (eBGP, external BGP)❍ propagate reachability information to all AS-internal routers
(iBGP, internal BGP) ❍ determine “good” routes to other networks based on
reachability information and policy❒ allows subnet to advertise its existence to rest of
Internet: “I am here”
5-58Network Layer Control Plane© From Computer Networking, by Kurose&Ross
30
eBGP, iBGP connections
eBGP connectivityiBGP connectivity
1b
1d
1c1a
2b
2d
2c2a3b
3d
3c3a
AS 2
AS 3AS 1
5-59Network Layer Control Plane
1c
∂
∂
gateway routers run both eBGP and iBGP protocols
© From Computer Networking, by Kurose&Ross
iBGP connectivity ≠ physical connectivity in AS
BGP basics
! when AS3 gateway router 3a advertises path AS3,X to AS2 gateway router 2c:❍ AS3 promises to AS2 it will forward datagrams towards subnet X
! 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)
• Prefix = IP address prefix = range of IP addresses
1b
1d
1c1a2b
2d
2c2a
3b
3d
3c3a
AS 2
AS 3AS 1
BGP advertisement:AS3, X
5-60Network Layer Control Plane© From Computer Networking, by Kurose&Ross
X
31
Path attributes and BGP routes❒ advertised prefix includes BGP attributes
❍ prefix + attributes = “route”❒ two important attributes:
❍ AS-PATH: list of ASes through which prefix advertisement has passed, e.g, AS 67, AS 17
• BGP is a path vector protocol (AS-PATH are propagated)• In a DV protocol, only the distance is propagated
❍ NEXT-HOP: the IP address of the (internal-AS) gateway router leading to first AS in AS-PATH
❒ 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
neighboring ASes
5-61Network Layer Control Plane© From Computer Networking, by Kurose&Ross
BGP path advertisement
! Based on AS2 policy, AS2 router 2c accepts path AS3,X, propagates (via iBGP) to all AS2 routers
1b
1d
1c1a2b
2d
2c2a
3b
3d
3c3a
AS2
AS3AS1
AS3,X AS2,AS3,X
! AS2 router 2c receives path advertisement AS3,X (via eBGP) from AS3 router 3a
! Based on AS2 policy, AS2 router 2a advertises (via eBGP) path AS2, AS3, X to AS1 router 1c
5-62Network Layer Control Plane© From Computer Networking, by Kurose&Ross
X
32
BGP path advertisement
! AS1 gateway router 1c learns path AS2,AS3,X from 2a
1b
1d
1c1a2b
2d
2c2a
3b
3d
3c3a
AS2
AS3AS1
AS3,X AS2,AS3,X
Gateway router may learn about multiple paths to destination:
AS3,X
! AS1 gateway router 1c learns path AS3,X from 3a! Based on policy, AS1 gateway router 1c chooses e.g. path
AS3,X, and advertises path within AS1 via iBGP5-63Network Layer Control Plane© From Computer Networking, by Kurose&Ross
X
© From Computer Networking, by Kurose&Ross Network Layer Control Plane 5-64
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
33
BGP, OSPF, forwarding table entries
! recall: 1a, 1b, 1d learn about dest X via iBGP from 1c: “path to X goes through 1c”
1b
1d
1c1a2b
2d
2c2a
3b
3d
3c3a
AS2
AS3AS1
AS3,X AS2,AS3,X
AS3,X
! 1d: OSPF intra-domain routing: to get to 1c, forward over outgoing local interface 1
AS3,X
Q: how does router set forwarding table entry to distant prefix?
12
1
2
dest interface…
…X
…
…1
physical link
local link interfacesat 1a, 1d
5-65Network Layer Control Plane© From Computer Networking, by Kurose&Ross
X
BGP, OSPF, forwarding table entries
! recall: 1a, 1b, 1c learn about dest X via iBGP from 1c: “path to X goes through 1c”
1b
1d
1c1a2b
2d
2c2a
3b
3d
3c3a
AS2
AS3AS1
! 1d: OSPF intra-domain routing: to get to 1c, forward over outgoing local interface 1
Q: how does router set forwarding table entry to distant prefix?
dest interface…
…X
…
…2
! 1a: OSPF intra-domain routing: to get to 1c, forward over outgoing local interface 2
1
2
5-66Network Layer Control Plane© From Computer Networking, by Kurose&Ross
X
34
© From Computer Networking, by Kurose&Ross Network Layer Control Plane 5-67
BGP route selection (simplified)
❒ router may learn about more than one route to some destination prefix, selects route based on (in decreasing preference order):
1. Local preference value attribute: policy decisionprefer routes through “Customer AS” over routes through “Peer AS” over routes through “Provider AS” (economical viewpoint)
2. Shortest AS-PATH 3. Closest gateway router (= BGP NEXT-HOP):
so-called hot potato routing (see next slide)4. Additional criteria
❒ 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 (2d chooses 2a, because 201 < 263): don’t worry about inter-domain cost!
1b
1d
1c1a2b
2d
2c2a
3b
3d
3c3a
AS2
AS4
AS1
AS3,AS4,X AS1,AS4,X
OSPF link cost
201
152112
263
5-68Network Layer Control Plane
4d
4c4aAS3
X
Hot Potato Routing
35
Network Layer Control Plane 5-69
AS1AS2 AS3 AS4
AS5
AS6 AS7
AS8
AS9 AS10
Information AS6 receives from its neighbor ASes to reach prefixes in AS4:
AS2 uses AS2-AS3-AS4AS7 uses AS7-AS3-AS4AS5 uses AS5-AS6-AS7-AS3-AS4AS9 uses AS9-AS5-AS6-AS7-AS3-AS4
❒ If an AS sees itself in the AS-PATH advertised by a neighbor AS, it discards it, otherwise it would create a loop
❒ More powerful than poisoned reverse (used in DV)❍ Made possible by the presence of the AS-PATH in the advertisements
Discarded by AS6, because these AS-PATHs use AS6 as an intermediate AS
Path Vector protocols avoid routing loops
© From Computer Networking, by Kurose&Ross Network Layer Control Plane 5-70
BGP: achieving policy via advertisements
Figure 4.5-BGPnew: a simple BGP scenario
A
B
C
WX
Y
legend:
customer network:
providernetwork
❒ A,B,C are provider networks❒ X,W,Y are customers (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
==
=
€€
€
€ Customer-provider relationship
Peering relationship
Suppose an ISP only wants to route traffic to/from its customer networks (does not want to carry transit traffic between other ISPs)
36
© From Computer Networking, by Kurose&Ross Network Layer Control Plane 5-71
BGP routing policy (2)
❒ A advertises path AW to B and to C❒ B advertises path BAW to X❒ B chooses not to advertise path BAW to C:
❍ B gets no “revenue” for routing CBAW since none of W, C, A are B’s customers
❍ C does not learn about CBAW❍ C will route CAW (not using B) to get to W
A
B
C
WX
Y
==
=
€€
€
€
legend:
customer network:
providernetwork
Network Layer Control Plane 5-72
BGP Policies (Valley-Free routing)
Advertisements received ( ) only forwarded along links, to avoid costly transit traffic
Customer
Provider
Local ASPeer
Advertisement from provider:
Customer
Provider
Peer
XXX
Customer
Provider
Local ASPeer
Advertisement from peer:
Customer
Provider
Peer
XX
X
Customer
Provider
Local ASPeer
Advertisement from customer:
Customer
Provider
Peer
37
© From Computer Networking, by Kurose&Ross Network Layer Control Plane 5-73
Why different Intra- and Inter-AS routing? Policy: ❒ Inter-AS: admin wants control over how its traffic is
routed, who routes through its net❒ Intra-AS: single admin, so no policy decisions neededScale:❒ hierarchical routing saves table size, reduced update
trafficPerformance: ❒ Intra-AS: can focus on performance❒ Inter-AS: policy may dominate over performance
Network Layer Control Plane 5-74
Chapter 5: Network Layer Control Plane❒ ICMP❒ Routing protocols:
❍ Intra-domain routing• LS - Link State (OSPF)
– Send local knowledge to all– Selective flooding– Dijkstra
• DV - Distance Vector (RIP)– Send global knowledge to
neighbors– Bellman-Ford– Count to ∞ problem– Poisoned reverse
❍ Inter-domain routing (BGP)• Path Vector Protocol• Policies
❒ For further study:o Centralized control (SDN)o Traffic engineeringo Network management
# Next stop: link layer!