Week13 lec2
-
Upload
syedhaiderraza -
Category
Education
-
view
59 -
download
0
description
Transcript of Week13 lec2
Chapter 4 Network Layer
Computer Networking: A Top Down Approach 4th edition. Jim Kurose, Keith RossAddison-Wesley, July 2007.
Routing Algorithm ClassificationGlobal Routing
Algorithm
Computes least cost path 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)
Decentralized Routing Algorithm
No node has complete 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 neighborsIterative: 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 Definedx(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
Bellman-Ford example
u
yx
wv
z2
2
13
1
1
2
53
5Clearly, 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 that achieves minimum is next hop in shortest path ➜ forwarding table
B-F equation says:
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)
x y z
xyz
0 2 7
∞ ∞ ∞∞ ∞ ∞
from
cost to
from
from
x y z
xyz
0
from
cost to
x y z
xyz
∞ ∞
∞ ∞ ∞
cost to
x y z
xyz
∞ ∞ ∞7 1 0
cost to
∞2 0 1
∞ ∞ ∞
2 0 17 1 0
time
x z12
7
y
node x table
node y table
node z table
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
x y z
xyz
0 2 7
∞ ∞ ∞∞ ∞ ∞
from
cost to
from
from
x y z
xyz
0 2 3
from
cost tox y z
xyz
0 2 3
from
cost to
x y z
xyz
∞ ∞
∞ ∞ ∞
cost tox y z
xyz
0 2 7
from
cost to
x y z
xyz
0 2 3
from
cost to
x y z
xyz
0 2 3
from
cost tox y z
xyz
0 2 7
from
cost to
x 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 0
2 0 1
3 1 0
time
x z12
7
y
node x table
node y table
node z table
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
Example
5
v
z
2
x
y
1
7 10
Using DV algorithm show the table entries at node z?
Solution
Cost to z y x v
z 0 3 2 5 y 3 0 1 7 x 2 1 0 7
v 5 7 7 0
From
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.
DC
BA
u v
w
x
yz
destination hops u 1 v 2 w 2 x 3 y 3 z 2
From router A to subnets:
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 deadRIP modifies local routing table Propagates this information by
sending this advertisements to its neighboring routers.
Called as Expiration timer.
Network span limited by maximum hop count of 15Note that actual number of networks can be > 15!
Slow convergenceDV Algorithm
Limitations of RIP
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.
physical
link
network forwarding (IP) table
Transprt (UDP)
routed
physical
link
network (IP)
Transprt (UDP)
routed
forwardingtable
IPv4 Datagram Format
ver length
data (variable length,
a TCP or UDP segment)
16-bit identifier
header checksum
time tolive
32 bit source IP address
IP protocol versionnumber
header length (bytes)
max numberremaining hops
(decremented at each router)
forfragmentation/reassembly
total datagramlength (bytes)
upper layer protocolto deliver payload to
head.len
type ofservice
“type” of data flgsfragment
offset
protocol
32 bit destination IP address
Options (if any) e.g. timestamp,record routetaken etcFind 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 datagramso Referred as
Fragmentso “Reassembled” only at
final destinationo IP header bits used to
identify, order related fragments
fragmentation: in: one large datagramout: 3 smaller datagrams
reassembly
IP Fragmentation & Reassembly Identification Number, Flag and Offset fields in the datagram
header
Identification Numbero Sending Host stamps the datagram with an identification numbero Destination receives datagram
o Examines the identification number
Flag Bito All fragments set to 1o Last fragment set to 0
Offset Fieldo 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 payloado MTU is 1500 bytes
Fragment Bytes ID Offset Flag
1st Fragment 1480 bytes 777 0 (beginning) 1 (there is more)
2nd Fragment 1480 bytes 777 185 1 (there is more)
3rd Fragment 1020 bytes 777 370 0 (Last )
Hierarchical Routing
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
All routers run the same routing Algorithm?
… not true in practice
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 intra-AS 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.
1d
1c
AS11a 1b
3b
1d
3a
1c
2aAS3
AS1
AS21a
2c
2b
1b
3c
Interconnected ASs
1b, 1c, 2a and 3a are Gateway Routers
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 are
reachable through AS2, which through AS3
2. Propagate this reachability information to all routers in AS1. Configure
Forwarding tableJob of inter-AS routing protocol!
3b
1d
3a1c
2aAS3
AS1AS2
1a
2c2b
1b
Intra-ASRouting algorithm
Inter-ASRouting algorithm
Forwardingtable
3c
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)
3b
1d
3a
1c2aAS3
AS1
AS21a
2c2b
1b
3c
x…
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.
3b
1d
3a
1c2aAS3
AS1
AS21a
2c2b
1b
3cx… …
Learn from inter-AS protocol that network
x is reachable via multiple gateways
Use routing infofrom 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
Example: Choosing among multiple ASs
Steps in adding an outside AS destination in a routers forwarding Table