You are on page 1of 67

Advanced Computer Networks

[FECEg-5201]

CHAPTER THREE:
Routing Algorithms
Network layer
Network layer
application
◼ Transport segment from sending to receiving transport
network
data link
host physical

network network
data link data link
◼ On sending side encapsulates segments into network
data link
physical physical
physical network network
data link data link
datagrams physical physical

network network
◼ On receiving side, delivers segments to data link data link
physical physical
network
transport layer data link
physical application
transport
network network
◼ Network layer protocols in every host, data link network data link
network physical data link physical
data link physical
physical
router examines header fields in all IP datagrams

passing through it
The Internet Network layer
Host, router network layer functions:

Transport layer: TCP, UDP

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

LinkLink layer
Layer

physical layer
Two Key Network-Layer Functions
analogy:
• forwarding: move
packets from router’s  forwarding: process of
input to appropriate getting through single
router output interchange
• routing: determine
Passing thru A.A
route taken by packets
from source to dest.  routing: process of
• routing algorithms planning trip from
source to dest.

Bahir Dar - A.A - Jimma


Interplay between routing and 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
Network layer connection and connection-less service

• Datagram network provides network-layer


connectionless service

• VC (virtual circuit) network provides network-layer


connection-oriented service

• analogous to TCP/UDP of the transport-layer services,


but:
• service: host-to-host (in contrast to process-to-process in
transport-layer)
• no choice: network provides one or the other
• VC – in ATM
• Datagram – in Internet
• implementation: in network core
Virtual circuits
“source-to-dest path behaves much like telephone
circuit”
• performance-wise
• network actions along source-to-destination path

• call setup for each call before data can flow


• each packet carries VC identifier (not destination host address)
• every router on source-destination path maintains “state” for
each passing connection
• link, router resources (bandwidth, buffers) may be allocated to VC
(dedicated resources => predictable service)
VC implementation
a VC consists of:
1. path from source to destination
2. VC numbers, one number for each link along the
path
3. entries in forwarding tables in routers along the
path

• packet belonging to VC carries VC number


(rather than destination address)
• VC number can be changed on each link.
• New VC number comes from forwarding table
Forwarding table VC number

12 22 32

1 3
2

Forwarding table in interface


number
northwest router:
Incoming interface Incoming VC # Outgoing interface Outgoing VC #

1 12 3 22
2 63 1 18
3 7 2 17
1 97 3 87
… … … …

Routers maintain connection state information!


Virtual circuits: signaling protocols
• used to setup and maintain VC

• used in ATM

• not used in today’s Internet

application
6. Receive data application
transport 5. Data flow begins
network 4. Call connected 3. Accept call transport
data link 1. Initiate call 2. incoming call network
data link
physical
physical
Datagram networks
• no call setup at network layer
• routers: no state about end-to-end connections
• no network-level concept of “connection”
• packets forwarded using destination host address
• packets between 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
Datagram or VC network: why?

Internet (datagram) ATM (VC)


• data exchange among
computers • evolved from telephony
• “flexible” service, no strict • human conversation:
timing req. • strict timing, reliability
• “smart” end systems requirements
(computers) • need for guaranteed QoS
• can adapt, perform control, service
error recovery
• simple inside network, • “dumb” end systems
complexity at “edge” • telephones
• many link types • complexity inside network
• different characteristics
• uniform service difficult
What kinds of Routers are on the Internet?
• Router is a physical device in a network that directs packets
to their intended destinations
• Routers are used at three levels in the Internet
• Access Level
• Ex. Cisco 700 to 2500 Series
• Enterprise/Distribution Level
• Ex. Cisco 2600 to 3600 Series
• Core/Backbone Level
• Ex. Cisco 12000 Series
Types and Sizes of Routers

Home Networking
or Access Router
Router for Large
Backbone Networks

Routers for Small/Medium


sized Enterprise Networks
Router functions
• Maintain/manipulate routing information
• Listen for updates/update neighbors, RP updates,
• Service advertisement ICMP, SNMP

• Classify packets for manipulation/queuing/permit-deny,


etc.
• Compare packets to classification lists and perform control
• Generate packets

• Perform Layer 3 switching based on routing info.


• Layer 3 checksum
• TTL/hop count update

• Management/billing (statistics)
• Interface statistics—Netflow export
• SNMP, ping, trace route…
Router Architecture Overview
Two key router functions:
• run routing algorithms/protocols (RIP, OSPF, BGP)
• forwarding datagram from incoming to outgoing link
Input Port Functions

Physical layer:
bit-level reception
Data link layer:
e.g., Ethernet framing • given datagram destination, lookup
output port using forwarding table in
input port memory

• queuing: if datagrams arrive faster than


forwarding rate into switch fabric
Input Port Queuing
• Fabric slower than input ports -> queuing may occur at input
queues
• Head-of-the-Line (HOL) blocking: queued datagram at front of
queue prevents others in queue from moving forward
• queueing delay and loss due to input buffer overflow!
• Scheduling discipline performs contention management by
choosing among queued datagrams for transmission; FIFO,
QoS
Three types of switching fabrics
Switching fabric transfers datagrams from input port
memory to appropriate output port memory (avoids
contention)
Switching Via Memory
First generation routers:
•switching under direct control of CPU
•packet copied to system’s memory
Speed is limited by memory access
speed (i.e., Read/Write speed)
 One packet/switching cycle
Switching Via a Bus
• datagram from input port memory
to output port memory via a shared
bus
• bus contention: switching speed
limited by bus bandwidth

• Single frame at a time – Serial; Buffering allows Parallel


frame handling

• 32 Gbps bus, Cisco 5600: sufficient speed for access


and enterprise routers

• 1 Gbps bus, Cisco 1900: sufficient speed for access and


enterprise routers (not regional or backbone)
Switching Via An Interconnection Network
• overcome bus bandwidth limitations
• initially developed to connect processors in multiprocessor
• Each input interface has access to the matrix that directly
connects to the multiple output interfaces
• advanced design: fragmenting datagram into fixed length
cells, switch cells through the fabric.
• Cisco 12000: switches 60 Gbps through the interconnection
network used for regional or backbone
Output Ports

• Buffering required when datagrams arrive from fabric


faster than the transmission rate

• Scheduling discipline chooses among queued


datagrams for transmission
Output port queuing

• buffering when arrival rate via switch exceeds output line


speed
• queuing (delay) and loss due to output port buffer
overflow!
Routing
Routing protocol
Goal: determine “good” path 5
(sequence of routers) thru 3
network from source to dest. B C 5
2
A 2 1 F
Graph abstraction for routing 3
1
algorithms: G(V,E) D E 2
1
• graph nodes (set V) are
routers
• graph edges (set E) are  “good” path:
physical links  typically means

• link cost: delay (RTT) minimum cost path


 other def’s possible
• Queue length (indication of
congestion level)
• Number of hopes…
Routing Algorithms: Graph abstraction

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

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: costs

5
• c(x,x’) = cost of link (x,x’)
3
v w 5
2
u 2 z - e.g., c(w,z) = 5
1
3
1 2
x 1
y

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


Routing Algorithm classification
Global or decentralized Static or dynamic?
information?
Global: Static:
• all routers have complete • routes change slowly over
topology, link cost info time
• “link state” algorithms • Wired networks

Decentralized: Dynamic:
• router knows physically- • routes change more quickly
connected neighbors, link • periodic update
costs to neighbors • in response to link cost
• iterative process of changes
computation, exchange of info • Wireless and mobile
with neighbors networks
• “distance vector” algorithms
A Link-State Routing Algorithm

Dijkstra’s algorithm Notation:


• net topology, link costs known • c(x,y): link cost from node x to y;
to all nodes = ∞ if not direct neighbors
• accomplished via “link state
broadcast”
• D(v): current value of cost of
• all nodes have same info path from source to dest. v

• computes least cost paths from • p(v): predecessor node along


one node (‘source”) to all other path from source to v
nodes
• gives forwarding table for
that node • N: set of nodes whose least cost
path definitively known
Dijsktra’s Algorithm
1 Initialization:
2 N = {S}
3 for all nodes v
4 if v adjacent to S
5 then D(v) = c(S,v)
6 else D(v) = infinity
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
Dijkstra’s algorithm: example
Step start N D(B),p(B) D(C),p(C) D(D),p(D) D(E),p(E) D(F),p(F)
0 A 2,A 5,A 1,A infinity infinity
1 AD 2,A 4,D 2,D infinity
2 ADE 2,A 3,E 4,E
3 ADEB 3,E 4,E
4 ADEBC 4,E
5 ADEBCF

5
3
B C 5
2
A 2 1 F
3
1 2
D E
1
Dijkstra’s algorithm: example…
Resulting shortest-path tree from A:

B C
A F

D E

Resulting forwarding table in A:


destination link
B (A,B)
D (A,D)
C (A,D,E,C)
E (A,D,E)
F (A,D,E,F)
Distance 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) }


v

where min is taken over all neighbors v of x


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 2 du(z) = min { c(u,v) + dv(z),
x 1
y
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
Distance Vector Algorithm
• Dx(y) = estimate of least cost from x to y

• Node x knows cost to each neighbor v: c(x,v)

• Node x maintains distance vector


Dx = [Dx(y): y є N ]

• Node x also maintains its neighbors’ distance


vectors
• For each neighbor v, x maintains
Dv = [Dv(y): y є N ]
Distance vector algorithm
Basic idea:

• From time-to-time, each node sends its own distance vector


estimate to neighbors
• Asynchronous

• 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


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

recompute estimates
Distributed:
• each node notifies neighbors
only when its DV changes if DV to any dest has
• neighbors then notify their changed, notify neighbors
neighbors if necessary
Distance Vector Algorithm:
At
Each 1 Initialization:
Node 2 for all destinations y:
X: 3 Dx (y) = c(x,y)
4 for all neighbors w:
• for all destinations y: Dw(y) = infinity
6 for all neighbors w:
• send Dx(y)
7
8 loop
9 wait (until I see a link cost change to neighbor w
10 or until I receive update from neighbor w)
11
12 for all destinations y:
13 Dx(y) = minv { c(x,v) + Dv(y) }
14
15 if we have a new Dx(Y) for any destination Y
24 send new values Dx(Y) to all neighbors
25
26 forever
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 Dy(z), c(x,z) + Dz(z)}
node x table = min{2+1 , 7+0} = 3
cost to cost to
x y z x y z
x 0 2 7 x 0 2 3
from

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

z ∞∞ ∞
node z table
cost to
x y z
x ∞∞ ∞
from

y ∞∞ ∞
z 71 0
time
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 Dy(z), c(x,z) + Dz(z)}
node x table = min{2+1 , 7+0} = 3
cost to cost to cost to
x y z x y z x y z
x 0 2 7 x 0 2 3 x 0 2 3
from

from
y ∞∞ ∞ y 2 0 1

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

y 2 0 1 y 2 0 1 7
from

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

x ∞∞ ∞ x 0 2 7 x 0 2 3
from

from

y 2 0 1 y 2 0 1
from

y ∞∞ ∞
z 71 0 z 3 1 0 z 3 1 0
time
Hierarchical Routing
Our routing study so far - idealization
 all routers identical
 network “flat”
… not true in practice

scale: with >200 million administrative autonomy


destinations:
• internet = network of networks
• can’t store all dest’s in routing
tables! • each network admin may want
to control routing in its own
network
Hierarchical Routing…
• The Global Internet consists of Autonomous Systems (AS)
interconnected with each other:
• Stub AS: small corporation: one connection to other AS’s
• Multihomed AS: large corporation: multiple connections to
other AS’s
• Transit AS: provider, hooking many AS’s together

• Two-level routing:
• Intra-AS: administrator responsible for choice of routing
algorithm within network
• Inter-AS: unique standard for inter-AS routing: BGP
Hierarchical Routing…
• aggregate routers into gateway routers
regions, “autonomous • special routers in AS
systems” (AS) • run intra-AS routing
• routers in same AS run protocol with all other
same routing protocol routers in AS
• “intra-AS” routing • also responsible for routing
protocol to destinations outside AS
• routers in different AS can • run inter-AS routing
run different intra-AS protocol with other
routing protocol gateway routers
Hierarchical Routing
Our routing study so far - idealization
◼ all routers identical

◼ network “flat”

… not true in practice

scale: with >200 million administrative autonomy


destinations: ◼ internet = network of networks
◼ can’t store all dest’s in routing ◼ each network admin may want to
tables! control routing in its own
◼ routing table exchange would network
swamp links!
Hierarchical Routing…
◼ The Global Internet consists of Autonomous Systems (AS)
interconnected with each other:
◆ Stub AS: small corporation: one connection to other AS’s
◆ Multihomed AS: large corporation: multiple connections to
other AS’s
◆ Transit AS: provider, hooking many AS’s together
◼ Two-level routing:
◆ Intra-AS: administrator responsible for choice of routing
algorithm within network
◆ Inter-AS: unique standard for inter-AS routing: BGP
Hierarchical Routing…

◼ aggregate routers into gateway routers


regions, “autonomous ◼ special routers in AS
systems” (AS) ◼ run intra-AS routing
protocol with all other
◼ routers in same AS run routers in AS
same routing protocol ◼ also responsible for
◆ “intra-AS” routing protocol routing to destinations
outside AS
◆ routers in different AS can
◆ run inter-AS routing
run different intra-AS
protocol with other
routing protocol gateway routers
Intra-AS and Inter-AS routing
C.b ◼ Gateways:
B.a
◼ perform inter-AS
A.a
b c routing amongst
a A.c
C a themselves
b
a B ◼ perform intra-AS
d c
b
routers with
A
other routers in
their AS
network layer
inter-AS, intra-AS link layer
routing in
gateway A.c physical layer
Intra-AS and Inter-AS routing

Inter-AS
C.b routing
between B.a
A.a A and B Host
b A.c c h2
a C a
b
a B
Host d c Intra-AS routing
h1 b
A within AS B
Intra-AS routing
within AS A
Routing in the Internet: Intra-AS Routing

◼ 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)
RIP ( Routing Information Protocol)
◼ Distance vector algorithm
▪ Distance metric: # of hops

From router A to subnets:

u Subnets hops
v
u 1
A B w v 2
w 2
x 3
x y 3
z C D z 2
y
RIP advertisements

◼ Distance vectors: exchanged among


neighbors every 30 sec via Response
Message (also called advertisement)

◼ Each advertisement: list of up to 25


destination subnets within AS
RIP: Link Failure and Recovery
If no advertisement heard after 180 sec --> neighbor/link
declared dead

◼ routes via neighbor invalidated

◼ new advertisements sent to neighbors

◼ neighbors in turn send out new advertisements (if tables


changed)

◼ link failure info propagates to entire net


Internet inter-AS routing: BGP
▪ BGP (Border Gateway Protocol): the defacto inter-
domain routing protocol
• “glue that holds the Internet together”
▪ allows subnet to advertise its existence, and the
destinations it can reach, to rest of Internet: “I am
here, here is who I can reach, and how”
▪ BGP provides each AS a means to:
◆ eBGP: obtain subnet reachability information from
neighboring ASes
◆ iBGP: propagate reachability information to all AS-
internal routers.
◆ determine “good” routes to other networks based on
reachability information and policy
eBGP, iBGP connections

2b

2a 2c

1b 3b
2d
1a 1c ∂
3a 3c
AS 2
1d 3d

AS 1 eBGP connectivity AS 3
logical iBGP connectivity

1c gateway routers run both eBGP and iBGP protocols


Path attributes and BGP routes
▪ BGP advertised route: prefix + attributes
◆ prefix: destination being advertised
◆ two important attributes:
• AS-PATH: list of ASes through which prefix advertisement
has passed
• NEXT-HOP: indicates specific internal-AS router to next-hop
AS
▪ 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 other neighboring ASes
BGP path advertisement
AS 3 3b
AS 1b 3a 3c
1
1a 1c AS 2 2b 3d X

1d AS3,
AS2,AS3,X 2a 2c X

2d

▪ AS2 router 2c receives path advertisement AS3,X (via eBGP)


from AS3 router 3a
▪ based on AS2 policy, AS2 router 2c accepts path AS3,X,
propagates (via iBGP) to all AS2 routers
▪ based on AS2 policy, AS2 router 2a advertises (via eBGP)
path AS2, AS3, X to AS1 router 1c
BGP path advertisement (more)
AS 3 3b
AS 1b AS3,X 3a 3c
AS3,X
1 AS3,X
1a 1c AS 2 2b 3d X
AS3,X
1d AS3,
AS2,AS3,X 2a 2c X

2d

gateway router may learn about multiple paths to


destination:
▪ AS1 gateway router 1c learns path AS2,AS3,X from 2a
▪ AS1 gateway router 1c learns path AS3,X from 3a
▪ based on policy, AS1 gateway router 1c chooses path AS3,X
and advertises path within AS1 via iBGP
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


BGP path advertisement
AS 3 3b
AS 1b AS3,X 3a 3c
AS3,X
1 1 AS3,X
1a 1c AS 2 2b 3d X
2
AS3,X
2 1 AS3,
local link 1d
AS2,AS3,X 2a 2c X
interfaces
at 1a, 1d
2d

▪ recall: 1a, 1b, 1d learn via iBGP from 1c: “path to X


dest interface goes through 1c”
… … ▪ at 1d: OSPF intra-domain routing: to get to 1c, use
1c 1 interface 1
X 1
… … ▪ at 1d: to get to X, use interface 1
BGP path advertisement
AS 3 3b
AS 1b 3a 3c
1 1
1a 1c AS 2 2b 3d X
2

1d
2a 2c

2d

▪ recall: 1a, 1b, 1d learn via iBGP from 1c: “path to X


destinterface goes through 1c”
… … ▪ at 1d: OSPF intra-domain routing: to get to 1c, use
1c 2 interface 1
X 2
… … ▪ at 1d: to get to X, use interface 1
▪ at 1a: OSPF intra-domain routing: to get to 1c, use
interface 2
▪ at 1a: to get to X, use interface 2
Why different Intra-, Inter-AS routing ?
policy:
▪ inter-AS: admin wants control over how its traffic routed,
who routes through its network
▪ intra-AS: single admin, so policy less of an issue
scale:
▪ hierarchical routing saves table size, reduced update
traffic
performance:
▪ intra-AS: can focus on performance
▪ inter-AS: policy dominates over performance
Congestion Control Algorithms

▪What is Congestion?

▪Approaches to Congestion Control

• Traffic-Aware Routing

• Admission Control

• Traffic Throttling

• Load Shedding
What is Congestion?

When too much traffic is offered, congestion sets in and


performance degrades sharply.
General Principles of Congestion Control

◼ Monitor the system

◆detect when and where congestion occurs.

◼ Pass information to where action can be taken.

◼ Adjust system operation to correct the problem.


Approaches to Congestion Control
◼ The presence of congestion means that the load is (temporarily)
greater than the resources (in a part of the network) can handle.

◼ Two solutions possible:

1Increase resources

2Decrease load
END

You might also like