Title: School of Computing Science
1- School of Computing Science
- Simon Fraser University
- CMPT 880 Internet Architectures and Protocols
- Introduction II
- Instructor Dr. Mohamed Hefeeda
-
2Review of Basic Networking Concepts
- Internet structure
- Protocol layering and encapsulation
- Internet services and socket programming
- Network Layer
- Network types Circuit switching, Packet
switching - Addressing, Forwarding, Routing
- Transport layer
- Reliability and congestion control
- TCP, UDP
- Link Layer
- Multiple Access Protocols
- Ethernet
3Network Layer in the Internet
Transport layer TCP, UDP
Network layer
Link layer
physical layer
4Graph Abstraction
- 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) - cost of link (x1, x2)
- Metric value, e.g., c(w,z) 5
- could be
- 1 (typical), or
- inversely related to bandwidth, or
- inversely related to congestion
Routing algorithm find the least-cost path
5Classification of Routing Algorithms
- Global or local information?
- Global
- all routers have complete topology, link cost
info - link state algorithms
- Local
- each router knows physically-connected neighbors,
link costs to neighbors - iterative process of computation, exchange of
info with neighbors - distance vector algorithms
6A Link-State Routing Algorithm
- Dijkstras 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
7A Link-State Routing Algorithm
- Notation
- c(x,y) link cost from node x to y
- c(x,y) 8 if not direct neighbors
- D(v) current value of cost of path from source
to dest. v - p(v) predecessor node along path from source to
v - N' set of nodes whose least cost path
definitively known
8Dijsktras Algorithm
1 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) 8 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'
9Dijkstras algorithm example
D(v),p(v) 2,u 2,u 2,u
D(x),p(x) 1,u
Step 0 1 2 3 4 5
D(w),p(w) 5,u 4,x 3,y 3,y
D(y),p(y) 8 2,x
N' u ux uxy uxyv uxyvw uxyvwz
D(z),p(z) 8 8 4,y 4,y 4,y
10Dijkstras algorithm example (2)
Resulting shortest-path tree from u
Resulting forwarding table in u
11Dijkstras algorithm, discussion
- What is the time complexity of Dijkstras
algorithm? - Input n nodes (other than source)
- each iteration need to check all nodes not in N
- 1st iteration n comparisons
- 2nd n -1
- 3rd n-2
- nth 1
- Total n(n1)/2 comparisons ? complexity O(n2)
- more efficient implementations possible O(nlogn)
- Using heap data structure
12Distance Vector Algorithm
- Bellman-Ford Equation (dynamic programming)
- Define
- dx(y) cost of least-cost path from x to y
- Then
- dx(y) min c(x,v) dv(y)
- where min is taken over all neighbors v of x
v
13Bellman-Ford example
Determine du(z)
Clearly, dv(z) 5, dx(z) 3, dw(z) 3
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
How would you use BF equation to construct
shortest paths?
14Distance Vector Algorithm
- Define
- Dx(y) estimate of least cost from x to y
- Distance vector Dx Dx(y) y ? N
- Node x knows cost to each neighbor v c(x,v)
- Node x maintains Dx Dx(y) y ? N
- Node x also maintains its neighbors distance
vectors - For each neighbor v, x maintains Dv Dv(y) y ?
N
15Distance vector 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) ? minvc(x,v) Dv(y) for each node y ?
N
- Under minor, natural conditions, the estimate
Dx(y) converge to the actual least cost dx(y)
16Distance Vector Algorithm
Each node
- Iterative
- Continues until no more info is exchanged
- Each iteration caused by
- local link cost change
- DV update message from neighbor
- Asynchronous
- Nodes do not operate in lockstep
- Distributed
- Each node receives info only from its directly
attached neighbors - NO Global info
17Dx(z) minc(x,y) Dy(z),
c(x,z) Dz(z) min21 , 70 3
Dx(y) minc(x,y) Dy(y), c(x,z) Dz(y)
min20 , 71 2
node x table
cost to
cost to
x y z
x y z
x
0 2 3
x
0 2 3
y
from
2 0 1
y
from
2 0 1
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
x
8
8
x
0 2 7
x
0 2 3
8 2 0 1
y
y
from
y
2 0 1
from
from
2 0 1
z
z
8
8
8
z
7 1 0
3 1 0
cost to
cost to
Example
node z table
cost to
x y z
x y z
x y z
x
0 2 3
x
0 2 7
x
8 8 8
y
y
2 0 1
from
from
y
2 0 1
from
8
8
8
z
z
z
3 1 0
3 1 0
7
1
0
time
18Distance Vector link cost changes
- Link cost decreased
- node detects local link cost change
- updates routing info, recalculates distance
vector - if DV changes, notify neighbors
1
4
50
At time t0, y detects the link-cost change,
updates its DV, and informs its neighbors. At
time t1, z receives the update from y and updates
its table. It computes a new least cost to x
and sends its neighbors its DV. At time t2, y
receives zs update and updates its distance
table. ys least costs do not change and hence y
does not send any message to z.
good news travels fast
19Distance Vector link cost changes
- Link cost increased
- t0 y detects change, updates its cost to x to
be 6. Why? - Because z previously told y that I can reach x
with cost of 5. - 6 min 600, 15
- Now we have a routing loop!
- Pkts destined to x from y go back and forth
between y and z forever (or until loop is broken) - t1 z gets the update from y. z updates its cost
to x to be?? - 7 min 500, 16
- Algorithm will take 44 iterations to stabilize
- This is called count to infinity problem!
- Solutions?
1
4
50
Bad news travels slow
20Distance Vector link cost changes
- Poisoned reverse
- If z routes through y to get to x
- Then z tells y that its (zs) distance to x is
infinity (so y wont route to x via z) - Will this completely solve count to infinity
problem? - No! Loops involving three or more nodes will not
be detected
21Comparison of LS and DV algorithms
- Message complexity
- LS with n nodes, E links, O(nE) msgs sent
- DV exchange between neighbors only
- But send entire table
- Speed of Convergence
- LS O(n2) algorithm requires O(nE) msgs
- may have oscillations
- DV convergence time varies
- may be routing loops
- count-to-infinity problem
- Robustness what happens if router malfunctions?
- LS node can advertise incorrect link cost
- each node computes only its own table ? some
degree of robustness - DV node can advertise incorrect path cost
- each nodes table used by others ?error
propagates thru network - In The Internet
- LS OSPF (recent, more features)
- DV RIP (old, small nets)
22Hierarchical Routing
- Our routing study thus far - idealization
- all routers identical
- network flat not true in practice
- scale with 200 million destinations
- cant store all dests 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
23Hierarchical Routing
- aggregate routers into regions, autonomous
systems (AS) - routers in same AS run same routing protocol
- intra-AS routing protocol
- routers in different AS can run different
intra-AS routing protocol - Gateway router
- Direct link to router in another AS
24Interconnected ASes
- Forwarding table is configured by both intra- and
inter-AS routing algorithm - Intra-AS sets entries for internal dests
- Inter-AS Intra-As sets entries for external
dests
25Inter-AS tasks
- AS1 needs
- to learn which dests are reachable through AS2
and which through AS3 - to propagate this reachability info to all
routers in AS1 - Job of inter-AS routing!
- Suppose router in AS1 receives datagram for which
dest is outside of AS1 - Router should forward packet towards one of the
gateway routers, but which one?
26Example Choosing among multiple ASes
- Now suppose AS1 learns from the 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 - Hot potato routing send packet towards closest
of two routers
27Internet inter-AS routing BGP
- BGP (Border Gateway Protocol) the de facto
standard - BGP provides each AS a means to
- Obtain subnet reachability information from
neighboring ASes - Propagate the reachability information to all
routers internal to the AS - Determine good routes to subnets based on
reachability information and policy - Allows a subnet to advertise its existence to
rest of the Internet I am here
28BGP basics
- Pairs of routers (BGP peers) exchange routing
info over semi-permanent TCP connections BGP
sessions - Note 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
29Distributing reachability info
- With eBGP session between 3a and 1c, AS3 sends
prefix reachability info to AS1 - 1c can then use iBGP to distribute this new
prefix reach info to all routers in AS1 - 1b can then re-advertise the new reachability
info to AS2 over the 1b-to-2a eBGP session - When router learns about a new prefix, it creates
an entry for the prefix in its forwarding table.
30Path attributes BGP routes
- When advertising a prefix, advert. includes BGP
attributes - prefix attributes route
- Two important attributes
- AS-PATH contains the ASes on the path to the
prefix - NEXT-HOP Indicates the specific internal-AS
router to next-hop AS. (There may be multiple
links from current AS to next-hop-AS.) - When gateway router receives route advert., uses
import policy to accept/decline
31BGP messages
- BGP messages exchanged using TCP
- BGP messages
- OPEN opens TCP connection to peer and
authenticates sender - 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
32BGP route selection
- Router may learn about more than 1 route to some
prefix. Router must select a route - Elimination rules
- Local preference value attribute policy decision
- Shortest AS-PATH
- Closest NEXT-HOP router hot potato routing
- Additional criteria
33BGP Routing Policy
- A,B,C are provider networks
- X,W,Y are customer (of provider networks)
- X is dual-homed attached to two provider
networks - X does not want to route traffic from B via X to
C - so X will not advertise to B a route to C
34BGP Routing Policy (2)
- A advertises to B the path AW
- B advertises to X (its client) the path BAW
- Should B advertise to C the path BAW?
- No way! B gets no revenue for routing CBAW
since neither W nor C are Bs customers - Rule of thumb a provider wants to route only
to/from its customers! (unless there is a mutual
peering deal)
35Why 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
36Unicast, multicast, broadcast
- Unicast one source, one destination
- E.g., web session
- Multicast one source, multiple destinations
- Subset of all possible destinations
- E.g., streaming a hockey game to interested fans
- Broadcast one source, all destinations
- E.g., broadcasting link state info to ALL routers
in a domain in OSPF protocol - Anycast multiple possible sources, one
destination - Sources have same (anycast) address
- Request is forwarded to appropriate source
- (Still in research phases)
- We will not cover these topics!