28
1 Data Link Layer Data Link Layer Lecture 23 Lecture 23 Imran Ahmed Imran Ahmed University of Management & Technology University of Management & Technology

1 Data Link Layer Lecture 23 Imran Ahmed University of Management & Technology

Embed Size (px)

Citation preview

Page 1: 1 Data Link Layer Lecture 23 Imran Ahmed University of Management & Technology

1

Data Link LayerData Link LayerLecture 23Lecture 23

Imran AhmedImran AhmedUniversity of Management & TechnologyUniversity of Management & Technology

Page 2: 1 Data Link Layer Lecture 23 Imran Ahmed University of Management & Technology

2

Agenda

• Introduction & services

• Error detection and correction

• Multiple access protocols

• LAN addresses and ARP

• Ethernet

• Hubs, bridges and switches

Page 3: 1 Data Link Layer Lecture 23 Imran Ahmed University of Management & Technology

3

Hubs• It works on physical layer.

• It is used in star topology (LAN).

• It’s a broadcasting device

Page 4: 1 Data Link Layer Lecture 23 Imran Ahmed University of Management & Technology

4

Why Bridges?• It operates both the physical & data link

layers.

• Bridges can divide a large networks into smaller segments.

• Bridges contain logic that allows them to keep the traffic for each segment separate.

• It can also provide security through this partitioning of traffic.

Page 5: 1 Data Link Layer Lecture 23 Imran Ahmed University of Management & Technology

5

A Bridge in the OSI Model

Page 6: 1 Data Link Layer Lecture 23 Imran Ahmed University of Management & Technology

6

A Bridge

Page 7: 1 Data Link Layer Lecture 23 Imran Ahmed University of Management & Technology

7

Bridge Functions• When a frame enters a bridge, the bridge not only

regenerates the signal but checks the address of the destination and forwards a new copy only to the segment to which the address belongs.

• As a bridge encounters a packet, it reads the address contained in the frame and compares that address with a table of all the stations on both segments.

• When it finds a match, it discovers to which segment the station belongs and relays the packet only to that segment.

Page 8: 1 Data Link Layer Lecture 23 Imran Ahmed University of Management & Technology

8

Function of a Bridge

Page 9: 1 Data Link Layer Lecture 23 Imran Ahmed University of Management & Technology

9

Bridge – Example • Example: Last slide shows two segments joined

by a bridge.– In figure a, A packet from station A addressed to station

D arrives at the bridge.– Station A is on the same segment at station D; therefore,

the packet is blocked from crossing into the lower segment.

– Instead, the packet is relayed to the entire upper segment and received by station D.

– In figure b, a packet generated by station A is intended for station G.

– The bridge allows the packet to cross and relays it to the entire lower segment, where it is received by station G.

Page 10: 1 Data Link Layer Lecture 23 Imran Ahmed University of Management & Technology

10

Bridge Table• Bridge filtering & forwarding is done by

bridge table.

• The bridge table contains entries for some, not all of the nodes on a LAN. An entry in the tables contains:-– The LAN address of the node– The bridge interface that leads towards the

node.– The time at which the entry for the node was

placed in the table.

Page 11: 1 Data Link Layer Lecture 23 Imran Ahmed University of Management & Technology

11

Types of Bridges• Simple bridge – is the most primitive and

least expensive type of bridge.– It links two segments and contains a table that

lists the addresses of all the stations included in each of them.

– What makes it primitive is that these addresses must be entered manually.

– Whenever a new station is added, the table must be modified.

– Installation and maintenance of simple bridges are time-consuming.

Page 12: 1 Data Link Layer Lecture 23 Imran Ahmed University of Management & Technology

12

Types of Bridges• Multi-port bridge – can be used to connect

more than two LANs– In the next slide figure, the bridge has three

tables, each one holding the physical addresses of stations reachable through the corresponding port.

Page 13: 1 Data Link Layer Lecture 23 Imran Ahmed University of Management & Technology

13

Multi-port Bridge

Page 14: 1 Data Link Layer Lecture 23 Imran Ahmed University of Management & Technology

14

Types of Bridges• Transparent bridge – or learning bridge builds it table of

station addresses on its own.– The bridge table is initially empty.– When a frame arrives on one of the interfaces and the frame’s

destination address is not in the table, then the bridge forwards copies of the frame to the output buffers preceding all of other interfaces.

– For each frame received, the bridge stores in its table (1) the LAN address in the frame’s source address field, (2) the interface from which the frame arrived & (3) the current time.

– When a frame arrives on one of the interfaces and the frame’s destination address is in the table, then the bridge forwards the frame to the appropriate interface.

– The bridge deletes an address in the table, if no frames are received with that address as the source address after some period of time (the aging time).

Page 15: 1 Data Link Layer Lecture 23 Imran Ahmed University of Management & Technology

15

Types of Bridges• Spanning Tree Algorithm – Bridges are

normally installed redundantly, which means that two LANs may be connected by more than one bridge.– In this case, if the bridges are transparent bridges,

they may create a loop, which means a packet may be going round and round, form one LAN to another and back again to the first LAN.

– To avoid this situation, bridges today use what is called the spanning tree algorithm.

Page 16: 1 Data Link Layer Lecture 23 Imran Ahmed University of Management & Technology

16

Types of Bridges– Another solution to prevent loops in the LANs

connected by bridges is source routing.– In which, the source of the packet defines the

bridges and the LANs through which the packet should go before reaching the destination.

Page 17: 1 Data Link Layer Lecture 23 Imran Ahmed University of Management & Technology

17

Spanning Tree Problem Figure

Br 1 Br 2

Segment 1

Segment 2

Host B

Host A

Two LANs connected by two bridges

Page 18: 1 Data Link Layer Lecture 23 Imran Ahmed University of Management & Technology

18

Spanning Tree Problem• Suppose host B has not sent any packet, so neither

bridge know to which segment host b is connected. Now consider this sequence of events:-– Host A sends a packet to host B.– One of the bridges, say Br1, receives the packet first and, not

knowing where host b is, forwards the packet to segment 2.– The packet goes to its destination (host B) but at the same time, br2

receives the packet via segment 2.– The packet source address is host A; its destination address is host

B. Br2 erroneously assumes that host A is connected to segment 2 & updates its table accordingly. Because it does not have any information about host B, Br2 forwards the packet to segment 1.

– The packet is then received for the second time by Br1. it thinks that it is a new packet from host A and because it has no information about host b, Br1 forwards the packet to segment 2.

– Now Br2 receives the packet again, and the cycle will repeat endlessly.

Page 19: 1 Data Link Layer Lecture 23 Imran Ahmed University of Management & Technology

19

Spanning Tree Problem• This situation occurs due to three factors:-

– Transparent or Learning bridges are being used that do not have information about the location of host until they receive at least one packet from them.

– The bridges are not aware of the existence of other bridges.

– Graph has been created instead of tree.

Page 20: 1 Data Link Layer Lecture 23 Imran Ahmed University of Management & Technology

20

Br1:100

Br4:400 Br3:300Br5:500

Br2:200

Segment 1

2

2

4

2

2

4

4

44

Segment 5

Segment 4

Segment 3

Segment 2

2

2

A LAN before using the spanning-tree algorithm

Page 21: 1 Data Link Layer Lecture 23 Imran Ahmed University of Management & Technology

21

Spanning Tree Algorithm• An ID number is assigned to each bridge.

– An ID number can be any arbitrary number determined by the network manager or the address of one of the ports, normally the smallest one.

• Each port is assigned a cost.– Normally the cost is determined by the bit rate supported by

the port (the higher the bit rate, the lower the cost).• The process of finding the spanning-tree can be

summarized in three steps:-– The bridges choose a bridge to be the root of the tree. This is

done by assigning an ID to the bridge and then finding the bridge with the smallest ID.

– Each bridge determines its root port, the port that has the least root path cost to the root. The root path cost is the accumulated cost of the path from the port to the root.

– One designated bridge is chosen for each segment.

Page 22: 1 Data Link Layer Lecture 23 Imran Ahmed University of Management & Technology

22

Spanning Tree Algorithm• Finding the Root bridge:

– When a bridge receives the BPDU, it compares the source’s bridge ID with its own ID.

– If its own ID is larger than the source’s bridge ID, it increments the root path cost by the cost of the receiving port forwards the frame. It also stops sending its own BPDU because it knows that it will not be chosen as the root bridge (another bridge has a lower ID).

– If its own ID is smaller that the source’s bridge ID, the bridge discards the BPDU.

• It is obvious that after a while, the only BPDU that is being circulated is one with the smallest source bridge ID, the root bridge. In this way, every bridge knows which is the root bridge.

Page 23: 1 Data Link Layer Lecture 23 Imran Ahmed University of Management & Technology

23

Spanning Tree Algorithm• Finding the Root Port:

– The root port is the port whose BPDU has the minimum accumulated root cost.

• Choosing the Designated Bridge:– The bridge that can carry a frame from the segment to

the root with the cheapest root cost is selected as the designated bridge and the particular port that connects the bridge to that segment is called the designated port.

• Forming the Spanning Tree:– The ports of the bridge are divided into two groups:-

• The forwarding ports are the root ports and all of the designated ports.

• The rest of the ports are considered to be blocking ports.

Page 24: 1 Data Link Layer Lecture 23 Imran Ahmed University of Management & Technology

24

Br1:100

Br4:400 Br3:300Br5:500

Br2:200

Segment 1

Des.

Des.

R.P.

Des.

R.P.

Blocking port

R.P.

Des.Des.

Segment 5

Segment 4

Segment 3

Segment 2

Blocking port

R.P.

A LAN after using the spanning-tree algorithm

Root bridge

Page 25: 1 Data Link Layer Lecture 23 Imran Ahmed University of Management & Technology

25

Spanning Tree Algorithm• We claim that with this configuration each LAN segment

will receive one and only one copy of a frame sent by any host on any other segment; this guarantees loop-free operation:– A frame sent by a host on segment 1 will reach segment 2 through Br1,

will reach segment 3 and segment 4 through Br1-Br2, and will reach segment 5 through Br4.

– A frame sent by a host on segment 2 will reach segment 1 through Br1, will reach segment 3 and segment 4 through Br2, and will reach segment 5 through Br1-Br4.

– A frame sent by a host on segment 3 will reach segment 4 and segment 2 through Br2, will reach segment 1 through Br2-Br1, and will reach segment 5 through Br2-Br1-Br4.

– A frame sent by a host on segment 4 will reach segment 3 and segment 2 through Br2, will reach segment 1 through Br2-Br1, and will reach segment 5 through Br2-Br1-Br4.

– A frame sent by a host on segment 5 will reach segment 1 through Br4, will reach segment 2 through Br4-Br1, and will reach segment 3 and segment 4 through Br4-Br1-Br2.

Page 26: 1 Data Link Layer Lecture 23 Imran Ahmed University of Management & Technology

26

Switches• The switch has a buffer for each link (network) to

which it is connected.• When it receives frame, it stores the frame in the

buffer of the receiving link and checks the address to find the out-going link.

• Switches are based on two different strategies (called fabrics):– Store-and-forward – stores the frame in the input buffer

until the whole packet has arrived.

– Cut-through-switch – forwards the packet to the output buffer as soon as the destination address is received.

Page 27: 1 Data Link Layer Lecture 23 Imran Ahmed University of Management & Technology

27

Switch

Page 28: 1 Data Link Layer Lecture 23 Imran Ahmed University of Management & Technology

28

Summary Comparison

Hubs Bridges Routers Switches

Traffic isolation

No yes yes Yes

Plug & play

Yes Yes No yes

Optimal routing

No No Yes No

Cut - through

yes No no Yes