SlideShare a Scribd company logo
Chapter 4
Network Layer
Computer Networking: A
Top Down Approach
4th edition.
Jim Kurose, Keith Ross
Addison-Wesley, July
2007.
Routing Algorithm Classification
Global Routing Algorithm

Decentralized Routing
Algorithm

 Computes least cost path

 No node has complete








using complete global
knowledge about the
network.
Takes connectivity between
all nodes and all link costs
as input.
All routers have complete
topology, link cost
information
Also called “Link State”
Algorithms
Open Shortest Path First
Protocol (OSPF)








information about the cost
of all links.
In the beginning knowledge
of its own directly attached
links.
Computes least cost path by
an iterative process of
calculation and exchange of
information.
Also called Distance Vector
(DV) Algorithm
Routing Information Protocol
(RIP)
Distance Vector Algorithm
Distributed:
 Receives info from the neighbors
 Performs calculation
 Distributes the results to neighbors
Iterative:
 Process continues until no more information
is exchanged between neighbours.
 Asynchronous:
 Does not require all the nodes to operate
in lockstep with each other
Distance Vector Algorithm
Bellman-Ford Equation
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
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
Distance Vector Algorithm
Basic idea:
 From time-to-time, each node 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

 All the nodes continue to exchange their distance

vectors until the estimate Dx(y) converges to the
actual least cost dx(y)
Dx(y) = min{c(x,y) + Dy(y), c(x,z) + Dz(y)}
= min{2+0 , 7+1} = 2

node x table
cost to
x y z

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

cost to
x y z
from

from

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

Dx(z) = min{c(x,y) +
Dy(z), c(x,z) + Dz(z)}

x 0 2 3
y 2 0 1
z 7 1 0

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

from

x

x ∞∞ ∞
y ∞∞ ∞
z 71 0

time

2

y
7

1

z
Dx(y) = min{c(x,y) + Dy(y), c(x,z) + Dz(y)}
= min{2+0 , 7+1} = 2

node x table
cost to
x y z

x ∞∞ ∞
y ∞∞ ∞
z 71 0

from

from

from

from

x 0 2 7
y 2 0 1
z 7 1 0
cost to
x y z

x 0 2 7
y 2 0 1
z 3 1 0

x 0 2 3
y 2 0 1
z 3 1 0
cost to
x y z
x 0 2 3
y 2 0 1
z 3 1 0
cost to
x y z

from

from

from

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

x 0 2 3
y 2 0 1
z 7 1 0

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

cost to
x y z

cost to
x y z

from

from

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

cost to
x y z

Dx(z) = min{c(x,y) +
Dy(z), c(x,z) + Dz(z)}

x 0 2 3
y 2 0 1
z 3 1 0
time

x

2

y
7

1

z
Example
v

5
z

10

7

2

1

y

x

Using DV algorithm show the table entries at node z?
From

Solution

z
z 0
y 3
x 2
v 5

Cost to
y x
3 2
0 1
1
0
7 7

v
5
7
7
0
RIP ( Routing Information Protocol)
 Distance Vector Algorithm
 Hop Count as cost metric
 Each link has cost 1
 Cost are actually from source router to a destination subnet
 RIP uses the term hop, which is the number of subnets
traversed along the shortest path from source router to
destination subnet.

u

v

A

z

C

B

w

x

D
y

From router A to subnets:
destination hops
u
1
v
2
w
2
x
3
y
3
z
2
RIP ( Routing Information Protocol)
 The maximum cost of a path is limited to 15


Limits the use of RIP to networks that have fewer
than 15 hops.

 Neighboring routers exchange information

after every 30 sec via RIP Response message
(also called RIP advertisements)


Known as Periodic timer.

 A Router can also request information about

its neighbor’s cost to a given destination using
RIP’s Request message.
RIP: Link Failure and Recovery
 If no advertisement heard after 180

sec --> neighbor /link declared dead
 RIP modifies local routing table
 Propagates this information by
sending this advertisements to its
neighboring routers.
 Called as Expiration timer.
Limitations of RIP

Network span limited by

maximum hop count of 15
Note that actual number of
networks can be > 15!
Slow convergence
DV Algorithm
RIP Implementation
 Router send RIP request and Response message over

UDP port no 520.
 RIP routing tables managed by application-level process
called routed.
 Routed executes RIP i.e. maintains routing information
and exchanges messages with other routed processes in
neighbors.
routed

routed

Transprt
(UDP)
network
(IP)

link
physical

Transprt
(UDP)
forwarding
table

forwarding
table

network
(IP)
link
physical
IPv4 Datagram Format
IP protocol version
number
header length
(bytes)
“type” of data
max number
remaining hops
(decremented at
each router)

upper layer protocol
to deliver payload to

type of
ver head.
len service

length
fragment
16-bit identifier flgs
offset
time to
header
protocol
live
checksum

total datagram
length (bytes)

for
fragmentation/
reassembly

32 bit source IP address
32 bit destination IP address
Options (if any)

data
(variable length,
a TCP
or UDP segment)

e.g. timestamp,
record route
taken etc
Find other use?
IP Fragmentation & Reassembly
 Network links have MTU

(Maximum Transmission Unit)
- largest possible link-level
data that can be encapsulated
in a frame.
o Different link between
sender and destination
• Use different MTUs
 Large IP datagram is divided
(“fragmented”)
o One datagram becomes
several datagrams
o Referred as Fragments
o “Reassembled” only at final
destination
o IP header bits used to
identify, order related
fragments

fragmentation:
in: one large datagram
out: 3 smaller datagrams

reassembly
IP Fragmentation & Reassembly
 Identification Number, Flag and Offset fields in the datagram

header

 Identification Number
o
o

Sending Host stamps the datagram with an identification number
Destination receives datagram
o Examines the identification number

 Flag Bit
o
o

All fragments set to 1
Last fragment set to 0

 Offset Field
o

Use to specify where fragment fits in the within the original IP
datagram
IP Fragmentation & Reassembly
Example
 Datagram of 4000 bytes
o 20 bytes of IP header, 3980 bytes of payload
o MTU is 1500 bytes
Fragment
Bytes
ID
Offset
0 (beginning)

Flag

1st Fragment

1480 bytes

777

1 (there is more)

2nd Fragment

1480 bytes

777

185

1 (there is more)

3rd Fragment

1020 bytes

777

370

0 (Last )
Hierarchical Routing
 All routers run the same routing

Algorithm?
… not true in practice

Scale: With millions of
destinations:
 Can’t store all destinations

in routing tables
 Exchange of Routing
updates would swamp links!

Administrative Autonomy
 Internet = network of

networks
 Each network administrator
may want to control routing
in its own network
Hierarchical Routing
 Routers are organized

into “Autonomous
Systems” (ASs).





Routers in same
administrative domain
The routing algorithm
within an autonomous
system is called an
“intra-AS” routing
protocol
Routers in different AS
can run different intraAS routing protocol

Gateway Routers
 One or more of the
routers in an AS will
have the added task of
forwarding packets to
destinations outside
the AS.
1c
1a
1d

1b

AS1
Interconnected ASs

3c
3b

3a

2a

AS3

1c
1a
1d

2c
2b
AS2

1b

AS1

1b, 1c, 2a and 3a are Gateway Routers
Inter-AS tasks

AS1 must:
1. Learn which destinations are
reachable through AS2, which
through AS3
2. Propagate this reachability
information to all routers in
AS1.

Configure Forwarding table
Job of inter-AS routing protocol!

 Suppose router in AS1

receives datagram destined
outside of AS1:
 Router should forward
packet to gateway
router, but which one?

3c
3a
3b AS3

1a

2a

1c
1d

1b

Intra-AS
Routing
algorithm

AS1
Inter-AS
Routing
algorithm

Forwarding
table

2c
AS2

2b
Example: Setting forwarding table in router 1d
 Suppose AS1 learns (via inter-AS protocol) that

network 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
Example: Choosing among multiple ASs
 Now suppose AS1 learns from inter-AS protocol

that a network 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.
x

3c

3a
3b
AS3
1a

2a

1c
1d

1b

2c
AS2

AS1

2b
Example: Choosing among multiple ASs

Learn from inter-AS
protocol that network
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 the
interface I that leads
to least-cost gateway.
Enter (x,I) in
forwarding table

Steps in adding an outside AS destination in a routers forwarding Table

More Related Content

What's hot

Routing
RoutingRouting
Routing
Amit Pandey
 
Routing
RoutingRouting
Routing
Rachna Sharma
 
Ch22
Ch22Ch22
Notes
NotesNotes
Routing algorithm network layer
Routing algorithm  network layerRouting algorithm  network layer
Routing algorithm network layer
sambhenilesh
 
Network layer
Network layerNetwork layer
Network layer
sbkbca
 
Routing Technique Table Type by Umar danjuma maiwada.ppt
Routing Technique Table Type by Umar danjuma maiwada.pptRouting Technique Table Type by Umar danjuma maiwada.ppt
Routing Technique Table Type by Umar danjuma maiwada.ppt
umardanjumamaiwada
 
Routing Algorithm
Routing AlgorithmRouting Algorithm
Routing Algorithm
Kamal Acharya
 
Routing
RoutingRouting
Routing protocols-network-layer
Routing protocols-network-layerRouting protocols-network-layer
Routing protocols-network-layer
Nitesh Singh
 
OSPF - Routing Protocol
OSPF - Routing ProtocolOSPF - Routing Protocol
OSPF - Routing Protocol
selvakumar_b1985
 
Lecture 3 network layer
Lecture 3 network layerLecture 3 network layer
Lecture 3 network layer
Ronoh Kennedy
 
Routing table and routing algorithms
Routing table and routing algorithmsRouting table and routing algorithms
Routing table and routing algorithms
lavanyapathy
 
Evolution of Routing Techniques
Evolution of  Routing TechniquesEvolution of  Routing Techniques
Evolution of Routing Techniques
Tusharadri Sarkar
 
Routing protocols
Routing protocolsRouting protocols
Routing protocols
N.Jagadish Kumar
 
Network layer ip address assignment and routing
Network layer ip address assignment and routingNetwork layer ip address assignment and routing
Network layer ip address assignment and routing
HamzahMohammed4
 
Network Layer
Network LayerNetwork Layer
Network Layer
Dr Shashikant Athawale
 
Pathlet routing_Demo2
Pathlet routing_Demo2Pathlet routing_Demo2
Pathlet routing_Demo2
asrivas2
 
Aodv slide final
Aodv slide finalAodv slide final
Aodv slide final
guest53dedc9
 

What's hot (19)

Routing
RoutingRouting
Routing
 
Routing
RoutingRouting
Routing
 
Ch22
Ch22Ch22
Ch22
 
Notes
NotesNotes
Notes
 
Routing algorithm network layer
Routing algorithm  network layerRouting algorithm  network layer
Routing algorithm network layer
 
Network layer
Network layerNetwork layer
Network layer
 
Routing Technique Table Type by Umar danjuma maiwada.ppt
Routing Technique Table Type by Umar danjuma maiwada.pptRouting Technique Table Type by Umar danjuma maiwada.ppt
Routing Technique Table Type by Umar danjuma maiwada.ppt
 
Routing Algorithm
Routing AlgorithmRouting Algorithm
Routing Algorithm
 
Routing
RoutingRouting
Routing
 
Routing protocols-network-layer
Routing protocols-network-layerRouting protocols-network-layer
Routing protocols-network-layer
 
OSPF - Routing Protocol
OSPF - Routing ProtocolOSPF - Routing Protocol
OSPF - Routing Protocol
 
Lecture 3 network layer
Lecture 3 network layerLecture 3 network layer
Lecture 3 network layer
 
Routing table and routing algorithms
Routing table and routing algorithmsRouting table and routing algorithms
Routing table and routing algorithms
 
Evolution of Routing Techniques
Evolution of  Routing TechniquesEvolution of  Routing Techniques
Evolution of Routing Techniques
 
Routing protocols
Routing protocolsRouting protocols
Routing protocols
 
Network layer ip address assignment and routing
Network layer ip address assignment and routingNetwork layer ip address assignment and routing
Network layer ip address assignment and routing
 
Network Layer
Network LayerNetwork Layer
Network Layer
 
Pathlet routing_Demo2
Pathlet routing_Demo2Pathlet routing_Demo2
Pathlet routing_Demo2
 
Aodv slide final
Aodv slide finalAodv slide final
Aodv slide final
 

Viewers also liked

Chap 14 rip, ospf
Chap 14 rip, ospfChap 14 rip, ospf
Chap 14 rip, ospf
Noctorous Jamal
 
Chap 24 mobile ip
Chap 24 mobile ipChap 24 mobile ip
Chap 24 mobile ip
Noctorous Jamal
 
Chap 08 ip
Chap 08 ipChap 08 ip
Chap 08 ip
Noctorous Jamal
 
Chap 11 udp
Chap 11 udpChap 11 udp
Chap 11 udp
Noctorous Jamal
 
Chap 27 next generation i pv6
Chap 27 next generation i pv6Chap 27 next generation i pv6
Chap 27 next generation i pv6
Noctorous Jamal
 
Chap 12 tcp
Chap 12 tcpChap 12 tcp
Chap 12 tcp
Noctorous Jamal
 

Viewers also liked (6)

Chap 14 rip, ospf
Chap 14 rip, ospfChap 14 rip, ospf
Chap 14 rip, ospf
 
Chap 24 mobile ip
Chap 24 mobile ipChap 24 mobile ip
Chap 24 mobile ip
 
Chap 08 ip
Chap 08 ipChap 08 ip
Chap 08 ip
 
Chap 11 udp
Chap 11 udpChap 11 udp
Chap 11 udp
 
Chap 27 next generation i pv6
Chap 27 next generation i pv6Chap 27 next generation i pv6
Chap 27 next generation i pv6
 
Chap 12 tcp
Chap 12 tcpChap 12 tcp
Chap 12 tcp
 

Similar to Week13 lec2

Module 3- transport_layer .pptx
Module 3- transport_layer           .pptxModule 3- transport_layer           .pptx
Module 3- transport_layer .pptx
hariprasad279825
 
Intro 2 Computer Networks
Intro 2 Computer NetworksIntro 2 Computer Networks
Intro 2 Computer Networks
rakeshgoswami
 
Introduction to Computer Networks
Introduction to Computer NetworksIntroduction to Computer Networks
Introduction to Computer Networks
Venkatesh Iyer
 
Lecture set 5
Lecture set 5Lecture set 5
Lecture set 5
Gopi Saiteja
 
Cnetwork
CnetworkCnetwork
Cnetwork
ADARSHN40
 
4af46e43-4dc7-4b54-ba8b-3a2594bb5269 j.pdf
4af46e43-4dc7-4b54-ba8b-3a2594bb5269 j.pdf4af46e43-4dc7-4b54-ba8b-3a2594bb5269 j.pdf
4af46e43-4dc7-4b54-ba8b-3a2594bb5269 j.pdf
mrcopyxerox
 
DSR,LSR,IGMP,RIP,OSPF.ppt
DSR,LSR,IGMP,RIP,OSPF.pptDSR,LSR,IGMP,RIP,OSPF.ppt
DSR,LSR,IGMP,RIP,OSPF.ppt
Munnakumar518378
 
Week11 lec2
Week11 lec2Week11 lec2
Week11 lec2
syedhaiderraza
 
Chapter Four - Network Layer.pptx
Chapter Four - Network Layer.pptxChapter Four - Network Layer.pptx
Chapter Four - Network Layer.pptx
GirT2
 
Link layer
Link layerLink layer
Link layer
Belete Kidane
 
7-Lect_7 .pptxNetwork LayerNetwork Layer
7-Lect_7 .pptxNetwork LayerNetwork Layer7-Lect_7 .pptxNetwork LayerNetwork Layer
7-Lect_7 .pptxNetwork LayerNetwork Layer
ZahouAmel1
 
7-Lect_7 .pptxNetwork Layer. Addressing Subnetting Mask (default and subnet) ...
7-Lect_7 .pptxNetwork Layer. Addressing Subnetting Mask (default and subnet) ...7-Lect_7 .pptxNetwork Layer. Addressing Subnetting Mask (default and subnet) ...
7-Lect_7 .pptxNetwork Layer. Addressing Subnetting Mask (default and subnet) ...
ZahouAmel1
 
Routing algorithm
Routing algorithmRouting algorithm
Routing algorithm
Siva Priya
 
ospf.ppt
ospf.pptospf.ppt
ospf.ppt
SolWeje
 
Introduction to tcp ip linux networking
Introduction to tcp ip   linux networkingIntroduction to tcp ip   linux networking
Introduction to tcp ip linux networking
Sreenatha Reddy K R
 
Chapter 5 - Computer Networking a top-down Approach 7th
Chapter 5 - Computer Networking a top-down Approach 7thChapter 5 - Computer Networking a top-down Approach 7th
Chapter 5 - Computer Networking a top-down Approach 7th
Andy Juan Sarango Veliz
 
Routing
RoutingRouting
Routing Protocols.pptx
Routing Protocols.pptxRouting Protocols.pptx
Routing Protocols.pptx
sazia7
 
Automatic cluster formation and assigning address for wireless sensor net
Automatic cluster formation and assigning address for wireless sensor netAutomatic cluster formation and assigning address for wireless sensor net
Automatic cluster formation and assigning address for wireless sensor net
IAEME Publication
 
DCCN Network Layer congestion control TCP
DCCN Network Layer congestion control TCPDCCN Network Layer congestion control TCP
DCCN Network Layer congestion control TCP
Sreedhar Chowdam
 

Similar to Week13 lec2 (20)

Module 3- transport_layer .pptx
Module 3- transport_layer           .pptxModule 3- transport_layer           .pptx
Module 3- transport_layer .pptx
 
Intro 2 Computer Networks
Intro 2 Computer NetworksIntro 2 Computer Networks
Intro 2 Computer Networks
 
Introduction to Computer Networks
Introduction to Computer NetworksIntroduction to Computer Networks
Introduction to Computer Networks
 
Lecture set 5
Lecture set 5Lecture set 5
Lecture set 5
 
Cnetwork
CnetworkCnetwork
Cnetwork
 
4af46e43-4dc7-4b54-ba8b-3a2594bb5269 j.pdf
4af46e43-4dc7-4b54-ba8b-3a2594bb5269 j.pdf4af46e43-4dc7-4b54-ba8b-3a2594bb5269 j.pdf
4af46e43-4dc7-4b54-ba8b-3a2594bb5269 j.pdf
 
DSR,LSR,IGMP,RIP,OSPF.ppt
DSR,LSR,IGMP,RIP,OSPF.pptDSR,LSR,IGMP,RIP,OSPF.ppt
DSR,LSR,IGMP,RIP,OSPF.ppt
 
Week11 lec2
Week11 lec2Week11 lec2
Week11 lec2
 
Chapter Four - Network Layer.pptx
Chapter Four - Network Layer.pptxChapter Four - Network Layer.pptx
Chapter Four - Network Layer.pptx
 
Link layer
Link layerLink layer
Link layer
 
7-Lect_7 .pptxNetwork LayerNetwork Layer
7-Lect_7 .pptxNetwork LayerNetwork Layer7-Lect_7 .pptxNetwork LayerNetwork Layer
7-Lect_7 .pptxNetwork LayerNetwork Layer
 
7-Lect_7 .pptxNetwork Layer. Addressing Subnetting Mask (default and subnet) ...
7-Lect_7 .pptxNetwork Layer. Addressing Subnetting Mask (default and subnet) ...7-Lect_7 .pptxNetwork Layer. Addressing Subnetting Mask (default and subnet) ...
7-Lect_7 .pptxNetwork Layer. Addressing Subnetting Mask (default and subnet) ...
 
Routing algorithm
Routing algorithmRouting algorithm
Routing algorithm
 
ospf.ppt
ospf.pptospf.ppt
ospf.ppt
 
Introduction to tcp ip linux networking
Introduction to tcp ip   linux networkingIntroduction to tcp ip   linux networking
Introduction to tcp ip linux networking
 
Chapter 5 - Computer Networking a top-down Approach 7th
Chapter 5 - Computer Networking a top-down Approach 7thChapter 5 - Computer Networking a top-down Approach 7th
Chapter 5 - Computer Networking a top-down Approach 7th
 
Routing
RoutingRouting
Routing
 
Routing Protocols.pptx
Routing Protocols.pptxRouting Protocols.pptx
Routing Protocols.pptx
 
Automatic cluster formation and assigning address for wireless sensor net
Automatic cluster formation and assigning address for wireless sensor netAutomatic cluster formation and assigning address for wireless sensor net
Automatic cluster formation and assigning address for wireless sensor net
 
DCCN Network Layer congestion control TCP
DCCN Network Layer congestion control TCPDCCN Network Layer congestion control TCP
DCCN Network Layer congestion control TCP
 

More from syedhaiderraza

Week14 lec1
Week14 lec1Week14 lec1
Week14 lec1
syedhaiderraza
 
Week11 lec1
Week11 lec1Week11 lec1
Week11 lec1
syedhaiderraza
 
Week10 lec1
Week10 lec1Week10 lec1
Week10 lec1
syedhaiderraza
 
Week9 lec1
Week9 lec1Week9 lec1
Week9 lec1
syedhaiderraza
 
Week8 lec2-bscs1
Week8 lec2-bscs1Week8 lec2-bscs1
Week8 lec2-bscs1
syedhaiderraza
 
Week8 lec1-bscs1
Week8 lec1-bscs1Week8 lec1-bscs1
Week8 lec1-bscs1
syedhaiderraza
 
Week5 lec3-bscs1
Week5 lec3-bscs1Week5 lec3-bscs1
Week5 lec3-bscs1
syedhaiderraza
 
Week5 lec2-bscs1
Week5 lec2-bscs1Week5 lec2-bscs1
Week5 lec2-bscs1
syedhaiderraza
 
Week5 lec1-bscs1
Week5 lec1-bscs1Week5 lec1-bscs1
Week5 lec1-bscs1
syedhaiderraza
 
Week4 lec2-bscs1
Week4 lec2-bscs1Week4 lec2-bscs1
Week4 lec2-bscs1
syedhaiderraza
 
Week4 lec1-bscs1
Week4 lec1-bscs1Week4 lec1-bscs1
Week4 lec1-bscs1
syedhaiderraza
 
Week3 lec3-bscs1
Week3 lec3-bscs1Week3 lec3-bscs1
Week3 lec3-bscs1
syedhaiderraza
 
Week3 lec 2
Week3 lec 2Week3 lec 2
Week3 lec 2
syedhaiderraza
 
Week3 lec 1
Week3 lec 1Week3 lec 1
Week3 lec 1
syedhaiderraza
 
Week2 lec3-bscs1
Week2 lec3-bscs1Week2 lec3-bscs1
Week2 lec3-bscs1
syedhaiderraza
 
Week2 lec2-bscs1
Week2 lec2-bscs1Week2 lec2-bscs1
Week2 lec2-bscs1
syedhaiderraza
 
Week2 lec1-bscs1
Week2 lec1-bscs1Week2 lec1-bscs1
Week2 lec1-bscs1
syedhaiderraza
 
Week1 lec2-bscs1
Week1 lec2-bscs1Week1 lec2-bscs1
Week1 lec2-bscs1
syedhaiderraza
 
Week1 lec1-bscs1
Week1 lec1-bscs1Week1 lec1-bscs1
Week1 lec1-bscs1
syedhaiderraza
 
Week16 lec2
Week16 lec2Week16 lec2
Week16 lec2
syedhaiderraza
 

More from syedhaiderraza (20)

Week14 lec1
Week14 lec1Week14 lec1
Week14 lec1
 
Week11 lec1
Week11 lec1Week11 lec1
Week11 lec1
 
Week10 lec1
Week10 lec1Week10 lec1
Week10 lec1
 
Week9 lec1
Week9 lec1Week9 lec1
Week9 lec1
 
Week8 lec2-bscs1
Week8 lec2-bscs1Week8 lec2-bscs1
Week8 lec2-bscs1
 
Week8 lec1-bscs1
Week8 lec1-bscs1Week8 lec1-bscs1
Week8 lec1-bscs1
 
Week5 lec3-bscs1
Week5 lec3-bscs1Week5 lec3-bscs1
Week5 lec3-bscs1
 
Week5 lec2-bscs1
Week5 lec2-bscs1Week5 lec2-bscs1
Week5 lec2-bscs1
 
Week5 lec1-bscs1
Week5 lec1-bscs1Week5 lec1-bscs1
Week5 lec1-bscs1
 
Week4 lec2-bscs1
Week4 lec2-bscs1Week4 lec2-bscs1
Week4 lec2-bscs1
 
Week4 lec1-bscs1
Week4 lec1-bscs1Week4 lec1-bscs1
Week4 lec1-bscs1
 
Week3 lec3-bscs1
Week3 lec3-bscs1Week3 lec3-bscs1
Week3 lec3-bscs1
 
Week3 lec 2
Week3 lec 2Week3 lec 2
Week3 lec 2
 
Week3 lec 1
Week3 lec 1Week3 lec 1
Week3 lec 1
 
Week2 lec3-bscs1
Week2 lec3-bscs1Week2 lec3-bscs1
Week2 lec3-bscs1
 
Week2 lec2-bscs1
Week2 lec2-bscs1Week2 lec2-bscs1
Week2 lec2-bscs1
 
Week2 lec1-bscs1
Week2 lec1-bscs1Week2 lec1-bscs1
Week2 lec1-bscs1
 
Week1 lec2-bscs1
Week1 lec2-bscs1Week1 lec2-bscs1
Week1 lec2-bscs1
 
Week1 lec1-bscs1
Week1 lec1-bscs1Week1 lec1-bscs1
Week1 lec1-bscs1
 
Week16 lec2
Week16 lec2Week16 lec2
Week16 lec2
 

Recently uploaded

Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
David Douglas School District
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
amberjdewit93
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
TechSoup
 
Cognitive Development Adolescence Psychology
Cognitive Development Adolescence PsychologyCognitive Development Adolescence Psychology
Cognitive Development Adolescence Psychology
paigestewart1632
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
IreneSebastianRueco1
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
GeorgeMilliken2
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Fajar Baskoro
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
heathfieldcps1
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
Celine George
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
NgcHiNguyn25
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
Katrina Pritchard
 
DRUGS AND ITS classification slide share
DRUGS AND ITS classification slide shareDRUGS AND ITS classification slide share
DRUGS AND ITS classification slide share
taiba qazi
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
Celine George
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
Academy of Science of South Africa
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
chanes7
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
TechSoup
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
adhitya5119
 

Recently uploaded (20)

Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
 
Cognitive Development Adolescence Psychology
Cognitive Development Adolescence PsychologyCognitive Development Adolescence Psychology
Cognitive Development Adolescence Psychology
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
 
DRUGS AND ITS classification slide share
DRUGS AND ITS classification slide shareDRUGS AND ITS classification slide share
DRUGS AND ITS classification slide share
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
 

Week13 lec2

  • 1. Chapter 4 Network Layer Computer Networking: A Top Down Approach 4th edition. Jim Kurose, Keith Ross Addison-Wesley, July 2007.
  • 2. Routing Algorithm Classification Global Routing Algorithm Decentralized Routing Algorithm  Computes least cost path  No node has complete     using complete global knowledge about the network. Takes connectivity between all nodes and all link costs as input. All routers have complete topology, link cost information Also called “Link State” Algorithms Open Shortest Path First Protocol (OSPF)     information about the cost of all links. In the beginning knowledge of its own directly attached links. Computes least cost path by an iterative process of calculation and exchange of information. Also called Distance Vector (DV) Algorithm Routing Information Protocol (RIP)
  • 3. Distance Vector Algorithm Distributed:  Receives info from the neighbors  Performs calculation  Distributes the results to neighbors Iterative:  Process continues until no more information is exchanged between neighbours.  Asynchronous:  Does not require all the nodes to operate in lockstep with each other
  • 4. Distance Vector Algorithm Bellman-Ford Equation 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
  • 5. 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
  • 6. Distance Vector Algorithm Basic idea:  From time-to-time, each node 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  All the nodes continue to exchange their distance vectors until the estimate Dx(y) converges to the actual least cost dx(y)
  • 7. Dx(y) = min{c(x,y) + Dy(y), c(x,z) + Dz(y)} = min{2+0 , 7+1} = 2 node x table cost to x y z = min{2+1 , 7+0} = 3 cost to x y z from from x 0 2 7 y ∞∞ ∞ z ∞∞ ∞ node y table cost to x y z Dx(z) = min{c(x,y) + Dy(z), c(x,z) + Dz(z)} x 0 2 3 y 2 0 1 z 7 1 0 x ∞ ∞ ∞ y 2 0 1 z ∞∞ ∞ node z table cost to x y z from from x x ∞∞ ∞ y ∞∞ ∞ z 71 0 time 2 y 7 1 z
  • 8. Dx(y) = min{c(x,y) + Dy(y), c(x,z) + Dz(y)} = min{2+0 , 7+1} = 2 node x table cost to x y z x ∞∞ ∞ y ∞∞ ∞ z 71 0 from from from from x 0 2 7 y 2 0 1 z 7 1 0 cost to x y z x 0 2 7 y 2 0 1 z 3 1 0 x 0 2 3 y 2 0 1 z 3 1 0 cost to x y z x 0 2 3 y 2 0 1 z 3 1 0 cost to x y z from from from x ∞ ∞ ∞ y 2 0 1 z ∞∞ ∞ node z table cost to x y z x 0 2 3 y 2 0 1 z 7 1 0 = min{2+1 , 7+0} = 3 cost to x y z cost to x y z from from x 0 2 7 y ∞∞ ∞ z ∞∞ ∞ node y table cost to x y z cost to x y z Dx(z) = min{c(x,y) + Dy(z), c(x,z) + Dz(z)} x 0 2 3 y 2 0 1 z 3 1 0 time x 2 y 7 1 z
  • 9. Example v 5 z 10 7 2 1 y x Using DV algorithm show the table entries at node z?
  • 10. From Solution z z 0 y 3 x 2 v 5 Cost to y x 3 2 0 1 1 0 7 7 v 5 7 7 0
  • 11. RIP ( Routing Information Protocol)  Distance Vector Algorithm  Hop Count as cost metric  Each link has cost 1  Cost are actually from source router to a destination subnet  RIP uses the term hop, which is the number of subnets traversed along the shortest path from source router to destination subnet. u v A z C B w x D y From router A to subnets: destination hops u 1 v 2 w 2 x 3 y 3 z 2
  • 12. RIP ( Routing Information Protocol)  The maximum cost of a path is limited to 15  Limits the use of RIP to networks that have fewer than 15 hops.  Neighboring routers exchange information after every 30 sec via RIP Response message (also called RIP advertisements)  Known as Periodic timer.  A Router can also request information about its neighbor’s cost to a given destination using RIP’s Request message.
  • 13. RIP: Link Failure and Recovery  If no advertisement heard after 180 sec --> neighbor /link declared dead  RIP modifies local routing table  Propagates this information by sending this advertisements to its neighboring routers.  Called as Expiration timer.
  • 14. Limitations of RIP Network span limited by maximum hop count of 15 Note that actual number of networks can be > 15! Slow convergence DV Algorithm
  • 15. RIP Implementation  Router send RIP request and Response message over UDP port no 520.  RIP routing tables managed by application-level process called routed.  Routed executes RIP i.e. maintains routing information and exchanges messages with other routed processes in neighbors. routed routed Transprt (UDP) network (IP) link physical Transprt (UDP) forwarding table forwarding table network (IP) link physical
  • 16. IPv4 Datagram Format IP protocol version number header length (bytes) “type” of data max number remaining hops (decremented at each router) upper layer protocol to deliver payload to type of ver head. len service length fragment 16-bit identifier flgs offset time to header protocol live checksum total datagram length (bytes) for fragmentation/ reassembly 32 bit source IP address 32 bit destination IP address Options (if any) data (variable length, a TCP or UDP segment) e.g. timestamp, record route taken etc Find other use?
  • 17. IP Fragmentation & Reassembly  Network links have MTU (Maximum Transmission Unit) - largest possible link-level data that can be encapsulated in a frame. o Different link between sender and destination • Use different MTUs  Large IP datagram is divided (“fragmented”) o One datagram becomes several datagrams o Referred as Fragments o “Reassembled” only at final destination o IP header bits used to identify, order related fragments fragmentation: in: one large datagram out: 3 smaller datagrams reassembly
  • 18. IP Fragmentation & Reassembly  Identification Number, Flag and Offset fields in the datagram header  Identification Number o o Sending Host stamps the datagram with an identification number Destination receives datagram o Examines the identification number  Flag Bit o o All fragments set to 1 Last fragment set to 0  Offset Field o Use to specify where fragment fits in the within the original IP datagram
  • 19. IP Fragmentation & Reassembly Example  Datagram of 4000 bytes o 20 bytes of IP header, 3980 bytes of payload o MTU is 1500 bytes Fragment Bytes ID Offset 0 (beginning) Flag 1st Fragment 1480 bytes 777 1 (there is more) 2nd Fragment 1480 bytes 777 185 1 (there is more) 3rd Fragment 1020 bytes 777 370 0 (Last )
  • 20. Hierarchical Routing  All routers run the same routing Algorithm? … not true in practice Scale: With millions of destinations:  Can’t store all destinations in routing tables  Exchange of Routing updates would swamp links! Administrative Autonomy  Internet = network of networks  Each network administrator may want to control routing in its own network
  • 21. Hierarchical Routing  Routers are organized into “Autonomous Systems” (ASs).    Routers in same administrative domain The routing algorithm within an autonomous system is called an “intra-AS” routing protocol Routers in different AS can run different intraAS routing protocol Gateway Routers  One or more of the routers in an AS will have the added task of forwarding packets to destinations outside the AS. 1c 1a 1d 1b AS1
  • 23. Inter-AS tasks AS1 must: 1. Learn which destinations are reachable through AS2, which through AS3 2. Propagate this reachability information to all routers in AS1.  Configure Forwarding table Job of inter-AS routing protocol!  Suppose router in AS1 receives datagram destined outside of AS1:  Router should forward packet to gateway router, but which one? 3c 3a 3b AS3 1a 2a 1c 1d 1b Intra-AS Routing algorithm AS1 Inter-AS Routing algorithm Forwarding table 2c AS2 2b
  • 24. Example: Setting forwarding table in router 1d  Suppose AS1 learns (via inter-AS protocol) that network 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
  • 25. Example: Choosing among multiple ASs  Now suppose AS1 learns from inter-AS protocol that a network 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. x 3c 3a 3b AS3 1a 2a 1c 1d 1b 2c AS2 AS1 2b
  • 26. Example: Choosing among multiple ASs Learn from inter-AS protocol that network 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 the interface I that leads to least-cost gateway. Enter (x,I) in forwarding table Steps in adding an outside AS destination in a routers forwarding Table