CPS-356- Computer Networks Class 9: IP-Continued Theophilus Benson Based partly on lecture notes by...

Post on 11-Jan-2016

214 views 0 download

Transcript of CPS-356- Computer Networks Class 9: IP-Continued Theophilus Benson Based partly on lecture notes by...

CPS-356- Computer NetworksClass 9: IP-Continued

Theophilus Benson

Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis, John Jannotti

Administrivia

• Slides Updates– Class slides 08 updated– Class slides 06 updated– Class slides 07 uploaded–

• HW #1 put up on site

• Can we move exams?

Distance Vector Recap

A

B

C

4 1

10

• Neighbor information is preconfigured– The link cost to a neigh and the link to that neighbor

• Nodes exchange message with neighbors– (cost, dest)

• Pick the shortest paths

A 4 A

C 1 C

A 10 A

B 1 B

B 4 B

C 10

C

Distance Vector Recap

A

B

C

4 1

10

• Neighbor information is preconfigured– The link cost to a neigh and the link to that neighbor

• Nodes exchange message with neighbors– (cost, dest)

• Pick the shortest paths

A 4 A

C 1 C

A 10 A

B 1 B

B 4 B

C 10

C

(B,4)(C,10)

(A,10)(B,1)

(A,4)(C,1)

Distance Vector Recap

A

B

C

4 1

10

• Pick the shortest paths

A 4 A

C 1 C

A 10 A

B 1 B

B 4 B

C 10

C

From A(B,4), (C,10)

From C(A,10), (B,1)

From B(A,4), (C,1)From C

(A,10), (B,1)From A

(B,4), (C,10)From B(A,4), (C,1)

Distance Vector Recap

A

B

C

4 1

10

• Pick the shortest paths

A 4 A

C 1 C

A 10 A

B 1 B

B 4 B

C 10

C

From A(B,4), (C,10)

From C(A,10), (B,1)

From B(A,4), (C,1)From C

(A,10), (B,1)From A

(B,4), (C,10)From B(A,4), (C,1)

Distance Vector Recap

A

B

C

4 1

10

• Pick the shortest paths

A 4 A

C 1 C

A 5 B

B 1 B

B 4 B

C 5 B

From A(B,4), (C,10)

From C(A,10), (B,1)

From B(A,4), (C,1)From C

(A,10), (B,1)From A

(B,4), (C,10)From B(A,4), (C,1)

Distance Vector Recap

A

B

C

4 1

10

• Pick the shortest paths• Update message are triggered by– Change in Routing Table– Or periodically every N seconds, by a timer

A 4 A

C 1 C

A 5 B

B 1 B

B 4 B

C 5 B

(B,4)(C,5)

(A,5)(B,1)

Good news travels fast

A

B

C

4 1

10

1

• A decrease in link cost has to be fresh information• Network converges at most in O(diameter) steps

A 4 A

C 1 C

A 5 B

B 1 B

B 4 B

C 5 B

Good news travels fast

A

B

C

4 1

10

1

• A decrease in link cost has to be fresh information• Network converges at most in O(diameter) steps

A 1 A

C 1 C

A 5 B

B 1 B

B 1 B

C 5 B

(B,1)(C,10)

(A,1)(C,1)

Good news travels fast

A

B

C

4 11

• A decrease in link cost has to be fresh information• Network converges at most in O(diameter) steps

A 1 A

C 1 C

A 5 B

B 1 B

B 1 B

C 5 B(B,1)

(C,10)

(A,1)(C,1)

10

Good news travels fast

A

B

C

4 11

• A decrease in link cost has to be fresh information• Network converges at most in O(diameter) steps

A 1 A

C 1 C

A 2 B

B 1 B

B 1 B

C 5 B(B,1)

(C,10)

(A,1)(C,1)

10

Good news travels fast

A

B

C

4 11

• A decrease in link cost has to be fresh information• Network converges at most in O(diameter) steps

A 1 A

C 1 C

A 2 B

B 1 B

B 1 B

C 2 B 10

(A,2)(B,1)

(B,1)(C,2)

Bad news travels slowly

A

B

C

4 1

10• An increase in cost may cause confusion with old information, may form loops• Consider routes to A• Initially, B:A,4,A; C:A,5,B• Then B:A,12,A, selects C as next hop -> B:A,6,C• C -> A,7,B; B -> A,8,C; C -> A,9,B; B -> A,10,C;• C finally chooses C:A,10,A, and B -> A,11,C!

A 1 A

C 1 C

A 5 B

B 1 B

B 1 B

C 5 B

Bad news travels slowly

A

B

C

4 1

10

12

• An increase in cost may cause confusion with old information, may form loops

• Consider routes to A• Initially, B:A,4,A; C:A,5,B• Then B:A,12,A, selects C as next hop -> B:A,6,C• C -> A,7,B; B -> A,8,C; C -> A,9,B; B -> A,10,C;• C finally chooses C:A,10,A, and B -> A,11,C!

A6C

A 4 A

C 1 C

A 5 B

B 1 B

B 1 B

C 5 B

Bad news travels slowly

A

B

C

4 1

10

12

• An increase in cost may cause confusion with old information, may form loops

• Consider routes to A• Initially, B:A,4,A; C:A,5,B• Then B:A,12,A, selects C as next hop -> B:A,6,C• C -> A,7,B; B -> A,8,C; C -> A,9,B; B -> A,10,C;• C finally chooses C:A,10,A, and B -> A,11,C!

A 12 A

C 1 C

A 5 B

B 1 B

B 12

B

C 13

B

Bad news travels slowly

A

B

C

4 1

10

12

• An increase in cost may cause confusion with old information, may form loops

• Consider routes to A• Initially, B:A,4,A; C:A,5,B• Then B:A,12,A, selects C as next hop -> B:A,6,C• C -> A,7,B; B -> A,8,C; C -> A,9,B; B -> A,10,C;• C finally chooses C:A,10,A, and B -> A,11,C!

A 12 A

C 1 C

A 5 B

B 1 B

B 12

B

C 13

B

(A,5)(B,1)

Bad news travels slowly

A

B

C

4 1

10

12

• An increase in cost may cause confusion with old information, may form loops

• Consider routes to A• Initially, B:A,4,A; C:A,5,B• Then B:A,12,A, selects C as next hop -> B:A,6,C• C -> A,7,B; B -> A,8,C; C -> A,9,B; B -> A,10,C;• C finally chooses C:A,10,A, and B -> A,11,C!

A 6 C

C 1 C

A 5 B

B 1 B

B 11

C

C 10

C

(A,5)(B,1)

Bad news travels slowly

A

B

C

4 1

10

12

• An increase in cost may cause confusion with old information, may form loops

• Consider routes to A• Initially, B:A,4,A; C:A,5,B• Then B:A,12,A, selects C as next hop -> B:A,6,C• C -> A,7,B; B -> A,8,C; C -> A,9,B; B -> A,10,C;• C finally chooses C:A,10,A, and B -> A,11,C!

A 6 C

C 1 C

A 5 B

B 1 B

B 11

C

C 10

C

(A,6)(C,1)

Bad news travels slowly

A

B

C

4 1

10

12

• An increase in cost may cause confusion with old information, may form loops

• Consider routes to A• Initially, B:A,4,A; C:A,5,B• Then B:A,12,A, selects C as next hop -> B:A,6,C• C -> A,7,B; B -> A,8,C; C -> A,9,B; B -> A,10,C;• C finally chooses C:A,10,A, and B -> A,11,C!

A 6 C

C 1 C

A 7 B

B 1 B

B 11

C

C 10

C

(A,6)(C,1)

Bad news travels slowly

A

B

C

4 1

10

12

• An increase in cost may cause confusion with old information, may form loops

• Consider routes to A• Initially, B:A,4,A; C:A,5,B• Then B:A,12,A, selects C as next hop -> B:A,6,C• C -> A,7,B; B -> A,8,C; C -> A,9,B; B -> A,10,C;• C finally chooses C:A,10,A, and B -> A,11,C!

A 6 C

C 1 C

A 7 B

B 1 B

B 11

C

C 10

C

(A,7)(B,1)

Bad news travels slowly

A

B

C

4 1

10

12

• An increase in cost may cause confusion with old information, may form loops

• Consider routes to A• Initially, B:A,4,A; C:A,5,B• Then B:A,12,A, selects C as next hop -> B:A,6,C• C -> A,7,B; B -> A,8,C; C -> A,9,B; B -> A,10,C;• C finally chooses C:A,10,A, and B -> A,11,C!

A 8 C

C 1 C

A 7 B

B 1 B

B 11

C

C 10

C

(A,8)(C,1)

Bad news travels slowly

A

B

C

4 1

10

12

• An increase in cost may cause confusion with old information, may form loops

• Consider routes to A• Initially, B:A,4,A; C:A,5,B• Then B:A,12,A, selects C as next hop -> B:A,6,C• C -> A,7,B; B -> A,8,C; C -> A,9,B; B -> A,10,C;• C finally chooses C:A,10,A, and B -> A,11,C!

A 8 C

C 1 C

A 9 B

B 1 B

B 11

C

C 10

C

(A,9)(B,1)

Bad news travels slowly

A

B

C

4 1

10

12

• An increase in cost may cause confusion with old information, may form loops

• Consider routes to A• Initially, B:A,4,A; C:A,5,B• Then B:A,12,A, selects C as next hop -> B:A,6,C• C -> A,7,B; B -> A,8,C; C -> A,9,B; B -> A,10,C;• C finally chooses C:A,10,A, and B -> A,11,C!

A 10 C

C 1 C

A 9 B

B 1 B

B 11

C

C 10

C

(A,10)(C,1)

Bad news travels slowly

A

B

C

4 1

10

12

• An increase in cost may cause confusion with old information, may form loops

• Consider routes to A• Initially, B:A,4,A; C:A,5,B• Then B:A,12,A, selects C as next hop -> B:A,6,C• C -> A,7,B; B -> A,8,C; C -> A,9,B; B -> A,10,C;• C finally chooses C:A,10,A, and B -> A,11,C!

A 10 C

C 1 C

A 10 A

B 1 B

B 11

C

C 10

C

(A,10)(C,1)

(A,10)(B,1)

How to avoid loops

• IP TTL field prevents a packet from living forever– Does not repair a loop

• Simple approach: consider a small cost n (e.g., 16) to be infinity– After n rounds decide node is unavailable– But rounds can be long, this takes time

• Problem: distance vector based only on local information

Bad news travels slowly

• Why did it take a while to converge?– Nodes are unknowingly using each other

A

B

C

4 1

10

12

A 6 C

C 1 C

A 5 B

B 1 B

B 11

C

C 10

C

(A,6)(C,1)

(A,5)(B,1)

Better loop avoidance

• Split Horizon– When sending updates to node A, don’t include

routes you learned from A– Prevents B and C from sending cost 2 to A

• Split Horizon with Poison Reverse– Rather than not advertising routes learned from A,

explicitly include cost of ∞.– Faster to break out of loops, but increases

advertisement sizes

Split Horizon

• Why did it take a while to converge?– Nodes are unknowingly using each other

A

B

C

4 1

10

A 4 A

C 1 C

A 10 A

B 1 B

B 4 B

C 10

C

(B,4)(C,10)

(A,10)(B,1)

(A,4)(C,1)

Split Horizon

• Why did it take a while to converge?– Nodes are unknowingly using each other

A

B

C

4 1

10

A 4 A

C 1 C

A 5 B

B 1 B

B 4 B

C 5 B

(B,4)(C,10)

(A,10)(B,1)

(A,5)(B,1)

(B,4)(C,5)

Split Horizon

• Why did it take a while to converge?– Nodes are unknowingly using each other

A

B

C

4 1

10

A 12 A

C 1 C

A 5 B

B 1 B

B 12

B

C 13

B

(B,4)(C,10)

(A,10)(B,1)

(A,5)(B,1)

(B,4)(C,5)

12

Split Horizon

• Why did it take a while to converge?– Nodes are unknowingly using each other

A

B

C

4 1

10

A 12 A

C 1 C

A 5 B

B 1 B

B 11

C

C 10

C

(B,4)(C,10)

(A,10)(B,1)

(A,5)(B,1)

(B,4)(C,5)

12

Split Horizon

• Why did it take a while to converge?– Nodes are unknowingly using each other

A

B

C

4 1

10

A 12 A

C 1 C

A 5 B

B 1 B

B 11

C

C 10

C

(A,10)(B,1)

12

(A,12)(C,1)

Split Horizon

• Why did it take a while to converge?– Nodes are unknowingly using each other

A

B

C

4 1

10

A 12 A

C 1 C

A 10 B

B 1 B

B 11

C

C 10

C

(A,10)(B,1)

12

(A,12)(C,1)

Split Horizon

• Why did it take a while to converge?– Nodes are unknowingly using each other

A

B

C

4 1

10

A 12 A

C 1 C

A 10 B

B 1 B

B 11

C

C 10

C

(A,10)(B,1)

12

(A,12)(C,1)

Split Horizon

• Why did it take a while to converge?– Nodes are unknowingly using each other

A

B

C

4 1

10

A 11 A

C 1 C

A 10 B

B 1 B

B 11

C

C 10

C

12

(A,12)(C,1)

(A,10)(B,1)

Warning

• Split horizon/split horizon with poison reverse only help between two nodes– Can still get loop with three nodes involved– Might need to delay advertising routes after

changes, but affects convergence time

Other approaches

• DSDV: destination sequenced distance vector– Uses a ‘version’ number per destination message– Avoids loops by preventing nodes from using old

information from descendants– But, you can only update when new version comes

from root• Path Vector: (BGP) – Replace ‘distance’ with ‘path’– Avoids loops with extra cost

Link State Routing

• Strategy: – send to all nodes information about directly

connected neighbors• Link State Packet (LSP)– ID of the node that created the LSP– Cost of link to each directly connected neighbor– Sequence number (SEQNO)– TTL

Time 0: Generate LSP from Config File and Send out Updates

A

B

C4

110

D

5

6

• Directly Connected Neighbors are pre-configured into the device

B 4C 1

Time 0: Generate LSP from Config File and Send out Updates

A

B

C4

110

D

5

6

• Directly Connected Neighbors are pre-configured into the device

B 4C 1

Reliable Flooding• Store most recent LSP from each node– Ignore earlier versions of the same LSP

• Forward LSP to all nodes but the one that sent it• Generate new LSP periodically– Increment SEQNO

• Start at SEQNO=0 when reboot– If you hear your own packet with SEQNO=n, set your

next SEQNO to n+1• Decrement TTL of each stored LSP– Discard when TTL=0

Time 1: Receive LSPs

• When a node gets an LSA, it floods it on all ports except the port it received it from.

A

B

C4

110

D

5

6

B 4

C 1

B 4

C 1

Time 1: Receive LSPs

• When a node gets an LSA, it floods it on all ports except the port it received it from.

A

B

C4

110

D

5

6

B 4

C 1

B 4

C 1

Time 10: Regenerate LSP and send out

A

B

C4

110

D

5

6

• Generate new LSP periodically– Increment SEQNO

Calculating best path• Djikstra’s single-source shortest path algorithm

– Each node computes shortest paths from itself• Let:

– N denote set of nodes in the graph– l(i,j) denote the non-negative link between i,j

• ∞ if there is no direct link between i and j

– C(n) denote the cost of path from s to n– s denotes yourself (node computing paths)

• Initialize variables– M = {s} (set of nodes incorporated thus far)– For each n in N-{s}, C(n) = l(s,n)– Next(n) = n if l(s,n) < ∞, – otherwise

Djikstra’s Algorithm• While N≠M– Let w (N-M) be the node with lowest C(w)∈– M = M ∪ {w}– Foreach n (N-M), if C(w) + l(w,n) < C(n)∈

then C(n) = C(w) + l(w,n), Next(n) = Next(w)

• Example: D: (D,0,-) (C,2,C) (B,5,C) (A,10,C)

Draw Backs of Link State Protocols

Draw Backs of Link State Protocols

• Scalability– A lot of Network packets (Flooding of LSPs)– A lot computation overhead, for each router:• Router Memory: to store entire network• Router CPU: to calculate Dijkstra

To Scale Add Areas (Hierarchy)

A

BC

D

• Divide into backbone and other areas

F

E

X

YZArea 1 Area 2

Backbone(Area 0)

To Scale Add Areas (Hierarchy)

A

BC

D

• Divide into backbone and other areas• An area must know how to route within itself

– LSPs are contained to an area: never flood outside of your area– This provides scaling properties

• To route between two areas, you must go through the backbone

F

E

X

YZArea 1 Area 2

Backbone(Area 0)

To Scale Add Areas (Hierarchy)

A

BC

• Divide into backbone and other areas• An area must know how to route within itself

– LSPs are contained to an area: never flood outside of your area– This provides scaling properties in all areas except Area 0

• To route between two areas, you must go through the backbone• Backbone know how to route between areas but not how to route within

other areas.– Backbone views each area as one node– Allows scaling in the backbones

Area 1 Area 2

Backbone(Area 0)

Distance Vector vs. Link StateDistance Vector Link State

# of Messages O(d), where d is degree of node

O(nd) for n nodes in system

Computation convergence time varies (e.g., count-to-infinity)

O(n2) with O(nd) messages

Robustness: what happens with malfunctioning router?

Nodes can advertise incorrect path cost

Others can use the cost, propagates through network

Nodes can advertise incorrect link cost

May get correct link information from another node

Metrics• Original ARPANET metric

– measures number of packets enqueued in each link– neither latency nor bandwidth in consideration

• New ARPANET metric– Stamp arrival time (AT) and departure time (DT)– When link-level ACK arrives, compute

Delay = (DT – AT) + Transmit + Latency

– If timeout, reset DT to departure time for retransmission– Link cost = average delay over some time period

• Fine Tuning– Compressed dynamic range– Replaced Delay with link utilization

• Today: commonly set manually to achieve specific goals

Examples of Distance Vector & Link State

• Distance Vector: RIPv2– Fairly simple implementation of DV– RFC 2453 (38 pages)

• Link State: OSPF (Open Shortest Path First)– More complex link-state protocol– Adds notion of areas for scalability– RFC 2328 (244 pages)

RIPv2: Default on Several Cisco Routers

• Runs on UDP port 520• Link cost = 1• Periodic updates every 30s, plus triggered

updates• Relies on count-to-infinity to resolve loops– Maximum diameter 15 (∞ = 16)– Supports split horizon, poison reverse

• Deletion– If you receive an entry with metric = 16 from parent

OR– If a route times out

OSPFv2: Costs more to activate on Several Cisco Routers

• Link state protocol• Runs directly over IP (protocol 89)– Has to provide its own reliability

• All exchanges are authenticated• Adds notion of areas for scalability

Other Routing Protocols

Routing Protocol Name Type of Protocol

IS-IS (intermediate system –to- intermediate system) Link State Protocol

IGRP (Interior Gateway Routing Protocol) Distance Vector Protocol

BGP (border Gateway Protocol) Distance-Vector (with Paths)“Path-Vector”

Now You Have Your Routes, what next?

Bring it All Together: Ethernet + IPStep 0: Operator preconfigures routers with IP addresses

Router BRouter C

G H G H

128.35.8.*/24128.35.6.*/24

128.35.9.*/24128.35.7.*/24

128.35.8.*/24128.35.7.*/24

128.35.6.*/24128.35.9.*/24

Bring it All Together: Ethernet + IPStep 1: Router builds Routing Table using Routing Protocol

Router BRouter C

G H G H

128.35.8.*/24128.35.6.*/24

128.35.9.*/24128.35.7.*/24

128.35.6.*/24128.35.9.*/24128.35.8.*/24128.35.7.*/24

128.35.6.*/24128.35.9.*/24128.35.8.*/24128.35.7.*/24

Bring it All Together: Ethernet + IPStep 2: Get Your IP Address (DHCP)

Router BRouter C

G H G H

128.35.8.*/24128.35.6.*/24

128.35.9.*/24128.35.7.*/24

128.35.6.*/24128.35.9.*/24128.35.8.*/24128.35.7.*/24

128.35.6.*/24128.35.9.*/24128.35.8.*/24128.35.7.*/24

Bring it All Together: Ethernet + IPStep 2: Bonus Switch Learns (Learning Switch)

Router BMAC_Z

Router CMAC_Y

G H G H

128.35.8.*/24128.35.6.*/24

128.35.9.*/24

128.35.7.*/24

128.35.6.*/24128.35.9.*/24128.35.8.*/24128.35.7.*/24

128.35.6.*/24128.35.9.*/24128.35.8.*/24128.35.7.*/24

MAC_AMAC_BMAC_Y

MAC_EMAC_Z

MAC_EMAC_Z

MAC_AMAC_BMAC_Y

Bring it All Together: Ethernet + IPStep 2: Bonus Switch Learns (Learning Switch)

Router BMAC_Z

Router CMAC_Y

G H G H

128.35.8.*/24128.35.6.*/24

128.35.9.*/24

128.35.7.*/24

128.35.6.*/24128.35.9.*/24128.35.8.*/24128.35.7.*/24

128.35.6.*/24128.35.9.*/24128.35.8.*/24128.35.7.*/24

MAC_A: 128.35.7.2 MAC_B: 128.35.7.5 MAC_E: 128.35.9.9

MAC_AMAC_BMAC_Y

MAC_EMAC_Z

MAC_EMAC_Z

MAC_AMAC_BMAC_Y

Bring it All Together: Ethernet + IPStep 3: Get Dest-IP Address (DNS)

Source: MAC_A:128.35.7.2 Dest:UNKnown MAC: 128.35.5

Router BMAC_Z

Router CMAC_Y

G H G H

128.35.8.*/24128.35.6.*/24

128.35.9.*/24

128.35.7.*/24

128.35.6.*/24128.35.9.*/24128.35.8.*/24128.35.7.*/24

128.35.6.*/24128.35.9.*/24128.35.8.*/24128.35.7.*/24

MAC_A: 128.35.7.2 MAC_B: 128.35.7.5 MAC_E: 128.35.9.9

MAC_AMAC_BMAC_Y

MAC_EMAC_Z

MAC_EMAC_Z

MAC_AMAC_BMAC_Y

Bring it All Together: Ethernet + IPStep 4: Get Dest MAC Address (ARP)

Source: MAC_A:128.35.7.2 Dest:UnKnown MAC: 128.35.5

Router BMAC_Z

Router CMAC_Y

G H G H

128.35.8.*/24128.35.6.*/24

128.35.9.*/24

128.35.7.*/24

128.35.6.*/24128.35.9.*/24128.35.8.*/24128.35.7.*/24

128.35.6.*/24128.35.9.*/24128.35.8.*/24128.35.7.*/24

MAC_A: 128.35.7.2 MAC_B: 128.35.7.5 MAC_E: 128.35.9.9

MAC_AMAC_BMAC_Y

MAC_EMAC_Z

MAC_EMAC_Z

MAC_AMAC_BMAC_Y

Bring it All Together: Ethernet + IPStep 4: Get Dest MAC Address (ARP)

Source: MAC_A:128.35.7.2 Dest:UnKnown MAC: 128.35.5

Router BMAC_Z

Router CMAC_Y

G H G H

128.35.8.*/24128.35.6.*/24

128.35.9.*/24

128.35.7.*/24

128.35.6.*/24128.35.9.*/24128.35.8.*/24128.35.7.*/24

128.35.6.*/24128.35.9.*/24128.35.8.*/24128.35.7.*/24

MAC_A: 128.35.7.2 MAC_B: 128.35.7.5 MAC_E: 128.35.9.9

MAC_AMAC_BMAC_Y

MAC_EMAC_Z

MAC_EMAC_Z

MAC_AMAC_BMAC_Y

Compare your IP address with destination IP addressSource IP: 128.35.7.2

You netmask is 128.35.7.*/24 so you network has: 128.35.7.0-128.35.7.255

Dest IP: 128.35.7.5Destination is in your network range, so you have to send to the destination!!!

So you ARP for the MAC address of the destination.

Bring it All Together: Ethernet + IPStep 4: Get Dest MAC Address (ARP)

Source: MAC_A:128.35.7.2 Dest: MAC_B: 128.35.5

Router BMAC_Z

Router CMAC_Y

G H G H

128.35.8.*/24128.35.6.*/24

128.35.9.*/24

128.35.7.*/24

128.35.6.*/24128.35.9.*/24128.35.8.*/24128.35.7.*/24

128.35.6.*/24128.35.9.*/24128.35.8.*/24128.35.7.*/24

MAC_A: 128.35.7.2 MAC_B: 128.35.7.5 MAC_E: 128.35.9.9

MAC_AMAC_BMAC_Y

MAC_EMAC_Z

MAC_EMAC_Z

MAC_AMAC_BMAC_Y

Bring it All Together: Ethernet + IPStep 5: Send packets

Source: MAC_A:128.35.7.2 Dest: MAC_B: 128.35.5

Router BMAC_Z

Router CMAC_Y

G H G H

128.35.8.*/24128.35.6.*/24

128.35.9.*/24

128.35.7.*/24

128.35.6.*/24128.35.9.*/24128.35.8.*/24128.35.7.*/24

128.35.6.*/24128.35.9.*/24128.35.8.*/24128.35.7.*/24

MAC_A: 128.35.7.2 MAC_B: 128.35.7.5 MAC_E: 128.35.9.9

MAC_AMAC_BMAC_Y

MAC_EMAC_Z

MAC_EMAC_Z

MAC_AMAC_BMAC_Y

MAC: A->BIP: A->B

Bring it All Together: Ethernet + IPStep 5: Send packets

Source: MAC_A:128.35.7.2 Dest: MAC_B: 128.35.5

Router BMAC_Z

Router CMAC_Y

G H G H

128.35.8.*/24128.35.6.*/24

128.35.9.*/24

128.35.7.*/24

128.35.6.*/24128.35.9.*/24128.35.8.*/24128.35.7.*/24

128.35.6.*/24128.35.9.*/24128.35.8.*/24128.35.7.*/24

MAC_A: 128.35.7.2 MAC_B: 128.35.7.5 MAC_E: 128.35.9.9

MAC_AMAC_BMAC_Y

MAC_EMAC_Z

MAC_EMAC_Z

MAC_AMAC_BMAC_Y

MAC: A->BIP: A->B

Bring it All Together: Ethernet + IPStep 3: Get Dest-IP Address (DNS)

Alice to EveSource: MAC_A:128.35.7.2 Dest:UNKnown MAC: 128.35.9.9

Router BMAC_Z

Router CMAC_Y

G H G H

128.35.8.*/24128.35.6.*/24

128.35.9.*/24

128.35.7.*/24

128.35.6.*/24128.35.9.*/24128.35.8.*/24128.35.7.*/24

128.35.6.*/24128.35.9.*/24128.35.8.*/24128.35.7.*/24

MAC_A: 128.35.7.2 MAC_B: 128.35.7.5 MAC_E: 128.35.9.9

MAC_AMAC_BMAC_Y

MAC_EMAC_Z

MAC_EMAC_Z

MAC_AMAC_BMAC_Y

Bring it All Together: Ethernet + IPStep 4: Get Dest MAC Address (ARP)

Alice to EveSource: MAC_A:128.35.7.2 Dest:UnKnown MAC: 128.35.9.9

Router BMAC_Z

Router CMAC_Y

G H G H

128.35.8.*/24128.35.6.*/24

128.35.9.*/24

128.35.7.*/24

128.35.6.*/24128.35.9.*/24128.35.8.*/24128.35.7.*/24

128.35.6.*/24128.35.9.*/24128.35.8.*/24128.35.7.*/24

MAC_A: 128.35.7.2 MAC_B: 128.35.7.5 MAC_E: 128.35.9.9

MAC_AMAC_BMAC_Y

MAC_EMAC_Z

MAC_EMAC_Z

MAC_AMAC_BMAC_Y

Bring it All Together: Ethernet + IPStep 4: Get Dest MAC Address (ARP)

Alice to EveSource: MAC_A:128.35.7.2 Dest:UnKnown MAC: 128.35.9.9

Router BMAC_Z

Router CMAC_Y

G H G H

128.35.8.*/24128.35.6.*/24

128.35.9.*/24

128.35.7.*/24

128.35.6.*/24128.35.9.*/24128.35.8.*/24128.35.7.*/24

128.35.6.*/24128.35.9.*/24128.35.8.*/24128.35.7.*/24

MAC_A: 128.35.7.2 MAC_B: 128.35.7.5 MAC_E: 128.35.9.9

MAC_AMAC_BMAC_Y

MAC_EMAC_Z

MAC_EMAC_Z

MAC_AMAC_BMAC_Y

Compare your IP address with destination IP addressSource IP: 128.35.7.2

You netmask is 128.35.7.*/24 so you network has: 128.35.7.0-128.35.7.255

Dest IP: 128.35.9.9Destination is not in your network range, so you have to send to router!!!

So you ARP for the MAC address of the router.

Bring it All Together: Ethernet + IPStep 4: Get Dest MAC Address (ARP)

Source: MAC_A:128.35.7.2 Dest: MAC_Y: 128.35.9.9

Router BMAC_Z

Router CMAC_Y

G H G H

128.35.8.*/24128.35.6.*/24

128.35.9.*/24

128.35.7.*/24

128.35.6.*/24128.35.9.*/24128.35.8.*/24128.35.7.*/24

128.35.6.*/24128.35.9.*/24128.35.8.*/24128.35.7.*/24

MAC_A: 128.35.7.2 MAC_B: 128.35.7.5 MAC_E: 128.35.9.9

MAC_AMAC_BMAC_Y

MAC_EMAC_Z

MAC_EMAC_Z

MAC_AMAC_BMAC_Y

Bring it All Together: Ethernet + IPStep 5: Send packets

Source: MAC_A:128.35.7.2 Dest: MAC_B: 128.357.5

Router ZMAC_Z

Router YMAC_Y

G H G H

128.35.8.*/24128.35.6.*/24

128.35.9.*/24

128.35.7.*/24

128.35.6.*/24128.35.9.*/24128.35.8.*/24128.35.7.*/24

128.35.6.*/24128.35.9.*/24128.35.8.*/24128.35.7.*/24

MAC_A: 128.35.7.2 MAC_B: 128.35.7.5 MAC_E: 128.35.9.9

MAC_AMAC_BMAC_Y

MAC_EMAC_Z

MAC_EMAC_Z

MAC_AMAC_BMAC_YMAC: A->Y

IP: A->E

Bring it All Together: Ethernet + IPStep 5: Send packets

Source: MAC_A:128.35.7.2 Dest: MAC_B: 128.357.5

Router BMAC_Z

Router CMAC_Y

G H G H

128.35.8.*/24128.35.6.*/24

128.35.9.*/24

128.35.7.*/24

128.35.6.*/24128.35.9.*/24128.35.8.*/24128.35.7.*/24

128.35.6.*/24128.35.9.*/24128.35.8.*/24128.35.7.*/24

MAC_A: 128.35.7.2 MAC_B: 128.35.7.5 MAC_E: 128.35.9.9

MAC_AMAC_BMAC_Y

MAC_EMAC_Z

MAC_EMAC_Z

MAC_AMAC_BMAC_Y

MAC: A->ZIP: A->E

Bring it All Together: Ethernet + IPStep 5: Send packets

Source: MAC_A:128.35.7.2 Dest: MAC_B: 128.357.5

Router BMAC_Z

Router CMAC_Y

G H G H

128.35.8.*/24128.35.6.*/24

128.35.9.*/24

128.35.7.*/24

128.35.6.*/24128.35.9.*/24128.35.8.*/24128.35.7.*/24

128.35.6.*/24128.35.9.*/24128.35.8.*/24128.35.7.*/24

MAC_A: 128.35.7.2 MAC_B: 128.35.7.5 MAC_E: 128.35.9.9

MAC_AMAC_BMAC_Y

MAC_EMAC_Z

MAC_EMAC_Z

MAC_AMAC_BMAC_Y

MAC: A->EIP: A->E

Bring it All Together: Ethernet + IPStep 5: Send packets

Source: MAC_A:128.35.7.2 Dest: MAC_B: 128.357.5

Router BMAC_Z

Router CMAC_Y

G H G H

128.35.8.*/24128.35.6.*/24

128.35.9.*/24

128.35.7.*/24

128.35.6.*/24128.35.9.*/24128.35.8.*/24128.35.7.*/24

128.35.6.*/24128.35.9.*/24128.35.8.*/24128.35.7.*/24

MAC_A: 128.35.7.2 MAC_B: 128.35.7.5 MAC_E: 128.35.9.9

MAC_AMAC_BMAC_Y

MAC_EMAC_Z

MAC_EMAC_Z

MAC_AMAC_BMAC_Y

MAC: A->ZIP: A->E

What Limitations Does Ethernet Have?

• Minimum Packet Size– 64Bytes (512 bits): To ensure that collisions are

detected!– Bandwidth-Delay-Product*2

• Maximum Ethernet LAN size– 2500 meters: Due to signal decay, any longer and

packets would not be delivered

A Router Does Two Things

Forwarding (per-node operation): – how to pass a packet from an input interface to

the output interface of a router– Destination based forwarding

• Check destination IP and look it up in your forwarding table

Routing (distributed algorithm): – how to find and setup a route? Implemented by

dynamic routing protocols– OSPF, RIP

Forwarding

• Due to CIDR, Routers use longest prefix match

From 128.35.6.0 To: 123.35.6.255From 128.35.0.0 To: 123.35.255.255From 128.35.6.3 To: 123.35.6.3From 128.35.7.0 To: 128.35.7.255

Router Forwarding TableAfter OSPF or RIP

128.35.6.*/24, fwd port 1128.35.*.*/16, fwd port 3128.35.6.3/32, fwd port 6

128.35.7.*/24, fwd port 18

Forwarding

• Due to CIDR, Routers use longest prefix match

128.35.6.*/24, fwd port 1128.35.*.*/16, fwd port 3128.35.6.3/32, fwd port 6

128.35.7.*/24, fwd port 18

From 128.35.6.0 To: 123.35.6.255From 128.35.0.0 To: 123.35.255.255From 128.35.6.3 To: 123.35.6.3From 128.35.7.0 To: 128.35.7.255

Router Forwarding TableAfter OSPF or RIP

Forwarding

• Due to CIDR, Routers use longest prefix match

From 128.35.6.0 To: 123.35.6.255From 128.35.0.0 To: 123.35.255.255From 128.35.6.3 To: 123.35.6.3From 128.35.7.0 To: 128.35.7.255

Router Forwarding TableAfter OSPF or RIP

Packet with destination: 128.35.6.3. Which entry does it match? What port does it get forwarded on?

128.35.6.*/24, fwd port 1128.35.*.*/16, fwd port 3128.35.6.3/32, fwd port 6

128.35.7.*/24, fwd port 18

Forwarding

• Due to CIDR, Routers use longest prefix match

From 128.35.6.0 To: 123.35.6.255From 128.35.0.0 To: 123.35.255.255From 128.35.6.3 To: 123.35.6.3From 128.35.7.0 To: 128.35.7.255

Router Forwarding TableAfter OSPF or RIP

Packet with destination: 128.35.6.8Which entry does it match? What port does it get forwarded on?

128.35.6.*/24, fwd port 1128.35.*.*/16, fwd port 3128.35.6.3/32, fwd port 6

128.35.7.*/24, fwd port 18

Router Versus Switches

Router• Runs multiple switching

protocols: Ethernet, ATM– Switches between techs

• Runs routing protocols

• Runs DHCP

• Needs a common address across techs: IP address– E.g. Ethernet addresses make no

sense to ATM hosts

Switches• Runs one switching protocol

– Can only work with same tech

• Dictates how bits become signals

• Dictates how bits becomes a packet/frame

• Needs hardware addresses to identify hosts/switches

Summary

• This Class– Link State protocols– Link State V. Distance Vector– Routing V Forwarding– How routing works within one ISP/AS

• Next Class– Inter-Domain routing– Routing over the Wide Area Network