EEC-484/584 Computer Networks

27
EEC-484/584 EEC-484/584 Computer Computer Networks Networks Lecture 10 Lecture 10 Wenbing Zhao Wenbing Zhao [email protected] (Part of the slides are based on Drs. Kurose & (Part of the slides are based on Drs. Kurose & Ross Ross s slides for their s slides for their Computer Networking Computer Networking book) book)

description

EEC-484/584 Computer Networks. Lecture 10 Wenbing Zhao [email protected] (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer Networking book). Outline. Link state routing Distance vector routing Hierarchical routing Internet protocol Header Fragmentation. - PowerPoint PPT Presentation

Transcript of EEC-484/584 Computer Networks

Page 1: EEC-484/584 Computer Networks

EEC-484/584EEC-484/584Computer Computer NetworksNetworksLecture 10Lecture 10

Wenbing ZhaoWenbing Zhao

[email protected] (Part of the slides are based on Drs. Kurose & Ross(Part of the slides are based on Drs. Kurose & Ross’’s slides s slides for their for their Computer Networking Computer Networking book)book)

Page 2: EEC-484/584 Computer Networks

04/21/2304/21/23 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

OutlineOutline Link state routing Distance vector routing Hierarchical routing Internet protocol

Header Fragmentation

Page 3: EEC-484/584 Computer Networks

04/21/2304/21/23 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

DijkstraDijkstra’’s Algorithms Algorithm Each node labeled with distance from source node

along best known path Initially, no paths known so all nodes labeled with

infinity As algorithm proceeds, labels may change reflecting

shortest path Label may be tentative or permanent, initially, all

tentative When label represents shortest path from source to

node, label becomes permanent

Page 4: EEC-484/584 Computer Networks

04/21/2304/21/23 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

Compute Shortest Path from A to DCompute Shortest Path from A to D

Start with node A as the initial working node Examine each of the nodes adjacent to A, i.e., B and G,

relabeling them with the distance to A Examine all the tentatively labeled nodes in the whole graph

and make the one with the smallest label permanent, i.e., B. B is the new working node

Page 5: EEC-484/584 Computer Networks

04/21/2304/21/23 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

Compute Shortest Path from A to DCompute Shortest Path from A to D

Page 6: EEC-484/584 Computer Networks

04/21/2304/21/23 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

Step Permanently labeled

B G E C F H D

1 A 2,A 6,A ∞ ∞ ∞ ∞ ∞

2 AB 6,A 4,B 9,B ∞ ∞ ∞

3 ABE 5,E 9,B 6,E ∞ ∞

4 ABEG 9,B 6,E 9,G ∞

5 ABEGF 9,B 8,F ∞

6 ABEGFH 9,B 10,H

7 ABEGFHC 10,H

8 ABEGFHCD

Page 7: EEC-484/584 Computer Networks

04/21/2304/21/23 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

Computation ResultsComputation Results

BCDEFGH

(A,B)(A,B)(A,B)(A,B)(A,B)(A,B)(A,B)

Destination link

A

BC

DE F

G H

Routing Table in ARouting Table in A

Page 8: EEC-484/584 Computer Networks

04/21/2304/21/23 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

DijkstraDijkstra’’s Algorithms Algorithm: : ExerciseExercise

Given the subnet shown below, using the Dijkstra’s Algorithm, determine the shortest path tree from node u and its routing table

u

yx

wv

z2

2

13

1

1

2

53

5

Page 9: EEC-484/584 Computer Networks

04/21/2304/21/23 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

Distance Vector RoutingDistance Vector Routing Also called Bellman-Ford or Ford-Fulkerson Each router maintains a table, giving best known

distance to each destination and which line to use to get there Table is updated by exchanging info with neighbors Table contains one entry for each router in network with

Preferred outgoing line to that destination Estimate of time or distance to that destination

Once every T msec, router sends to each neighbor a list of estimated delays to each destination and receives same from those neighbors

Page 10: EEC-484/584 Computer Networks

04/21/2304/21/23 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

Distance Vector Routing:Distance Vector Routing:How each entry is updatedHow each entry is updated

d(A,X)

d(A,Y)A

X Z

d(Y,Z)

d(X,Z)

At router A, for ZCompute d(A,X) + d(X,Z) and d(A,Y) + d(Y,Z), take minimum

Y

d(A,Z) = min {d(A,v) + d(v,Z) }

where min is taken over all neighbors v of A

Page 11: EEC-484/584 Computer Networks

04/21/2304/21/23 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

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

d(x,y) = min{d(x,y) + d(y,y), d(x,z) + d(z,y)} = min{2+0 , 7+1} = 2

d(x,z) = min{d(x,y) + d(y,z), d(x,z) + d(z,z)} = min{2+1 , 7+0} = 3

32

Each node keeps track of the following info:1. Its own distance vector: least-cost to each of other

routers2. Each of its neighbor’s distance vector received most

recentlyIf there is a change in distance vector, a node sends the

update to all its neighbors

Page 12: EEC-484/584 Computer Networks

04/21/2304/21/23 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

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

d(x,y) = min{d(x,y) + d(y,y), d(x,z) + d(z,y)} = min{2+0 , 7+1} = 2

d(x,z) = min{d(x,y) + d(y,z), d(x,z) + d(z,z)} = min{2+1 , 7+0} = 3

Page 13: EEC-484/584 Computer Networks

04/21/2304/21/23 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

Distance Vector RoutingDistance Vector Routing

Distance from A to B 12ms, to C 25ms, to D 40ms, to G 18ms

Distance from J to A 8ms, to I 10ms, to H 12ms, to K 6ms

Distance from J to A to G 8+18 = 26msto I to G 10+31 = 41msto H to G 12+6=18msto K to G 6+31=37ms

Page 14: EEC-484/584 Computer Networks

04/21/2304/21/23 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

Distance Vector RoutingDistance Vector Routing Good news travels fast Bad news travels slow Count to infinity problem: Takes too long to converge upon

router failure

×

Routers’ knowledge about the cost to A

Page 15: EEC-484/584 Computer Networks

04/21/2304/21/23 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

Hierarchical RoutingHierarchical Routing Problem: Bigger network => bigger routing table

As network size increases, more router memory used to store routing table, more time to process routing tables, more bandwidth to transmit states reports

Use hierarchical structure to solve the problem Regions: router knows details of how to route packets within its

region, does not know internals of other regions Clusters of regions, zones of clusters, groups of zones

Tradeoff: savings in memory space may result in longer path

Page 16: EEC-484/584 Computer Networks

04/21/2304/21/23 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

Hierarchical RoutingHierarchical Routing

Optimal number of levels for N routers is lnN, with elnN routing table entries per router

Page 17: EEC-484/584 Computer Networks

04/21/2304/21/23 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

Collection of SubnetworksCollection of SubnetworksThe Internet is an interconnected collection of many networks,

or Autonomous Systems (ASes)

Page 18: EEC-484/584 Computer Networks

04/21/2304/21/23 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

The Network Layer in Internet The Network Layer in Internet

forwardingtable

Host, router network layer functions:

Routing protocols•path selection•RIP, OSPF, BGP

IP protocol•addressing conventions•datagram format•packet handling conventions

ICMP protocol•error reporting•router “signaling”

Transport layer: TCP, UDP

Link layer

physical layer

Networklayer

Page 19: EEC-484/584 Computer Networks

04/21/2304/21/23 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

IP Datagram FormatIP Datagram Format

ver Totallength

32 bits

data (variable length,typically 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

IHL type ofservice

“type” of data flgsfragment

offsetprotocol

32 bit destination IP address

Options (if any) E.g. timestamp,record routetaken, specifylist of routers to visit.

How much overhead with TCP?

• 20 bytes of TCP

• 20 bytes of IP

• = 40 bytes + app layer overhead

Page 20: EEC-484/584 Computer Networks

04/21/2304/21/23 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

The IPv4 HeaderThe IPv4 Header Version – 4 IHL – length of header in 32-bit words

Min 5, max 15 – i.e., 60 bytes Type of service - to distinguish different classes of service

To accommodate differentiated services (which class this packet belongs to)

Total length – header and data 65,535 (216-1) bytes Identification – allows destination to determine which datagram a

fragment belongs to

Page 21: EEC-484/584 Computer Networks

04/21/2304/21/23 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

The IPv4 HeaderThe IPv4 Header Time to live – counter to limit packet lifetimes

Max lifetime 255sec Packet is destroyed when counter becomes 0

Protocol – which transport layer protocols being used

Header checksum – verifies header

Page 22: EEC-484/584 Computer Networks

04/21/2304/21/23 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

The IPv4 HeaderThe IPv4 Header

Options – security, error reporting, etc. Some of the IP options

Page 23: EEC-484/584 Computer Networks

04/21/2304/21/23 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

IP FragmentationIP Fragmentation Fragmentation Flags

DF – tells routers “Don’t Fragment” MF – More Fragments. All fragments except last have this

set. Used as check against total length Fragment offset – where in datagram this fragment

belongs All fragments (payload in the IP packet) except last must be

multiples of 8 bytes The number of 8 byte blocks is called Number of

Fragment Blocks (NFB) The unit of the offset is NFB

Page 24: EEC-484/584 Computer Networks

04/21/2304/21/23 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

IP Fragmentation & ReassemblyIP Fragmentation & Reassembly Network links have MTU

(max.transfer size) - largest possible link-level frame. different link types,

different MTUs Large IP datagram divided

(“fragmented”) within net one datagram becomes

several datagrams “reassembled” only at

final destination IP header bits used to

identify, order related fragments

fragmentation: in: one large datagramout: 3 smaller datagrams

reassembly

Page 25: EEC-484/584 Computer Networks

04/21/2304/21/23 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

IP Fragmentation and IP Fragmentation and ReassemblyReassembly

ID=x

offset=0

MF=0

length=4000

ID=x

offset=0

MF=1

length=1500

ID=x

offset=185

MF=1

length=1500

ID=x

offset=370

MF=0

length=1040

One large datagram becomesseveral smaller datagrams

Example• 4000 byte

datagram• MTU = 1500

bytes1480 bytes in data field

offset =1480/8

Fragment should be as large as possible

Page 26: EEC-484/584 Computer Networks

04/21/2304/21/23 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

Distance Vector Routing: Distance Vector Routing: ExerciseExercise Consider the subnet shown below. Distance vector routing is

used, and the following vectors have just come in to router C: from B: (5, 0, 8, 12, 6, 2); from D: (16, 12, 6, 0, 9, 10); and from E: (7, 6, 3, 9, 0, 4). The measured delays to B, D, and E, are 6, 3, and 5, respectively. What is C's new routing table? Give both the outgoing line to use and the expected delay.

Page 27: EEC-484/584 Computer Networks

04/21/2304/21/23 EEC-484/584: Computer NetworksEEC-484/584: Computer Networks Wenbing ZhaoWenbing Zhao

Exercise: IP FragmentationExercise: IP Fragmentation Suppose that host A is connected to a router R 1, R 1 is

connected to another router, R 2, and R 2 is connected to host B. Suppose that a TCP message that contains 900 bytes of data and 20 bytes of TCP header is passed to the IP code at host A for delivery to B. Show the Total length, Identification, DF, MF, and Fragment offset fields of the IP header in each packet transmitted over the three links. Assume that link A-R1 can support a maximum frame size of 1024 bytes including a 14-byte frame header, link R1-R2 can support a maximum frame size of 512 bytes, including an 8-byte frame header, and link R2-B can support a maximum frame size of 512 bytes including a 12-byte frame header.