Week11 lec2

22
Chapter 4 Network Layer Computer Networking: A Top Down Approach 4 th edition. Jim Kurose, Keith Ross Addison-Wesley, July 2007.

description

Computer Networks

Transcript of Week11 lec2

Page 1: Week11 lec2

Chapter 4 Network Layer

Computer Networking: A Top Down Approach 4th edition. Jim Kurose, Keith RossAddison-Wesley, July 2007.

Page 2: Week11 lec2

Classless Addressing

•To overcome address depletion •No classes, but the address are still granted in blocks.

•The size of the block( the number of addresses) varies based on the nature and size of the entity.• Household: 2 addresses•Large organization: thousands of addresses• ISP: thousands or hundreds of thousands based on the number of customers it may serve.

•The number of addresses in a block must be power of two (2,4,8…..).•Classless Inter Domain Routing (CIDR)

Page 3: Week11 lec2

Mask:Slash Notation

• Each mask is made of some ones from the left and followed by some 0s.

• Instead of 255.255.255.224 – Mask has 27 1s– Attach this number to a classless

address

–x.y.z.t/n• n defines the number of bits that are same

in every block.

Page 4: Week11 lec2

Subnetting

Home Assignment

An organization is granted a block of addresses with the beginning address 14.24.74.0/24. There are 232−24= 256 addresses in this block. The organization needs to have 11 subnets as shown below:

a. two subnets, each with 64 addresses.

b. two subnets, each with 32 addresses.

c. three subnets, each with 16 addresses.

d. four subnets, each with 4 addresses.

Design the subnets.

Page 5: Week11 lec2

Internet and Routing

Basic function of the InternetTo allow any two hosts to talk to each other using IP

packetsRouting enables data packets to find the way

through the InternetDepending on the locations of the two hosts,

the delivery can be Direct, or Indirect

Page 6: Week11 lec2

Direct delivery

Page 7: Week11 lec2

Indirect delivery

Page 8: Week11 lec2

How do hosts make routing decisions?

When a host X receives a packet to be delivered to YHost X checks whether Y is within

the same subnetIf yes, directly deliver the packet to

host YIf no, deliver the packet to the

appropriate router How can host X tell whether Y is in

the same network?

Page 9: Week11 lec2

Exercise

Host X with IP address 130.130.10.10 and network mask 255.255.255.128 receives the following two packets:Packet A destined for 130.130.10.56Packet B destined for 130.130.10.156

Determine whether they will be delivered directly or indirectly?.

Page 10: Week11 lec2

Solution

Host IP address is 130.130.10.10Subnet mask is 255.255.255.128Network address is 130.130.10.0Address range 130.130.10.0 to

130.130.10.127Packet A will be delivered directlyPacket B will be delivered indirectly

Page 11: Week11 lec2

CIDR and Routing Information

206.0.64.0/18204.188.0.0/15209.88.232.0/21

National ISP

ISP X owns:

Company X :

206.0.68.0/22

ISP y :

209.88.237.0/24

Organization z1 :

209.88.237.192/26Organization z2 :

209.88.237.0/26

Page 12: Week11 lec2

CIDR and Routing Information

206.0.64.0/18204.188.0.0/15209.88.232.0/21

National ISP

ISP X owns:

Company X :

206.0.68.0/22

ISP y :

209.88.237.0/24

Organization z1 :

209.88.237.192/26Organization z2 :

209.88.237.0/26

National ISP sends everything which matches the prefixes 206.0.64.0/18, 204.188.0.0/15, 209.88.232.0/21 to ISP X.

ISP X sends everything which matches the prefix: 206.0.68.0/22 to Company X,209.88.237.0/24 to ISP y

Routers in National ISP do not know anything about Company X, ISP Y, or Organizations z1, z2.

ISP X does not know about Organizations z1, z2.

ISP y sends everything which matches the prefix: 209.88.237.192/26 to Organization z1 209.88.237.0/26 to Organization z2

Page 13: Week11 lec2

Routing Protocols• Define how routers exchange network

information– What type of information– The format of information exchange– When to exchange– Which router to exchange information with

• Examples– Routing Information Protocol (RIP)– Enhanced Interior Gateway Routing Protocol

(EIGRP)– CISCO Proprietary

– Open Shortest Path First (OSPF)– Border Gateway Protocol (BGP)

Page 14: Week11 lec2

Routing AlgorithmsGiven a set of routers a routing algorithm finds a “Good” path from source router to destination router

Least cost path

A graph is used to formulate routing problems

A Graph G=(N,E) is a Set of N nodes and a collection E of edgesNodes in the graph represent RoutersEdges represent physical links

1

23

0111

packet’s header

routing algorithm

local forwarding tableheader value output link

0100010101111001

3221

Page 15: Week11 lec2

u

yx

wv

z2

2

13

1

1

2

53

5

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

Page 16: Week11 lec2

Graph Abstraction: costs

u

yx

wv

z2

2

13

1

1

2

53

5 • c(x,x’) = cost of link (x,x’)

- e.g., c(w,z) = 5

• Cost can be• Physical length of the link• Delay etc.

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

Page 17: Week11 lec2

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

Used by 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

Used by Routing Information Protocol (RIP)

Page 18: Week11 lec2

Link-State Routing Algorithm Network topology and

link costs are known to all nodes Each node broadcast

link state packets to all other nodes in the network

Each link state packet contains the identities and cost of its attached links

Dijkstra’s Algorithm Computes least cost

paths from one node (‘source”) to all other nodes

Iterative: After k iterations, least cost paths to k destinations are known

Notation: D(v): Current value of least

cost path from source to destination (v).

p(v): Predecessor node along path from source to v

N': Subset of nodes whose least cost path is definitively known

Page 19: Week11 lec2

Dijkstra’s Algorithm: Example

Step012345

N'u

uxuxy

uxyvuxyvw

uxyvwz

D(v),p(v)2,u2,u2,u

D(w),p(w)5,u4,x3,y3,y

D(x),p(x)1,u

D(y),p(y)∞

2,x

D(z),p(z)∞ ∞

4,y4,y4,y

u

yx

wv

z2

2

13

1

1

2

53

5

x

v

y

wz

(u,x)

(u,v)

(u,x)

(u,x)(u,x)

destination link

Resulting forwarding table in u:

Page 20: Week11 lec2

Dijkstra’s Algorithm

1 Initialization: 2 N' = {u} 3 for all nodes v 4 if v is a neighbor of u 5 then D(v) = c(u,v) 6 else D(v) = ∞ 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 each neighbor v of 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'

u

yx

wv

z2

2

13

1

1

2

53

5

Page 21: Week11 lec2

Dijkstra’s Algorithm-Example

Find the shortest path from S to all nodes using Dijkstra’s Algorithm?

Page 22: Week11 lec2

Solution

Step N’D(x), p(x) D(t),p(t) D(u),p(u) D(v),p(v) D(w),p(w) D(y),p(y) D(z),p(z)

0 s ∞ 1,s 4,s ∞ ∞ ∞ ∞

1 st ∞ 3,t 5,t ∞ 8,t 6,t

2 stu ∞ 5,t 6,u 8,t 6,t

3 stuv 8,v 6,u 6,v 6,t

4 stuvy 8,v 6,u 6,t

5 stuvyz 8,v 6,u

6 stuvyzw 8,v

7 stuvyzwx