computer networks chapter 3: internetworking

150
Computer Networks Chapter 3: Internetworking

Upload: bianca

Post on 23-Feb-2016

63 views

Category:

Documents


0 download

DESCRIPTION

Computer Networks Chapter 3: Internetworking. Problems. In Chapter 2 we talked about how to connect one node to another, or to an existing network. How do we interconnect different types of networks to build a large global network? . Chapter Outline. 3.1 Switching and Bridging - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Computer Networks Chapter 3: Internetworking

Computer Networks

Chapter 3: Internetworking

Page 2: Computer Networks Chapter 3: Internetworking

CN_3.2

Problems In Chapter 2 we talked about

how to connect one node to another, or to an existing network.

How do we interconnect different types of networks to build a large global network?

Page 3: Computer Networks Chapter 3: Internetworking

CN_3.3

Chapter Outline 3.1 Switching and Bridging 3.2 Basic Internetworking

(IP) 3.3 Routing

Page 4: Computer Networks Chapter 3: Internetworking

CN_3.4

Chapter Goal Understanding the functions of

switches, bridges and routers Discussing Internet Protocol (IP)

for interconnecting networks Understanding the concept of

routing

Page 5: Computer Networks Chapter 3: Internetworking

CN_3.5

3.1 Switching and Forwarding

Store-and-Forward Switches Bridges and Extended LANs Cell Switching Segmentation and Reassembly

Page 6: Computer Networks Chapter 3: Internetworking

CN_3.6

Switching and Forwarding

SwitchA mechanism that allows us

to interconnect links to form a large network

A multi-input, multi-output device which transfers packets from an input to one or more outputs

Page 7: Computer Networks Chapter 3: Internetworking

CN_3.7

Switching and Forwarding Adds the star topology to the point-

to-point link,bus (Ethernet), and ring (802.5 and

FDDI)topologies

Switch

Page 8: Computer Networks Chapter 3: Internetworking

CN_3.8

Switching and Forwarding Properties of this star topology

Even though a switch has a fixed number of inputs and outputs, large networks can be built by interconnecting a number of switches

We can connect switches to each other and to hosts using point-to-point links

Adding a new host to the switch does not mean that the hosts already connected will get worse performance from the network

Page 9: Computer Networks Chapter 3: Internetworking

CN_3.9

Switching and Forwarding The last claim cannot be made for the

shared media network (discussed in Chapter 2) Two hosts on the same Ethernet can

not transmit continuously at 10Mbps because they share the same transmission medium

Every host on a switched network has its own link to the switch Many hosts are allowed to transmit at

the full link speed (bandwidth) provided that the switch is designed with enough aggregate capacity

Page 10: Computer Networks Chapter 3: Internetworking

CN_3.10

Switching and Forwarding

A switch is connected to a set of links and for each of these links, runs the appropriate data link protocol (MAC) to communicate with that node

A switch’s primary job is to receive incoming packets on one of its links and to transmit them on some other link This function is referred as

switching and forwarding

Page 11: Computer Networks Chapter 3: Internetworking

CN_3.11

Switching and Forwarding How does the switch decide which

output port to place each packet on? It looks at the header of the packet

for an identifier that it uses to make the decision

Two common approachesDatagram or Connectionless approach

Virtual circuit or Connection-oriented approach

A third approach source routing is less common

Page 12: Computer Networks Chapter 3: Internetworking

CN_3.12

Switching and Forwarding

AssumptionsEach host has a globally unique

addressThere is some way to identify

the input and output ports of each switchWe can use numbers or names

Page 13: Computer Networks Chapter 3: Internetworking

CN_3.13

Switching and Forwarding

DatagramsKey Idea

Every packet contains enough information to enable any switch to decide how to get it to destination–Every packet contains the complete destination address

Page 14: Computer Networks Chapter 3: Internetworking

CN_3.14

An example network

To decide how to forward a packet, a switch consults a forwarding table (sometimes called a routing table)

Switching and Forwarding

Page 15: Computer Networks Chapter 3: Internetworking

CN_3.15

Switching and Forwarding

Destination Port--------------------------------

---------------A 3B 0C 3D 3E 2F 1G 0H 0

Forwarding Table for Switch 2

Page 16: Computer Networks Chapter 3: Internetworking

CN_3.16

Switching and Forwarding Characteristics of Connectionless

(Datagram) Network A host can send a packet anywhere at any time,

since any packet that turns up at the switch can be immediately forwarded (assuming a correctly populated forwarding table)

When a host sends a packet, it has no way of knowing if the network is capable of delivering it or if the destination host is even up and running

Each packet is forwarded independently of previous packets that might have been sent to the same destination. Thus two successive packets from host A to host B

may follow completely different paths A switch or link failure might not have any

serious effect on communication if it is possible to find an alternate route around the failure and update the forwarding table accordingly

Page 17: Computer Networks Chapter 3: Internetworking

CN_3.17

Switching and Forwarding

Virtual Circuit Switching Widely used technique for packet

switching Uses the concept of virtual circuit

(VC) Also called a connection-oriented

model First set up a virtual connection

from the source host to the destination host and then send the data

Page 18: Computer Networks Chapter 3: Internetworking

CN_3.18

Switching and Forwarding Host A wants to send packets to host

B

Page 19: Computer Networks Chapter 3: Internetworking

CN_3.19

Switching and Forwarding Two-stage process

Connection setup Data Transfer

Connection setup Establish “connection state” in each of

the switches between the source and destination hosts

The connection state for a single connection consists of an entry in the “VC table” in each switch through which the connection passes

Page 20: Computer Networks Chapter 3: Internetworking

CN_3.20

Switching and Forwarding One entry in the VC table on a single

switch contains A virtual circuit identifier (VCI) that uniquely

identifies the connection at this switch and that will be carried inside the header of the packets that belong to this connection

An incoming interface on which packets for this VC arrive at the switch

An outgoing interface in which packets for this VC leave the switch

A potentially different VCI that will be used for outgoing packetsIncoming

InterfaceIncoming VC Outgoing

InterfaceOutgoing VC

2 5 1 11

Page 21: Computer Networks Chapter 3: Internetworking

CN_3.21

Switching and Forwarding

The semantics for one such entry is If a packet arrives on the

designated incoming interface and that packet contains the designated VCI value in its header,

then the packet should be sent out the specified outgoing interface with the specified outgoing VCI value

Page 22: Computer Networks Chapter 3: Internetworking

CN_3.22

Switching and ForwardingNote:

The combination of the VCI and the interface uniquely identifies the virtual connection

There may be many virtual connections established in the switch at one time

Incoming and outgoing VCI values are not generally the same VCI is not a globally significant identifier for the

connection; rather it has significance only on a given link

Whenever a new connection is created, we need to assign a new VCI for that connection on each link that the connection will traverse

Page 23: Computer Networks Chapter 3: Internetworking

CN_3.23

Switching and Forwarding Two approaches to establishing

connection state Network Administrator configures the

state The virtual circuit is permanent (PVC) The network administrator can delete it Can be thought of as a long-lived or

administratively configured VC A host can send messages into the

network to establish the state This is referred as signalling and the resulting

virtual circuit is said to be switched (SVC) A host may set up and delete such a VC

dynamically without the involvement of a network administrator

Page 24: Computer Networks Chapter 3: Internetworking

CN_3.24

Assume that a network administrator wants to manually create a new virtual connection from host A to host B First the administrator identifies a path

through the network from A to B

Switching and Forwarding

Page 25: Computer Networks Chapter 3: Internetworking

CN_3.25

Switching and Forwarding The administrator then picks a VCI

value that is currently unused on each link for the connection For our example,

Suppose the VCI value 5 is chosen for the link from host A to switch 1

11 is chosen for the link from switch 1 to switch 2

So the switch 1 will have an entry in the VC table

Incoming Interface

Incoming VC Outgoing Interface

Outgoing VC

2 5 1 11Switch 1

Page 26: Computer Networks Chapter 3: Internetworking

CN_3.26

Switching and ForwardingSimilarly, suppose

VCI of 7 is chosen to identify this connection on the link from switch 2 to switch 3

VCI of 4 is chosen for the link from switch 3 to host B

Switches 2 and 3 are configured with the following VC table

Incoming Interface

Incoming VC Outgoing Interface

Outgoing VC

3 11 2 7

Incoming Interface

Incoming VC Outgoing Interface

Outgoing VC

0 7 1 4

Switch 2

Switch 3

Page 27: Computer Networks Chapter 3: Internetworking

CN_3.27

Switching and Forwarding For any packet that A wants to send to B, A

puts the VCI value 5 in the header of the packet and sends it to switch 1

Switch 1 receives any such packet on interface 2, and it uses the combination of the interface and the VCI in the packet header to find the appropriate VC table entry.

The table entry on switch 1 tells the switch to forward the packet out of interface 1 and to put the VCI value 11 in the header

Page 28: Computer Networks Chapter 3: Internetworking

CN_3.28

Switching and Forwarding Packet will arrive at switch 2 on interface 3

bearing VCI 11 Switch 2 looks up interface 3 and VCI 11 in

its VC table and sends the packet on to switch 3 after updating the VCI value 7

This process continues until it arrives at host B with the VCI value of 4 in the packet

To host B, this identifies the packet as having come from host A

Page 29: Computer Networks Chapter 3: Internetworking

CN_3.29

Switching and Forwarding In real networks of reasonable size,

the burden of configuring VC tables correctly in a large number of switches would quickly become excessive Thus, some sort of signalling is almost

always used, even when setting up “permanent” VCs

In case of PVCs, signalling is initiated by the network administrator

SVCs are usually set up using signalling by one of the hosts

Page 30: Computer Networks Chapter 3: Internetworking

CN_3.30

Switching and Forwarding How does the signalling work ?

To start the signalling process, host A sends a setup message into the network (i.e. to switch 1) The setup message contains the

complete destination address of B. The setup message needs to get all

the way to B to create the connection state in every switch along the way

It is like sending a datagram to B where every switch knows which output to send the setup message so that it eventually reaches B

Assume that every switch knows the topology to figure out how to do that

Page 31: Computer Networks Chapter 3: Internetworking

CN_3.31

Switching and Forwarding How does the signalling work ?

When switch 1 receives the connection request, in addition to sending it on to switch 2, it creates a new entry in its VC table for this new connection The entry is exactly the same shown

before Switch 1 picks the value 5 for this

connection When switch 2 receives the setup

message, it performs the similar process and it picks the value 11 as the incoming VCI

Page 32: Computer Networks Chapter 3: Internetworking

CN_3.32

Switching and Forwarding How does the signalling work ?

Similarly switch 3 picks 7 as the value for its incoming VCI

Finally the setup message arrives at host B.

Assuming that B is healthy and willing to accept a connection from host A, it allocates an incoming VCI value, in this case 4. This VCI value can be used by B to

identify all packets coming from A

Page 33: Computer Networks Chapter 3: Internetworking

CN_3.33

Switching and Forwarding Now to complete the connection, everyone

needs to be told what their downstream neighbor is using as the VCI for this connection Host B sends an acknowledgement of the

connection setup to switch 3 and includes in that message the VCI value that it used (4)

Switch 3 completes the VC table entry for this connection and sends the acknowledgement on to switch 2 specifying the VCI of 7

Switch 2 completes the VC table entry for this connection and sends acknowledgement on to switch 1 specifying the VCI of 11

Finally switch 1 passes the acknowledgement on to host A telling it to use the VCI value of 5 for this connection

Page 34: Computer Networks Chapter 3: Internetworking

CN_3.34

Switching and Forwarding Tear Down When host A no longer wants to send

data to host B, it tears down the connection by sending a teardown message to switch 1

The switch 1 removes the relevant entry from its table and forwards the message on to the other switches in the path which similarly delete the appropriate table entries

At this point, if host A sends a packet with a VCI of 5 to switch 1, it would be dropped.

Page 35: Computer Networks Chapter 3: Internetworking

CN_3.35

Switching and Forwarding Characteristics of VC

Since host A has to wait for the connection request to reach the far side of the network and return before it can send its first data packet, there is at least one RTT of delay before data is sent

While the connection request contains the full address for host B (which might be quite large, being a global identifier on the network), each data packet contains only a small identifier, which is only unique on one link. Thus the per-packet overhead caused by the

header is reduced relative to the datagram model

Page 36: Computer Networks Chapter 3: Internetworking

CN_3.36

Switching and Forwarding Characteristics of VC

If a switch or a link in a connection fails, the connection is broken and a new one will need to be established. Also the old one needs to be torn down to free

up table storage space in the switches The issue of how a switch decides which

link to forward the connection request on has similarities with the function of a routing algorithm

Page 37: Computer Networks Chapter 3: Internetworking

CN_3.37

Switching and Forwarding Good Properties of VC

By the time the host gets the go-ahead to send data, it knows quite a lot about the network- For example, that there is really a route to the

receiver and that the receiver is willing to receive data

It is also possible to allocate resources to the virtual circuit at the time it is established Bandwidth > kMbps Delay < limitation bound Buffer size

Page 38: Computer Networks Chapter 3: Internetworking

CN_3.38

Switching and Forwarding For example, an X.25 network – a

packet-switched network that uses the connection-oriented model – employs the following three-part strategy Buffers are allocated to each virtual

circuit when the circuit is initialized The sliding window protocol is run

between each pair of nodes along the virtual circuit, and this protocol is augmented with the flow control to keep the sending node from overrunning the buffers allocated at the receiving node

The circuit is rejected by a given node if not enough buffers are available at that node when the connection request message is processed

Page 39: Computer Networks Chapter 3: Internetworking

CN_3.39

Switching and Forwarding Comparison with the Datagram

Model Datagram network has no connection

establishment phase and each switch processes each packet independently

Each arriving packet competes with all other packets for buffer space

If there are no buffers, the incoming packet must be dropped

Page 40: Computer Networks Chapter 3: Internetworking

CN_3.40

Switching and Forwarding In VC, we could imagine providing

each circuit with a different quality of service (QoS) The network gives the user some kind of

performance related guarantee Switches set aside the resources they need to

meet this guarantee– For example, a percentage of each outgoing link’s

bandwidth– Delay tolerance on each switch

Most popular examples of VC technologies are Frame Relay and ATM One of the applications of Frame Relay is

the construction of VPN

Page 41: Computer Networks Chapter 3: Internetworking

CN_3.41

Switching and Forwarding ATM (Asynchronous Transfer Mode)

Connection-oriented packet-switched network

Packets are called cells5 byte header + 48 byte payload

Fixed length packets are easier to switch in hardwareSimpler to designEnables parallelism

Page 42: Computer Networks Chapter 3: Internetworking

CN_3.42

Switching and Forwarding ATM

User-Network Interface (UNI) Host-to-switch format GFC: Generic Flow Control VCI: Virtual Circuit Identifier Type: management, congestion control CLP: Cell Loss Priority HEC: Header Error Check (CRC-8)

Network-Network Interface (NNI) Switch-to-switch format GFC becomes part of VPI field

Page 43: Computer Networks Chapter 3: Internetworking

CN_3.43

Source Routing All the information about network

topology that is required to switch a packet across the network is provided by the source host

Switching and Forwarding

Page 44: Computer Networks Chapter 3: Internetworking

CN_3.44

Bridges and Spanning Tree Algorithm

(IEEE 802.1D)

Page 45: Computer Networks Chapter 3: Internetworking

CN_3.45

Functions of a Bridge

MAC layer device which relays frames among physically separated LANs and makes the physical LANs appear as one logical LAN to the end stations

Preamble SFD DA SA LEN LLC PAD FCS

7 1 6 6 2 4 Bytes

Page 46: Computer Networks Chapter 3: Internetworking

CN_3.46

Functions of a Bridge Basic Functions:

Frame Forwarding Learning and Filtering Resolving Possible Loops in the

Topology Additional Functions:

Congestion Control (Enough Buffer) Static Filtering (Security) Translation (Multi-Bridge) Routing (Multi-Bridge) Segmentation

Page 47: Computer Networks Chapter 3: Internetworking

CN_3.47

A Simple Bridge Example

Bridge

LAN A

LAN B

1 2 3

5 6 7

4

Stations

Page 48: Computer Networks Chapter 3: Internetworking

CN_3.48

Design Considerations No modifications to the content or

format of the frames Contain enough buffer space to meet

peak demands Contain addressing and routing

intelligence A bridge may connect more than two

networks Why Bridged LANs (BLAN) ?

Reliability Performance Security Geography

Page 49: Computer Networks Chapter 3: Internetworking

CN_3.49

Bridge Routing

The Bridges must be equipped with a routing capability

The routing decision may not always be a simple one (loop)

Topology changes have to be considered

A bridge knows all the station addresses (Filtering Database)

Page 50: Computer Networks Chapter 3: Internetworking

CN_3.50

BLAN Example (Without loop)

ID=10

ID=40

Bridge 1

LAN 1

LAN 2

LAN 3

LAN 4

Bridge 4

1 2

LAN 5 LAN 6

Bridge 2ID=20

C D EF

A B

2 3

1

2

1 Bridge 3ID=30 2

1

Page 51: Computer Networks Chapter 3: Internetworking

CN_3.51

Bridged LAN (BLAN) Example with Loop

4

LAN 1

Bridge 1 Bridge 2

Bridge 4 Bridge 5 Bridge 6 Bridge 7

LAN 2 LAN 3

LAN 4LAN 5

5 6

1

2 3

LAN 6

Bridge 3

Station

Page 52: Computer Networks Chapter 3: Internetworking

CN_3.52

Bridge Protocol Architecture

User Data

LLC-H

MAC-H

t1, t8t2, t7

t3, t4, t5, t6 LLC-H User Data MAC-T

User Data

PHY

Bridge

Station A

LAN 1

MACPHYB CPHY

USER

LLCMAC

t1t2t3 t

4t5 t6

t7t8

Station D

LAN 2

MACMACPHY

USER

LLC

Page 53: Computer Networks Chapter 3: Internetworking

CN_3.53

Spanning Tree Routing Frame Forwarding and Filtering

Use the destination MAC address (DMAC) field in each MAC frame

A bridge maintains a filtering database with entries:

[Address, Port, Time]

Address Learning Use the source MAC address (SMAC) field in each

MAC frame If the element is already in the database, the

entry is updated and the timer is reset If the element is not in the database, a new entry

is created with its own timerPreamble SFD DMAC SMAC LEN LLC PAD FCS

7 1 6 6 2 4 Bytes

Page 54: Computer Networks Chapter 3: Internetworking

CN_3.54

Filtering Database Examples

LAN 2

LAN 3

Bridge 2

LAN 4

LAN 1

Bridge1 1

2

C D

E

A B

F

A 1 19 B 1 17 C 2 24 D 3 3 E 1 6 F 1 13

Filtering Database ( Bridge 2 ) 1

2 3

MAC AddrPort Time (S)A 2 20 B 2 18 C 2 25 D 2 4 E 1 5 F 1 12

Filtering Database ( Bridge 1 )

MAC Addr Port Time(S)

Page 55: Computer Networks Chapter 3: Internetworking

CN_3.55

Forwarding and

Address Learning Algorithm

Frame fromPort x

Add SMAC, port (x)and Timer (0) into FDB

Forward to belonging

Port

Filter Forward to

all ports ( except port

x )

Change to port

X, reset timer

End

Y

N

Y

Y

N

N

AddressLearning

FrameForwarding

DMAC in FDB?

Belong to Port x ?

SMAC in FDB ?

Page 56: Computer Networks Chapter 3: Internetworking

CN_3.56

Addresses Learning Example

1. A -> E2. B -> D3. C -> B4. D -> A5. E -> C

2

A

1

FDB FDB

Bridge X Bridge Y Bridge Z

LAN 1

LAN 2

LAN 3

LAN 4

LAN 5

MAC Port MAC Port MAC Port

B

C

D

E

12 3 1

2

Page 57: Computer Networks Chapter 3: Internetworking

CN_3.57

Addresses Learning Example (AE)

2

A

1

FDB FDB

Bridge X Bridge Y Bridge Z

LAN 1

LAN 2

LAN 3

LAN 4

LAN 5

MAC Port MAC Port MAC Port

B

C

D

E

12 3 1

2

A 2

E A

E A

E A

E A

E A

A 1 A 1

Page 58: Computer Networks Chapter 3: Internetworking

CN_3.58

Addresses Learning Example (BD)

2

A

1

FDB FDB

Bridge X Bridge Y Bridge Z

LAN 1

LAN 2

LAN 3

LAN 4

LAN 5

MAC Port MAC Port MAC Port

B

C

D

E

12 3 1

2

A 2A 1 A 1

BD

BD BD

BD BD

B 2 B 1B 2

Page 59: Computer Networks Chapter 3: Internetworking

CN_3.59

Addresses Learning Example (CB)

2

A

1

FDB FDB

Bridge X Bridge Y Bridge Z

LAN 1

LAN 2

LAN 3

LAN 4

LAN 5

MAC Port MAC Port MAC Port

B

C

D

E

12 3 1

2

A 2A 1 A 1B 2 B 1B 2

B C

B C

C 1C 2

Page 60: Computer Networks Chapter 3: Internetworking

CN_3.60

Addresses Learning Example (DA)

2

A

1

FDB FDB

Bridge X Bridge Y Bridge Z

LAN 1

LAN 2

LAN 3

LAN 4

LAN 5

MAC Port MAC Port MAC Port

B

C

D

E

12 3 1

2

A 2A 1 A 1B 2 B 1B 2C 1C 2D 3

D 1D 2

A DA D

A D

Page 61: Computer Networks Chapter 3: Internetworking

CN_3.61

Addresses Learning Example (EC)

2

A

1

FDB FDB

Bridge X Bridge Y Bridge Z

LAN 1

LAN 2

LAN 3

LAN 4

LAN 5

MAC Port MAC Port MAC Port

B

C

D

E

12 3 1

2

A 2A 1 A 1B 2 B 1B 2C 1C 2D 3

D 1D 2

C E

E 3E 2

C EC E

Page 62: Computer Networks Chapter 3: Internetworking

CN_3.62

Bridge X

A

B

LAN 1

Bridge Yt0

t12

21

1

LAN 2

Loop Problems and Resolution

Loops provides reliability Loops make frames duplication Loops make wrong address

learningt2

B AB A

B A B A

Page 63: Computer Networks Chapter 3: Internetworking

CN_3.63

1

Bridge 1

LAN 1

LAN 2

LAN 3

LAN 4 LAN 5

Bridge 2 Bridge 3

Bridge 4

Bridge 5

2

2

1

2

2

1 1

1 2

3

Spanning Tree Example 1

Page 64: Computer Networks Chapter 3: Internetworking

CN_3.64

1

1 2 3

2

43

5

4 5

1

1 2 3

2

43

5

4 5

LAN

Bridge

Spanning Tree

Graph Representation of a BLAN

Page 65: Computer Networks Chapter 3: Internetworking

CN_3.65

ID=10

ID=50

Bridge 1

LAN 1

LAN 2

LAN 3

LAN 4

Bridge 2

Bridge 3Bridge 4

Bridge 5

1 2Root Bridge

1

2 1

2ID=40ID=30

ID=20

1

2

1

2 3

LAN 5

Spanning Tree Example 1 (Continued)

Page 66: Computer Networks Chapter 3: Internetworking

CN_3.66

Spanning Tree Algorithm (requirements)

Bridges Each bridge is assigned a unique identifier

(8 octets): Priority part (two octets): programmable address part (six octets)

A special group MAC address for all bridges :

01-80-C2-00-00-00 (Multicast address)

10000000-00000001-01000011- Each port of a bridge has a unique port

identifier.

Page 67: Computer Networks Chapter 3: Internetworking

CN_3.67

Spanning Tree Algorithm (definitions)

Root Bridge: The bridge with the lowest value of bridge identifier.

Path Cost: For each port, the cost of transmitting a frame onto a LAN.

Root Port: For each bridge, the port on the minimum-cost path to the root bridge.

Root Path Cost: For each bridge, the cost of the path to the root bridge with minimum cost.

Designated Bridge: For each LAN, the bridge that provides the minimum cost path to the root bridge. The only bridge allowed to forward frames to and from the LAN.

Designated Port: The port of the designated bridge that attaches the bridge to the LAN. All internet traffic to and from the LAN pass through the designated port.

Page 68: Computer Networks Chapter 3: Internetworking

CN_3.68

Spanning Tree Example 2

Bridge 1

LAN 1

LAN 2

LAN 3

LAN 4 LAN 5Bridge 5

TC=10 1

ID=10

TC=5 2

ID=50TC: Transmission Cost

TC=10 2

Bridge 2TC=10 1

ID=20

TC=10 2

Bridge 3TC=5 1

ID=30

TC=5 2

Bridge 4TC=5 1

ID=40

TC=5 2

TC=10 1

TC=5 3

Page 69: Computer Networks Chapter 3: Internetworking

CN_3.69

Spanning Tree Example 2 (continued)

D D

R

R D

R

D D

R

RPC: Root Path CostTC: Transmission CostD: Designated PortR: Root Port

LAN 1

LAN 2

LAN 3

LAN 4 LAN 5

Root Bridge

Bridge 5

TC=5 2

ID=50, RPC=10

TC=10 1

TC=5 3 Bridge 2

TC=10 1

ID=20,RPC=10

TC=10 2

Bridge 4TC=5 2

ID=40,RPC=5

TC=5 1

Bridge 3TC=5 1

ID=30,RPC=5

TC=5 2

Bridge 1

TC=10 1

ID=10, RPC=0

TC=10 2

Page 70: Computer Networks Chapter 3: Internetworking

CN_3.70

Spanning Tree Algorithm Three Steps:

1. Determine the root bridge.2. Determine the root port on all

other bridges.3. Determine the designated port on

each LAN.The port with the minimum root path

cost.In the case of two or more bridges

with the same root path cost, the highest-priority bridge is selected.

If the designated bridge has two or more ports attached to this LAN, then the port with the lowest value of identifier is selected.

Page 71: Computer Networks Chapter 3: Internetworking

CN_3.71

Bridge Port State Diagram

Blocking

After a forward delay time

Listening Learning Forwarding

After a forward delay time

Cancel

Selected asa D or R port

Cancel Cancel

Page 72: Computer Networks Chapter 3: Internetworking

CN_3.72

Bridge Protocol Data Unit (BPDU)

Protocol ID

BPDU TypeFlag

111

8

8

4

22

222

2 Version ID

Root Bridge ID

Bridge ID

RPC

Root Port ID

Message Age Time Limit

Hello Time Forward delay

1

1

2

Bytes

Bytes

(b)Topology Change BPDU

(a)Network Configuration BPDU

Protocol ID

BPDU Type

Version ID

Page 73: Computer Networks Chapter 3: Internetworking

CN_3.73

Spanning Tree Algorithm Example

LAN W

RPC = 35 7

D(W): Designated Port of LAN W

Bridge XTC=15 i

TC=10 j

RPC = 38 1

RPC = 40, R = m 12

RPC = 48, R = n, D(W) = m2

RPC = 48 3

RPC = 20 5

RPC = 35, R = i,D(W) = j

6

Bridge ZTC=10 m

TC=10 n

Bridge YTC=5 l

TC=5 k

RPC = 53, R = kRPC = 58, R = j4 4

RPC = 45, R = m 8

RPC = 40, R = k 8

RPC = 30, R = l,D(W) = k

10

RPC = 30

RPC = 35, R = i11

11

RPC = 25 9

Page 74: Computer Networks Chapter 3: Internetworking

CN_3.74

LAN W

R R

R

D

D: Designated PortR: Root Port

Spanning Tree Algorithm Example (Continued)

Bridge XTC=15 i

TC=10 j

Bridge ZTC=15 m

TC=10 n

Bridge YTC=5 l

TC=5 k

Page 75: Computer Networks Chapter 3: Internetworking

CN_3.75

Spanning Tree Features The spanning tree constructed by the IEEE

802.1D algorithm has the features that for each bridge, the shortest path (minimum root path cost, RPC) to the root bridge is included.

For each LAN, the shortest path (minimum root path cost, RPC) to the root bridge via the designated bridge is included.

So the spanning tree usually is not a minimum cost spanning tree.

The spanning tree of a BLAN (or switches connected network) is predictable or deterministic. Thus, given a BLAN topology (with any loops) and configuration parameters, the spanning tree of the BLAN can be calculated manually.

Page 76: Computer Networks Chapter 3: Internetworking

CN_3.76

LAN 1, DPC = 20

LAN 6, DPC = 0

LAN 3,DPC = 0

LAN 5, DPC = 5

Bridge 8

Bridge 1ID=10,RPC=0

TC=5 1

TC=5 2

ID=80,RPC=5

LAN 7, DPC = 5

Bridge 3 Bridge 4

TC=15 2

ID=40,RPC=15ID=30,RPC=15

TC=15 1

LAN 2, DPC = 10

Bridge 5

ID=50,RPC=5

TC=5

1

LAN 4,DPC = 5

D

D

DD

D

R

R R

R R

R

DRD

Root Bridge

Spanning Tree Example 3

TC=10 3

TC=5 2

TC=15 2

TC=15 1

TC=10 2

TC=10 1

Bridge 2ID=20,RPC=20

TC=5 1

TC=10 2

Bridge 7ID=70,RPC=5

TC=5 1

TC=5 2

Bridge 6ID=60,RPC=10

TC=5 1

TC=5 2

Page 77: Computer Networks Chapter 3: Internetworking

CN_3.77

Spanning Tree Maintenance The transmission of the configuration is

triggered by root. The root will periodically (once every Hello

time) issue a configuration BPDU on all LANs to which it is attached.

A bridge that receives a configuration BPDU on what it decides is its root port passes that information to all LANs for which it believes itself to be the designated bridge.

A cascade of configuration BPDUs throughout the spanning tree.

A bridge may change the spanning tree topology

A TCN BPDU is reliable relayed up the new spanning tree to the root bridge (bridge by bridge).

The root will set the Topology Change flag in all configuration messages transmitted for some time.

Page 78: Computer Networks Chapter 3: Internetworking

CN_3.78

LAN 1, DPC = 20

LAN 6, DPC = 0

LAN 3,DPC = 0

LAN 5, DPC = 5

Bridge 8

Bridge 1ID=10,RPC=0

TC=5 1

TC=5 2

ID=80,RPC=5

LAN 7, DPC = 5

Bridge 3 Bridge 4

TC=15 2

ID=40,RPC=15ID=30,RPC=15

TC=15 1

LAN 2, DPC = 10

Bridge 5

ID=50,RPC=5

TC=5

1

LAN 4,DPC = 5

D

D

DD

D

R

R R

R R

R

DRD

Root Bridge

Spanning Tree Maintenance Example 1

TC=10 3

TC=5 2

TC=15 2

TC=15 1

TC=10 2

TC=10 1

Bridge 2ID=20,RPC=20

TC=5 1

TC=10 2

Bridge 7ID=70,RPC=5

TC=5 1

TC=5 2

Bridge 6ID=60,RPC=10

TC=5 1

TC=5 2

D

15

25

Page 79: Computer Networks Chapter 3: Internetworking

CN_3.79

Spanning Tree Maintenance Example 1

Assume Bridge 60 faults. Then all the Hello BPDUs sent from root

bridge to Bridge 60 will not be forwarded to LAN 2 any more.

The Bridges 30 and 40 in LAN 2 will trigger the timeout event individually which means the Designated bridge 60 for LAN 2 was gone.

Then they will try to serve as the Designated bridge of LAN 2 by forwarding a configuration BPDU.

Assume bridge 40 sends the BPDU first with a RPC = 15.

Then bridge 30 will return another BPDU with RPC=15 since it’s priority is higher than bridge 40 (same RPC, smaller ID).

After two forwarding delays, bridge 30 will become the new Designated bridge of LAN2 and the DPC becomes 15.

Page 80: Computer Networks Chapter 3: Internetworking

CN_3.80

Spanning Tree Maintenance Example 1

Also the DPC of LAN 1 is changed from 15 to 25.

Bridge 30 then sends a Topology Change Notification (TCN) BPDU to root bridge.

The root will set the Topology Change flag in all configuration messages transmitted for some time.

Page 81: Computer Networks Chapter 3: Internetworking

CN_3.81

Final configuration of example 1

LAN 1, DPC = 25

LAN 6, DPC = 0

LAN 3,DPC = 0

LAN 5, DPC = 5

Bridge 8

Bridge 1ID=10,RPC=0

TC=5 1

TC=5 2

ID=80,RPC=5

LAN 7, DPC = 5

Bridge 3 Bridge 4

TC=10 2

ID=40,RPC=10ID=30,RPC=10

TC=15 1

LAN 2, DPC = 15

Bridge 5

ID=50,RPC=5

TC=5

1

LAN 4,DPC = 5

D

D

DD

D

R

R R

R R

R

DD

Root Bridge

TC=10 3

TC=5 2

TC=10 2

TC=15 1

TC=10 2

TC=10 1

Bridge 2ID=20,RPC=20

TC=5 1

TC=10 2

Bridge 7ID=70,RPC=5

TC=5 1

TC=5 2

Bridge 6ID=60

Page 82: Computer Networks Chapter 3: Internetworking

CN_3.82

LAN 1, DPC = 20

LAN 6, DPC = 0

LAN 3,DPC = 0

LAN 5, DPC = 5

Bridge 8

Bridge 1ID=10,RPC=0

TC=5 1

TC=5 2

ID=80,RPC=5

LAN 7, DPC = 5

Bridge 3 Bridge 4

TC=15 2

ID=40,RPC=15ID=30,RPC=15

TC=15 1

LAN 2, DPC = 10

Bridge 5

ID=50,RPC=5

TC=5

1

LAN 4,DPC = 5

D

D

DD

D

R

R R

R R

R

DRD

Root Bridge

Spanning Tree Maintenance Example 2

TC=10 3

TC=5 2

TC=15 2

TC=15 1

TC=10 2

TC=10 1

Bridge 2ID=20,RPC=20

TC=5 1

TC=10 2

Bridge 7ID=70,RPC=5

TC=5 1

TC=5 2

Bridge 6ID=60,RPC=10

TC=5 1

TC=5 2

RR

R

00

Root Bridge

2525

Page 83: Computer Networks Chapter 3: Internetworking

CN_3.83

Spanning Tree Maintenance Example 2

Assume LAN 3 faults. Then all the Hello BPDUs sent from root

bridge to LAN 3 will be lost. All the ports connected to LAN 3, including

port 2 of bridge 30, port 2 0f bridge 40, port 1 of bridge 50, and port 1 of bridge 80, will become “blocked” state from “forwarding” state.

All these bridges are now don’t have “R” port (root port) and then try to be a root bridge.

Bridges 30 and 40 still can receive the Hello BPDU from port 1, so they will change their root port to port 1.

Page 84: Computer Networks Chapter 3: Internetworking

CN_3.84

Spanning Tree Maintenance Example 2

Bridges 50 and 80 will exchange BPDU to compete as a new root follow the STP protocol.

Assume bridge 80 sends the BPDU first with a RPC = 0.

Then bridge 50 will return another BPDU with RPC=0 since it’s priority is higher than bridge 80 (smaller ID).

After two forwarding delays, bridge 50 will become the new root bridge and the port 1 of bridge 80 will become a root port.

Finally, we have two separated (disconnected) spanning trees.

Page 85: Computer Networks Chapter 3: Internetworking

CN_3.85

Final configuration of example 2LAN 1, DPC = 20

LAN 6, DPC = 0

LAN 3

LAN 5, DPC = 5

Bridge 8

Bridge 1ID=10,RPC=0

TC=5 1

TC=5 2

ID=80,RPC=5

LAN 7, DPC = 5

Bridge 3 Bridge 4

TC=10 2

ID=40,RPC=25ID=30,RPC=25

TC=15 1

LAN 2, DPC = 10

Bridge 5

ID=50,RPC=0

TC=5

1

LAN 4,DPC = 0

D

DD

D

R R

R R

R

DRD

Root Bridge

TC=10 3

TC=5 2

TC=10 2

TC=15 1

TC=10 2

TC=10 1

Bridge 2ID=20,RPC=20

TC=5 1

TC=10 2

Bridge 7ID=70,RPC=5

TC=5 1

TC=5 2

Bridge 6ID=60,RPC=10

TC=5 1

TC=5 2

Page 86: Computer Networks Chapter 3: Internetworking

CN_3.86

3.2 Internetworking What is internetwork ?

An arbitrary collection of networks interconnected to provide some sort of host-host to packet delivery service

A simple internetwork where H represents hosts and R represents routers

Page 87: Computer Networks Chapter 3: Internetworking

CN_3.87

Internetworking What is IP ?

IP stands for Internet Protocol Key tool used today to build scalable,

heterogeneous internetworks It runs on all the nodes in a collection of networks

and defines the infrastructure that allows these nodes and networks to function as a single logical internetwork

A simple internetwork showing the protocol layers

Page 88: Computer Networks Chapter 3: Internetworking

CN_3.88

IP Service Model Packet Delivery Model

Connectionless model for data delivery Best-effort delivery (unreliable service)

packets are lost packets are delivered out of order duplicate copies of a packet are delivered packets can be delayed for a long time

Global Addressing Scheme Provides a way to identify all hosts in the

network

Page 89: Computer Networks Chapter 3: Internetworking

CN_3.89

Layer 3 router uses store and forward scheme to forward incoming IP packets (datagrams). IP Address Lookup (Forwarding Table

constructed by routing protocols, such as RIP, OSPF, BGP, etc)

IP/MAC mapping table The IP address lookup is longest prefix

matching lookup. Forward IP packet into next hop if the

destination IP is found in the Forwarding Table. Otherwise, forward to default port.

New router Architecture with L3 switching Fabric ASICs and IP address lookup ASICs (hardware lookup)

Wire-speed forwarding design Gbps, 10Gbps, 100Gbps, …

Not Plug-and-Play

How Layer 3 Routers Work ?

IP Next140.114.77.0 Directly140.114.78.0 Directly140.114.79.0 Router Z

IP MACIP(A) MAC(A)IP(B) MAC(B)IP(Y) MAC(Y)IP(X) MAC(X)

Page 90: Computer Networks Chapter 3: Internetworking

CN_3.90

IP Datagram Header Format

version IHL Type of Service Total length

Identification Flags Fragment Offset

Time to Live Protocol Header Checksum

Source IP AddressDestination IP Address

Options + PaddingData

0 3 8 15 19 31

Page 91: Computer Networks Chapter 3: Internetworking

CN_3.91

Type of Service (ToS) of IP

Precedence D T R O O

Precedence111 Network Control110 Internetwork Control101 CRITIC/ECP100 Flash Override011 Flash010 Immediate001 Priority000 Routine

Delay0 Normal1 Low

Throughput, Reliability0 Normal1 High

0 DF MF

DF 0 May Fragment 1 Don't Fragment

MF 0 Last Fragment 1 More Fragment

0 1 2 3 4 5 6 7

Flags0 1 2

Page 92: Computer Networks Chapter 3: Internetworking

CN_3.92

How datagrams are delivered in an Internet ?

R H

WAN

LAN

R

R R

R

RB

H

H

H

A

H

H

H

H

Datagram

LAN

LAN

LAN

Page 93: Computer Networks Chapter 3: Internetworking

CN_3.93

Routers

MACPHY

HOST X

LAN 1 LAN 2

Higher LayerProtocols

MACPHY

HOST Y

A BMACPHY

NetworkROUTER

Network

LAN n

IP MAC

140.114.78.69

140.114.78.68

IP = 140.114.78.0Mask= 255.255.255.0

IP = 140.114.77.0Mask= 255.255.255.0

140.114.78.66140.114.77.65

140.114.77.60

140.114.77.62 IP(A) MAC(A)IP(B) MAC(B)IP(Y) MAC(Y)

IP Next140.114.77.0 Directly140.114.78.0 Directly140.114.79.0 Router Z

A B

ROUTER Z

LAN mIP = 140.114.79.0Mask= 255.255.255.0

IP(X) MAC(X)Higher LayerProtocols

MACPHY

NetworkA B

Y B

MAC(Y) MAC(B) IP(Y) IP(B) IP DatagramMAC(R) MAC(B) IP(A) IP(B) IP DatagramMAC(A) MAC(R) IP(A) IP(B) IP Datagram

Page 94: Computer Networks Chapter 3: Internetworking

CN_3.94

Intra-LAN and Inter-LAN Communications

B -> Y (Intra LAN)

B -> A (Inter-LAN)

MAC(Y) MAC(B) IP(Y) IP(B) IP Datagram

MAC(R) MAC(B) IP(A) IP(B) IP Datagram

MAC(A) MAC(R) IP(A) IP(B) IP Datagram

Page 95: Computer Networks Chapter 3: Internetworking

CN_3.95

An Internet Routing Example

Network10.0.0.0 F Network

20.0.0.0 G Network30.0.0.0 H Network

40.0.0.0

10.0.0.5

20.0.0.5

20.0.0.6

30.0.0.6

30.0.0.7

40.0.0.7

20.0.0.0 Deliver Direct30.0.0.0 Deliver Direct10.0.0.0 20.0.0.540.0.0.0 30.0.0.7

To reach hosts Route toon network this address

• Routing Table

Page 96: Computer Networks Chapter 3: Internetworking

CN_3.96

Router Characteristics Network Layer Routing

Network layer protocol dependent Filter MAC broadcast and multicast packets Easy to support mixed media Packet fragmentation and reassembly Filtering on network addresses and

information Accounting

Direct Communication Between Endpoints and Routers Highly configurable and hard to get right Handle speed mismatch Congestion control and avoidance

Page 97: Computer Networks Chapter 3: Internetworking

CN_3.97

Router Characteristics (Continued)

Routing Protocols Interconnect layer 3 networks and exploit

arbitrary topologies Determine which route to take Static routing Dynamic routing protocol support

RIP: Routing Information Protocol OSPF: Open Shortest Path First

Provides reliability with alternate routes Router Management

Troubleshooting capabilities Name-Address mapping services

Page 98: Computer Networks Chapter 3: Internetworking

CN_3.98

Differences Between Bridges and Routers

Bridges RoutersOperation at Layer 2 Operation at

Layer 3Protocol Independent Protocol DependentAutomatic Address Learning/Filtering Administration

Required for Address,Interface and Routes

Pass MAC Multicast/Broadcast MAC M/B can be Filtered

Lower Cost Higher CostNo Flow/Congestion Control Flow/Congestion

ControlLimited Security Complex SecurityTransparent to End Systems Non-

TransparencyWell Suited for Simple/Small Networks For WAN, Larger

NetworksNo Frames Segmentation/Reassembly Frames

Segmentation/ReassemblySpanning Tree Based Routing Optimal Routing

and Load Sharing Plug and Play Requires Central

Administrator

Page 99: Computer Networks Chapter 3: Internetworking

CN_3.99

IP Fragmentation and Reassembly

Each network has some MTU (Maximum Transmission Unit) Ethernet (1500 bytes), FDDI (4500 bytes)

Strategy Fragmentation occurs in a router when it

receives a datagram that it wants to forward over a network which has MTU < datagram

Reassembly is done at the receiving host All the fragments carry the same

identifier in the Ident field Fragments are self-contained datagrams IP does not recover from missing

fragments

Page 100: Computer Networks Chapter 3: Internetworking

CN_3.100

IP Fragmentation and Reassembly

IP datagrams traversing the sequence of physical networks

Page 101: Computer Networks Chapter 3: Internetworking

CN_3.101

IP Fragmentation and Reassembly

Header fields used in IP fragmentation. (a) Unfragmented packet;

(b) fragmented packets.

Page 102: Computer Networks Chapter 3: Internetworking

CN_3.102

Global Addresses Properties

globally unique hierarchical: network + host 4 Billion IP address, half are A type, ¼ is B type,

and 1/8 is C type Format

Dot notation 10.3.2.4 128.96.33.81 192.12.69.77

Page 103: Computer Networks Chapter 3: Internetworking

CN_3.103

IP Datagram Forwarding Strategy

every datagram contains destination's address if directly connected to destination network, then

forward to host if not directly connected to destination network,

then forward to some router forwarding table maps network number into next

hop each host has a default router each router maintains a forwarding table

Example (router R2)

Page 104: Computer Networks Chapter 3: Internetworking

CN_3.104

IP Datagram Forwarding Algorithmif (NetworkNum of destination = NetworkNum of one of my

interfaces) thendeliver packet to destination over that interface

elseif (NetworkNum of destination is in my forwarding table) thendeliver packet to NextHop routerelsedeliver packet to default router

For a host with only one interface and only a default router in its forwarding table, this simplifies to

if (NetworkNum of destination = my NetworkNum)thendeliver packet to destination directly

elsedeliver packet to default router

Page 105: Computer Networks Chapter 3: Internetworking

CN_3.105

Subnetting Add another level to address/routing

hierarchy: subnet Subnet masks define variable partition of

host part of class A and B addresses Subnets visible only within site

Page 106: Computer Networks Chapter 3: Internetworking

CN_3.106

Subnetting

Forwarding Table at Router R1

Page 107: Computer Networks Chapter 3: Internetworking

CN_3.107

SubnettingForwarding Algorithm

D = destination IP addressfor each entry < SubnetNum, SubnetMask, NextHop>

D1 = SubnetMask & Dif D1 = SubnetNum

if NextHop is an interface deliver datagram directly to destinationelse deliver datagram to NextHop (a router)

Page 108: Computer Networks Chapter 3: Internetworking

CN_3.108

SubnettingNotes Would use a default router if nothing

matches Not necessary for all ones in subnet mask to

be contiguous Can put multiple subnets on one physical

network Subnets not visible from the rest of the

Internet

Page 109: Computer Networks Chapter 3: Internetworking

CN_3.109

Classless Addressing Classless Inter-Domain Routing

A technique that addresses two scaling concerns in the Internet The growth of backbone routing table as more

and more network numbers need to be stored in them

Potential exhaustion of the 32-bit address space

Address assignment efficiency Arises because of the IP address structure with

class A, B, and C addresses Forces us to hand out network address space in

fixed-size chunks of three very different sizes– A network with two hosts needs a class C address

» Address assignment efficiency = 2/255 = 0.78– A network with 256 hosts needs a class B address

» Address assignment efficiency = 256/65535 = 0.39

Page 110: Computer Networks Chapter 3: Internetworking

CN_3.110

Classless Addressing Exhaustion of IP address space centers on

exhaustion of the class B network numbers Solution

Say “NO” to any Autonomous System (AS) that requests a class B address unless they can show a need for something close to 64K addresses

Instead give them an appropriate number of class C addresses

For any AS with at least 256 hosts, we can guarantee an address space utilization of at least 50%

What is the problem with this solution?

Page 111: Computer Networks Chapter 3: Internetworking

CN_3.111

Classless Addressing Problem with this solution

Excessive storage requirement at the routers.

If a single AS has, say 16 class C network numbers assigned to it, Every Internet backbone router needs 16

entries in its routing tables for that AS This is true, even if the path to every one

of these networks is the same If we had assigned a class B address

to the AS The same routing information can be

stored in one entry Efficiency = 16 × 255 / 65, 536 = 6.2%

Page 112: Computer Networks Chapter 3: Internetworking

CN_3.112

Classless Addressing CIDR tries to balance the desire to

minimize the number of routes that a router needs to know against the need to hand out addresses efficiently.

CIDR uses aggregate routes Uses a single entry in the forwarding

table to tell the router how to reach a lot of different networks

Breaks the rigid boundaries between address classes

Page 113: Computer Networks Chapter 3: Internetworking

CN_3.113

Classless Addressing Consider an AS with 16 class C network

numbers. Instead of handing out 16 addresses at

random, hand out a block of contiguous class C addresses

Suppose we assign the class C network numbers from 192.4.16 through 192.4.31

Observe that top 20 bits of all the addresses in this range are the same (11000000 00000100 0001) We have created a 20-bit network number (which

is in between class B network number and class C number)

Requires to hand out blocks of class C addresses that share a common prefix

Page 114: Computer Networks Chapter 3: Internetworking

CN_3.114

Classless Addressing Requires to hand out blocks of class C

addresses that share a common prefix The convention is to place a /X after the

prefix where X is the prefix length in bits For example, the 20-bit prefix for all the

networks 192.4.16 through 192.4.31 is represented as 192.4.16/20

By contrast, if we wanted to represent a single class C network number, which is 24 bits long, we would write it 192.4.16/24

Page 115: Computer Networks Chapter 3: Internetworking

CN_3.115

Classless Addressing How do the routing protocols handle

this classless addresses It must understand that the network

number may be of any length Represent network number with a

single pair<length, value>

All routers must understand CIDR addressing

Page 116: Computer Networks Chapter 3: Internetworking

CN_3.116

Classless Addressing

Route aggregation with CIDR

Page 117: Computer Networks Chapter 3: Internetworking

CN_3.117

IP Forwarding Revisited IP forwarding mechanism assumes

that it can find the network number in a packet and then look up that number in the forwarding table

We need to change this assumption in case of CIDR

CIDR means that prefixes may be of any length, from 2 to 32 bits

Page 118: Computer Networks Chapter 3: Internetworking

CN_3.118

IP Forwarding Revisited It is also possible to have prefixes in the

forwarding tables that overlap Some addresses may match more than one prefix

For example, we might find both 171.69 (a 16 bit prefix) and 171.69.10 (a 24 bit prefix) in the forwarding table of a single router

A packet destined to 171.69.10.5 clearly matches both prefixes. The rule is based on the principle of “longest

match” 171.69.10 in this case

A packet destined to 171.69.20.5 would match 171.69 and not 171.69.10

Page 119: Computer Networks Chapter 3: Internetworking

CN_3.119

Address Translation Protocol (ARP)

Map IP addresses into physical addresses destination host next hop router

Techniques encode physical address in host part of IP

address table-based

ARP (Address Resolution Protocol) table of IP to physical address bindings broadcast request if IP address not in

table target machine responds with its physical

address table entries are discarded if not

refreshed

Page 120: Computer Networks Chapter 3: Internetworking

CN_3.120

ARP Packet Format

HardwareType: type of physical network (e.g., Ethernet)

ProtocolType: type of higher layer protocol (e.g., IP)

HLEN & PLEN: length of physical and protocol addresses

Operation: request or response Source/Target Physical/Protocol addresses

Page 121: Computer Networks Chapter 3: Internetworking

CN_3.121

Host Configurations Notes

Ethernet addresses are configured into network by manufacturer and they are unique

IP addresses must be unique on a given internetwork but also must reflect the structure of the internetwork

Most host Operating Systems provide a way to manually configure the IP information for the host

Drawbacks of manual configuration A lot of work to configure all the hosts in a

large network Configuration process is error-prune

Automated Configuration Process is required

Page 122: Computer Networks Chapter 3: Internetworking

CN_3.122

Dynamic Host Configuration Protocol (DHCP)

DHCP server is responsible for providing configuration information to hosts

There is at least one DHCP server for an administrative domain

DHCP server maintains a pool of available addresses

Page 123: Computer Networks Chapter 3: Internetworking

CN_3.123

DHCP Newly booted or

attached host sends DHCPDISCOVER message to a special IP address (255.255.255.255)

DHCP relay agent unicasts the message to DHCP server and waits for the response

Page 124: Computer Networks Chapter 3: Internetworking

CN_3.124

Internet Control Message Protocol (ICMP)

Defines a collection of error messages that are sent back to the source host whenever a router or host is unable to process an IP datagram successfully Destination host unreachable due to link /node

failure Reassembly process failed TTL had reached 0 (so datagrams don't cycle

forever) IP header checksum failed

ICMP-Redirect From router to a source host With a better route information

Page 125: Computer Networks Chapter 3: Internetworking

CN_3.125

Internet Control Message Protocol (ICMP)

Defines a collection of error messages that are sent back to the source host whenever a router or host is unable to process an IP datagram successfully Destination host unreachable due to link /node

failure Reassembly process failed TTL had reached 0 (so datagrams don't cycle

forever) IP header checksum failed

ICMP-Redirect From router to a source host With a better route information

Page 126: Computer Networks Chapter 3: Internetworking

CN_3.126

3.3 RoutingForwarding versus Routing

– Forwarding: – to select an output port based on

destination address and routing table– Routing:

– process by which routing table is built

Page 127: Computer Networks Chapter 3: Internetworking

CN_3.127

Routing• Forwarding table VS Routing table

• Forwarding table • Used when a packet is being

forwarded and so must contain enough information to accomplish the forwarding function

• A row in the forwarding table contains the mapping from a network number to an outgoing interface and some MAC information, such as Ethernet Address of the next hop

• Routing table • Built by the routing algorithm as a

precursor to build the forwarding table

• Generally contains mapping from network numbers to next hops

Page 128: Computer Networks Chapter 3: Internetworking

CN_3.128

Routing

Example rows from (a) routing and (b) forwarding tables

Page 129: Computer Networks Chapter 3: Internetworking

CN_3.129

Routing• Network as a Graph

• The basic problem of routing is to find the lowest-cost path between any two nodes• Where the cost of a path equals the sum of the

costs of all the edges that make up the path

Page 130: Computer Networks Chapter 3: Internetworking

CN_3.130

Routing• For a simple network, we can calculate all

shortest paths and load them into some nonvolatile storage on each node.

• Such a static approach has several shortcomings• It does not deal with node or link failures• It does not consider the addition of new nodes

or links• It implies that edge costs cannot change

• What is the solution?• Need a distributed and dynamic protocol• Two main classes of protocols

• Distance Vector• Link State

Page 131: Computer Networks Chapter 3: Internetworking

CN_3.131

Distance Vector Each node constructs a one dimensional

array (a vector) containing the “distances” (costs) to all other nodes and distributes that vector to its immediate neighbors

Starting assumption is that each node knows the cost of the link to each of its directly connected neighbors

Page 132: Computer Networks Chapter 3: Internetworking

CN_3.132

Distance Vector

Initial distances stored at each node (global view)

Page 133: Computer Networks Chapter 3: Internetworking

CN_3.133

Distance Vector

Initial routing table at node A

Page 134: Computer Networks Chapter 3: Internetworking

CN_3.134

Distance Vector

Final routing table at node A

Page 135: Computer Networks Chapter 3: Internetworking

CN_3.135

Distance Vector

Final distances stored at each node (global view)

Page 136: Computer Networks Chapter 3: Internetworking

CN_3.136

Distance Vector The distance vector routing algorithm is

sometimes called as Bellman-Ford algorithm

Every T seconds each router sends its table to its neighbor each each router then updates its table based on the new information

Problems include fast response to good new and slow response to bad news. Also too many messages to update

Page 137: Computer Networks Chapter 3: Internetworking

CN_3.137

Distance Vector• When a node detects a link failure

F detects that link to G has failed F sets distance to G to infinity and sends

update to A A sets distance to G to infinity since it uses F to

reach G A receives periodic update from C with 2-hop

path to G A sets distance to G to 3 and sends update to F F decides it can reach G in 4 hops via A

Page 138: Computer Networks Chapter 3: Internetworking

CN_3.138

Distance Vector Slightly different circumstances can prevent the

network from stabilizing Suppose the link from A to E goes down In the next round of updates, A advertises a distance of

infinity to E, but B and C advertise a distance of 2 to E Depending on the exact timing of events, the following

might happen Node B, upon hearing that E can be reached in 2 hops from

C, concludes that it can reach E in 3 hops and advertises this to A

Node A concludes that it can reach E in 4 hops and advertises this to C

Node C concludes that it can reach E in 5 hops; and so on. This cycle stops only when the distances reach some

number that is large enough to be considered infinite– Count-to-infinity problem

Page 139: Computer Networks Chapter 3: Internetworking

CN_3.139

Count-to-infinity Problem Use some relatively small number as an

approximation of infinity For example, the maximum number of hops to get

across a certain network is never going to be more than 16

One technique to improve the time to stabilize routing is called split horizon When a node sends a routing update to its neighbors, it does

not send those routes it learned from each neighbor back to that neighbor

For example, if B has the route (E, 2, A) in its table, then it knows it must have learned this route from A, and so whenever B sends a routing update to A, it does not include the route (E, 2) in that update

Page 140: Computer Networks Chapter 3: Internetworking

CN_3.140

Count-to-infinity Problem In a stronger version of split horizon, called split

horizon with poison reverse B actually sends that back route to A, but it puts

negative information in the route to ensure that A will not eventually use B to get to E

For example, B sends the route (E, ∞) to A

Page 141: Computer Networks Chapter 3: Internetworking

CN_3.141

Routing Information Protocol (RIP)

Example Networkrunning RIP RIPv2 Packet

Format

Page 142: Computer Networks Chapter 3: Internetworking

CN_3.142

Link State RoutingStrategy: Send to all nodes (not just

neighbors) information about directly connected links (not entire routing table).

Link State Packet (LSP) id of the node that created the LSP cost of link to each directly connected neighbor sequence number (SEQNO) time-to-live (TTL) for this packet

Reliable Flooding store most recent LSP from each node forward LSP to all nodes but one that sent it generate new LSP periodically; increment SEQNO start SEQNO at 0 when reboot decrement TTL of each stored LSP; discard when

TTL=0

Page 143: Computer Networks Chapter 3: Internetworking

CN_3.143

Link State Reliable Flooding

Flooding of link-state packets. (a) LSP arrives at node X; (b) X floods LSP to A and C; (c) A and C flood LSP to B (but not X); (d) flooding is complete

Page 144: Computer Networks Chapter 3: Internetworking

CN_3.144

Shortest Path Routing Dijkstra’s Algorithm - Assume non-negative

link weights N: set of nodes in the graph l((i, j): the non-negative cost associated with the

edge between nodes i, j N and l(i, j) = if no edge connects i and j

Let s N be the starting node which executes the algorithm to find shortest paths to all other nodes in N

Two variables used by the algorithm M: set of nodes incorporated so far by the algorithm C(n) : the cost of the path from s to each node n The algorithm

M = {s}For each n in N – {s}

C(n) = l(s, n)while ( N M)M = M {w} such that C(w) is the minimum for all w in (N-M)For each n in (N-M) C(n) = MIN (C(n), C(w) + l(w, n))

Page 145: Computer Networks Chapter 3: Internetworking

CN_3.145

Shortest Path Routing In practice, each switch computes its

routing table directly from the LSP’s it has collected using a realization of Dijkstra’s algorithm called the forward search algorithm

Specifically each switch maintains two lists, known as Tentative and Confirmed

Each of these lists contains a set of entries of the form (Destination, Cost, NextHop)

Page 146: Computer Networks Chapter 3: Internetworking

CN_3.146

Shortest Path Routing The algorithm

Initialize the Confirmed list with an entry for myself; this entry has a cost of 0

For the node just added to the Confirmed list in the previous step, call it node Next, select its LSP

For each neighbor (Neighbor) of Next, calculate the cost (Cost) to reach this Neighbor as the sum of the cost from myself to Next and from Next to Neighbor

If Neighbor is currently on neither the Confirmed nor the Tentative list, then add (Neighbor, Cost, Nexthop) to the Tentative list, where Nexthop is the direction I go to reach Next

If Neighbor is currently on the Tentative list, and the Cost is less than the currently listed cost for the Neighbor, then replace the current entry with (Neighbor, Cost, Nexthop) where Nexthop is the direction I go to reach Next

If the Tentative list is empty, stop. Otherwise, pick the entry from the Tentative list with the lowest cost, move it to the Confirmed list, and return to Step 2.

Page 147: Computer Networks Chapter 3: Internetworking

CN_3.147

Shortest Path Routing

Page 148: Computer Networks Chapter 3: Internetworking

CN_3.148

Open Shortest Path First (OSPF)

OSPF Header Format OSPF Link State Advertisement

Page 149: Computer Networks Chapter 3: Internetworking

CN_3.149

Summary We have looked at some of the issues

involved in building scalable and heterogeneous networks by using switches and routers to interconnect links and networks.

To deal with heterogeneous networks, we have discussed in details the service model of Internetworking Protocol (IP) which forms the basis of today’s routers.

We have discussed in details two major classes of routing algorithms Distance Vector Link State

Page 150: Computer Networks Chapter 3: Internetworking

End of Chapter 3