chapter 5 the data link layer departamento de tecnología electrónica computer networking some of...

64
Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from: Computer Networking: A Top Down Approach , 5 th edition. Jim Kurose, Keith Ross Addison-Wesley, April 2009.

Upload: ashley-shelton

Post on 25-Dec-2015

217 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

Chapter 5The Data Link Layer

Departamento deTecnología Electrónica

Computer Networking Some of these slides are given as material with copyright from: Computer Networking: A Top Down Approach ,5th edition. Jim Kurose, Keith RossAddison-Wesley, April 2009.

Page 2: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

Data Link Layer 5-2

Unit 5: The Data-Link LayerOur goals: understand the principles behind data link layer

services: error control (detection, correction) sharing a broadcast channel: multiple access link layer addressing reliable data transfer, flow control

Example: implementation in local area network (LAN)

Page 3: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

Chapter 5. Overview

5.1 Introduction and services5.2 Data Link layer functions5.3 Local Area Networks (LAN)

MAC address Ethernet (802.3) Link-layer switches

5.4 ARP protocol5.5 Example

Data Link Layer 5-3

Page 4: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

Data Link Layer 5-4

IntroductionTerminology: Node: device that has data link layer (hosts ,

routers, switches…) communication channels that connect adjacent

nodes along a communication path are links wired links wireless links

Links can be: Point to point: two nodes connected by a single

physical medium. Multipoint: several nodes connected by a

physical medium (shared medium). layer-2 PDU (L_PDU) is a frame, encapsulates

L_UD (in general N_PDU, datagram).

Data-link layer is responsible fortransferring L_PDUs (also known as DL_PDUs) from one node to a physically adjacent node over a link.

Wireless media

Point to pointWired media

Multipoint

Page 5: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

Data Link Layer 5-5

Link layer: context (I) datagram transferred by

different link protocols over different links: e.g., Ethernet on first link,

frame relay on intermediate links, 802.11 on last link

each link protocol provides different services e.g., may or may not provide

rdt over link

transportation analogy trip from Princeton to Lausanne

bus: Princeton to JFK plane: JFK to Geneva train: Geneva to Lausanne

tourist = L_UD transport segment =

communication link transportation mode = link

layer protocol frame = bus, plane or train,

according to the case

Page 6: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

5-6

Link layer: context (II) Physical layer offers a non reliable

sending/receiving bits or bytes service to the Data-Link layer. Sometimes it also reports about the state of the

physical medium:• Medium is idle (none of the nodes are

transmitting).• Medium is busy (there is some node

transmitting). Depending on the physical layer protocol, data

link layer may: Send and receive bits or bytes simultaneously, known

as full-duplex.• It is only possible in point to point links.

Send and receive bit or bytes but not simultaneously, known as half-duplex.

Data Link Layer

Full-duplex

Half-duplex

Page 7: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

5-7

Just like the transport layer, data link layer can offer two types of services to the upper layer: Reliable data delivery between adjacent nodes.

• It works similar to TCP mechanisms studied in chapter 3.

Un-reliable data delivery between adjacent nodes.• It works similar to UDP.

Every data link layer protocol use one of these types of service. Tipically, it offers an unreliable data delivery.

Most links has a low error rate.• E.g., fiber links or some types of twister pair.

In case of a link with high error rate, data-link layer must implement the reliable data delivery service. E.g. in wireless links. Q. Why both link-level and end-end reliability?

Data Link Layer

Data-Link layer services

Page 8: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

Chapter 5. Overview

5.1 Introduction and services5.2 Data Link layer functions5.3 Local Area Networks (LAN)

MAC address Ethernet (802.3) Link-layer switches

5.4 ARP protocol5.5 Example

Data Link Layer 5-8

Page 9: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

Data Link Layer 5-9

Data-Link Layer Functions (I) Frame creation:

Encapsulates an L_UD inside an L_PDU, adding the L_PCI before the L_UD (header), and after the L_UD (tail).

Frame synchronization: To distinguish where each L_PDU starts and ends inside the received bits or bytes flow in

data-link layer.• Each protocol defines the content for the L_PCI field, which is used with that aim.

– E.g.: STX ASCII code (Start of TeXt) can be used to set the start and ETX (End of TeXt) to set the end.

Node identification (addressing): Every link-layer node must have an only identifier, which distinguishes it from the rest of

the nodes.• Allow to identify source node and destination node inside the L_PDU.

Depends on technology. Known as physical address

• E.g., MAC address– Different to logical addresses (IP)

Page 10: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

Data Link Layer 5-10

Data-Link Layer Functions (II) error detection:

Required because errors caused by signal attenuation, noise, that make L_PDUs arrive damaged at receiver.

Consists on adding additional bits of L_PCI, known as redundant, to L_PDU for detecting errors in some bits.

• Sender calculates the value for these bits before sending frame.• Receiver does the same calculations to check if it matches received

redundant bits. None algorithm is 100% reliable.

• Some errors can not be detected. The most widespread link layer algorithm is CRC (Cyclic Redundancy

Check).• Technique based on calculating redundant bits using binary polynomial

operations.

Page 11: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

Data Link Layer 5-11

Data-Link Layer Functions (III) Error correction: (not always implemented)

Retransmission• Similar mechanism to the one used in chapter 3.

receiver identifies and corrects bit error(s) without resorting to retransmission

• Not very usual in data communications. Flow control: (not always implemented)

Between adjacent sending and receiving nodes

Page 12: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

Data Link Layer 5-12

Data-Link Layer Functions (IV) Medium access control:

In case of shared media it is necessary to manage which node is using the link in every moment.

It can be done in different ways:• Centralized: A node in the link, known as master, is responsible

for managing the medium access of the rest of the nodes, known as slaves.

– It uses the polll/select mechanism:» Poll: L_PDU is sent from slave to master.» Select: L_PDU is sent from master to slave.

• Distributed: All nodes in the link coordinate in every moment to know which can use the link (“taking turns”).

– Contention: A node uses the link if physical layer reports that is idle. In case that two or more nodes transmit a L_PDU almost at the same time a collision is produced. Each node tries again the L_PDU transmission that collided after a random time.

– Circular rotation: Each node accesses to medium in its turn.

master

eslaves

Poll/Select

POLL

L_PDU

SEL

L_PDU

Contention

L_PDU

L_PDU

L_PDU

COLLISION

TL_PDU

Circular rotation

Page 13: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

Chapter 5. Overview.

5.1 Introduction and services5.2 Data Link layer functions5.3 Local Area Networks (LAN)

MAC address Ethernet (802.3) Link-layer switches

5.4 ARP protocol5.5 Example

Data Link Layer 5-13

Page 14: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

LAN (Local Area Network) (I) LAN is the most widespread network technology. It allows end systems and routers to be physically

connected inside a broadcast domain. It implements, through the network interface, the two

lowest layers of OSI model, that is, link and physical layers.

Data link layer 5-14

Link layer is splitted in two sub-layers: o LLC (Logical Link Control) . For flow control and error detection functions.o MAC (Medium Access Control). For frame synchronism, error detection, medium access control and addressing.

It is implemented in the network interface (NIC) up to the MAC sublayer.

OSI LAN

Data link LLC

MAC

Physical

Note

Page 15: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

LAN (II) IEEE (The Institute of Electrical and Electronics Engineers) is

responsible for LAN standardization. It allows different manufacturers selling different network

interfaces, physical media, connectors… for the same LAN technology.

LAN stantards most widespread are: 802.3 known as Ethernet.

• It uses a wired physical medium.– Nowadays, fiber or twister pair.

802.11 known as WI-FI (WLAN, Wireless LAN).• It uses a wireless physical medium.

– Frecuency band: 2.4 GHz and 5 GHz.

Data Link Layer 5-15

Page 16: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

Chapter 5. Overview

5.1 Introduction and services5.2 Data Link layer functions5.3 Local Area Networks (LAN)

MAC address Ethernet (802.3) Link-layer switches

5.4 ARP protocol5.5 Example

Data Link Layer 5-16

Page 17: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

MAC addresses (I) 48 bits MAC addressess.

Different notations to represent them. They are grouped in bytes and every byte is represented in hexadecimal format:

1B:03:F2:45:78:25 F0.34.AB.23.45.12 02DE0A.2343AC

There are three types of MAC addresses: Unicast: For sending L_PDUs to a single destination.

All network interfaces have an assigned manufacturing MAC address. Broadcast: Used as destination. For sending L_PDUs to all the nodes in

the same broadcast domain (FF:FF:FF:FF:FF:FF). Multicast: Used as destination. For sending L_PDUs to a group of nodes

in the same broadcast domain. Configurable. The lowest significant bit in the first byte of the MAC address is

set to 1.

Data Link Layer 4-17

Page 18: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

5-18

MAC addresses (II) Unicast MAC address allocation administered by IEEE.

Manufacturer buys a portion of the MAC address space (to assure uniqueness). It is possible to change the manufacturing MAC address.

Analogy: MAC address: Id. card IP address: postal address

MAC: flat addressing ➜ portability Can move LAN card from one LAN to another.

IP: hierarchical addressing ➜ NOT portable Address depends on the IP subnet to which node is attached.

Example: the laptop that you use in class has a WI-FI interface that has a unique MAC regardless of connecting to our home IP network or to the ETSII IP network.

Data Link Layer

Page 19: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

Chapter 5. Overview

5.1 Introduction and services5.2 Data Link layer functions5.3 Local Area Networks (LAN)

MAC address Ethernet (802.3) Link-layer switches

5.4 ARP protocol5.5 Example

Data Link Layer 5-19

Page 20: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

5-20

Ethernet (802.3) The most sucessful LAN technology.

Easy to install. Cheap.

Many different Ethernet standards. Common MAC Sublayer.

• Medium access protocol.– Contention mechanism.

• MAC_PDU format (frame). Allows multipoint and point-to-point links. Different physical-layer protocols:

• Physical medium: fiber, coaxial and twister pair.• Different rates (R): 2 Mbps, 10 Mbps, 100 Mbps, 1Gbps, 10Gbps.

Data Link Layer

Applicationtransportnetwork

linkphysical

MAC

100BASETX 1000BASET 100BASEFX 1000BASESX 10GBASESX

FiberTwister pair

Internet

10BASET

LLC (Optional)

Ethernet

If not: MAC_PDU = L_PDU

Page 21: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

5-21

How are nodes connected? Up to 100 Mbps, it is possible to have point-to-point (half-duplex or full-

duplex) or multipoint links. For multipoint links, a physical-layer device is used. It is known as hub.

A hub allows everything that is sent by a network interface (node) to be received by the rest of the network interfaces.

From 1Gbps links are point-to-point (half-duplex or full-duplex). Only two network interfaces (nodes) in the link. E.g.:

Data Link Layer

L_PDU

L_PDU

L_PDU

L_PDU

L_PDU

L_PDU If two or more nodes transmit almost simultaneously a collision happens.

Note

Page 22: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

5-22

MAC_PDU (frame)

Data Link Layer

Start delimiter (8 bytes)

Destination MAC address(6 bytes)

Source MAC address(6 bytes)

Length/Type(2 bytes)

MAC_UD(46-1500 bytes)

Padding

CRC(4 bytes)

1 byte7 bytes with 10101010.1 byte (the last one) with 10101011.

Ethernet MTU is 1500 bytesNote

•Value less than 1500 means length:- Indicates #bytes of MAC_UD- There is sublayer LLC.

•Value greater than 1536 means type:Multiplexion and demultiplexion

Upper layer data, usually IP, ARP or LLC.If #bytes of MAC_UD is less than 46 it is padded with bytes to 0 (padding).

Page 23: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

5-23

Basic operation

Data Link Layer

A node considers that it is destination of a MAC_PDU if the destination MAC address in the MAC_PCI has a value that matches: the manufacturing unicast MAC address, or the broadcast MAC address, or the multicast addresses that the node has configured.

Note

Transmission: When a node has a MAC_PDU to send, there are two possibilities, depending on either the physical layer is… …half-duplex, checks if link is idle. If so, the node sends all MAC_PDU bits back-

to-back. Otherwise, the node waits for being idle.• If collisions happen, the node tries to transmit again after a random time.

…full-duplex , sends all MAC_PDU bits back-to-back. Reception: When a node receives a MAC_PDU, it checks if it is the destination. If

so, the node processes and dencapsulates the MAC_PDU. Otherwise, the node discards it. If the node receives a MAC_PDU with errors, it discards it, without reporting

anything to the transmitter.• Ethernet offers an unreliable delivery service. This is why it does not need a

connection establishment (similar operation to IP and UDP).

Page 24: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

Chapter 5. Overview.

5.1 Introduction and services5.2 Data Link layer functions5.3 Local Area Networks (LAN)

MAC address Ethernet (802.3) Link-layer switches

5.4 ARP protocol5.5 Example

Data Link Layer 5-24

Page 25: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

5-25

Introduction A LAN switch, also known as LAN bridge, allows

interconnecting LANs that use the same or different MAC sublayer (physical layer also can be different), in a transparent way.

• E.g.: Connecting a WI-FI WLAN with Ethernet. This kind of switch is known as access point.

Operation of these devices is described in the standard IEEE 802.1d, “Media Access Control Bridges”, MAC bridges.

Data Link Layer

Switch Bridge

Page 26: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

5-26

Switch characteristics A switch has a set of network interfaces (from the same or

different LAN). Switch interfaces are identified in the similar way that routers.

Each interface of a switch is a different link that can be point-to-point or multipoint. This link is known as collision or bandwidth domain. In case of multipoint link or half-duplex point-to-point the medium access will be

controlled by the MAC protocol of the LAN that is being used in that interface.

Data Link Layer

E0

E1

Fa0

E:Ethernet 10 Mbps, Fa:Fast Ethernet, Gi:Gigabit Ethernet, To: Token Ring

Page 27: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

5-27

Switch operation (I) A switch processes all the MAC_PDUs1 that it receives from

all of its interfaces: It learns the source node location of the MAC_PDU. It forwards the MAC_PDU, if suitable, through a different

interface than the source’s one.• It does not work like a HUB.

Known as store&forward device. A switch maintains a table known as switching table or

MAC address table where the location of the nodes in the broadcast domain is saved. The switch checks it in order to know if it has to forward a MAC_PDU received through an interface, or not.

Data Link Layer

1It is said that the switch works in promiscuous mode.

Page 28: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

5-28

Switch operation (II) Every switching table entry contains:

Interface. MAC address. Timestamp.

Q. How is this table completed? A1. Manually.

• It is not the usual way. A2. Dynamically.

• Learning the received MAC_PDUs through every interface.– It does not work like a router.

• Entries are valid during a time interval.

Data Link Layer

Page 29: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

5-29

Switch operation (III)

Data Link Layer

Interface MAC Time

E0 00:0C:01:00:01:0A ∞E1 00:0C:01:00:01:0C ∞E2 00:0C:01:00:01:0E ∞E3 00:0C:01:00:01:0F ∞

00:0C:01:00:01:0A

C

00:0C:01:00:01:0C

00:0C:01:00:01:0E00:0C:01:00:01:0F

E0 E1

E

A

FE2 E3

A switch, just like a router, …… requires buffers to store incoming MAC_PDUs through an input interface before processing them, and outgoing MAC_PDUs before sending them through an output interface.… introduces delays.

Note

MAC_PDU : E to A

MAC_PDU : C to FMAC_PDU : A to E

MAC_PDU : F to C

Page 30: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

MAC_PDU received without error through

interface x

Output interface = x?

Forward MAC_PDUthrough output interface

Forward MAC_PDUthrough all output interfaces

but x

Source MAC address found in switching table?

Update interface and timestampfor this entry

End

Add entry in switching tablefor source MAC address

(with interface and timestamp)

Destination MAC address found in switching table?

Forward

Learning

Yes

No

Yes

No

No

Yes

Switch operation (IV)

5-30Data Link Layer

Page 31: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

5-32

Example 2 (I) How many bandwidth domains are there? “Who” sent the last MAC_PDU? Which was its destination? F sends a MAC_PDU to B. “Who” receives and processes it?

Data Link Layer

DB

00:0C:01:00:01:0B

00:0C:01:00:01:0F

Switch 2

Interface MAC TIME

E1 00:0C:01:00:01:0C 5

E FE0 E1

00:0C:01:00:01:0A

C

00:0C:01:00:01:0C

E0 E1

A

E2

00:0C:01:00:01:0D

E2

E3SW1

SW2

Switch 1

Interface MAC TIME

E2 00:0C:01:00:01:0B 4

One minute later, D sends a MAC_PDU to C. “Who” receives and processes it? Three minutes later, E sends a MAC_PDU with broadcast MAC as destination. “Who” receives and processes it? How many broadcast domains are there?

00:0C:01:00:01:0E

Assumptions:-Timestamp expiry = 5 minutes - No delays

HUB

Page 32: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

Data-Link Layer

5.1 Introduction and services5.2 Data Link layer functions5.3 Local Area Networks (LAN)

MAC address Ethernet (802.3) Link-layer switches

5.5 ARP protocol5.6 Example

Data Link Layer 5-33

Page 33: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

To send an IP_PDU, IP looks for a target network among the entries in the routing table (RT). If it is found, network layer sends it through the output interface indicated by the RT by using the data link layer services….

…directly to the destination, if it is connected directly. … to the device (router) whose IP address matches the next hop in the RT.

5-34

Introduction Link layer requires that the Network layer indicates the

destination node to create and deliver the L_PDU (destination physical address field of L_PCI). For LANs is the destination MAC address.

Network layer provides this service, using a field inside the L_ICI of the L_IDU. This is delivered to the data link layer.

IP knows only the destination IP address or the next hop IP address, depending on the case.

Data Link Layer

Remember

Page 34: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

routingtable

IP protocol (RFC 791)•addressing conventions•Datagram (N_PDU) format•Forwarding N_PDU

ICMP protocol•error reporting•router “signaling”

Transport layer: TCP, UDP

Link layer

physical layer

Networklayer

ARP protocol• Mapping physical addr and IP addr

Routing protocols•path selection•RIP, OSPF, BGP

5-35

How does IP discover a physical address? Using services of an Internet network layer protocol: ARP

(Address Resolution Protocol). RFC 826.

ARP also uses data link layer services.

Data Link Layer

Remember

Page 35: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

5-36

ARP cache (I) Every Internet-network-layer device keeps a table, known

as address mapping table or arp cache. It contains pairs of physical address (MAC address) and logical address (IP address).

ARP can query and modify its content. An address mapping table contains three values for every

entry: IP address Physical address Timestamp

Data Link Layer

arp cache example

IP address MAC address Timestamp

193.1.1.25 00:0C:01:00:01:0A 5

193.1.1.12 00:0C:01:00:01:0C 4

Page 36: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

5-37

ARP cache (II) How is the arp cache completed?

Manually• Static entries

– Not usual Dinamically:

• Using ARP protocol.– When ARP learns the physical address corresponding to an IP

address, it introduces the pair physical-logical addresses in the cache.

• Entries expire after a period of time and are removed from the cache.

• Every time that a cache entry is queried the timestamp is updated.

Data Link Layer

Page 37: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

5-38

ARP basic operation (I) When the IP protocol running in a device with Internet-

network-layer requests to ARP for a physical address associated to an IP address, ARP protocol queries the arp cache: If the IP address is in the cache, the associated physical address is

taken.• It updates the timestamp for this entry.

If it does not exist, then,• It starts a mechanism, known as request/reply, to discover the physical

address associated to the queried IP address by IP protocol.– Both devices, the device whose IP was unknown and the source device, modify their arp

cache.» Destination updates or includes a new entry in the arp cache of the source device.» Source includes a new entry in its arp cache.

Data Link Layer

Page 38: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

5-39

ARP basic operation (II) Query:

It sends an ARP_PDU, known as ARP Request, to ask the requested IP address and report its own IP and MAC addresses.

– It is received by all network-layer devices inside the same broadcast domain.

» When ARP requests services to the link layer to send this ARP_PDU, it indicates that destination physical address is broadcast (inside the L_ICI of the L_IDU).

Response: The device inside the broadcast domain whose IP address

matches the requested one replies with an ARP_PDU, known as ARP Reply, to report its IP and physical addresses.

– It is only received by the device which sent the ARP Request.» When ARP requests services to the link layer to send this ARP_PDU, it indicates that destination

physical address is the one which it has just added in its arp cache (inside the L_ICI of the L_IDU).

Data Link Layer

Page 39: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

5-40Data Link Layer

Example, Ethernet ARP

B

140.168.1.100:0C:01:00:01:0B

00:0C:01:00:01:0A140.168.1.2

C

00:0C:01:00:01:0C140.168.1.4

A

00:0C:01:00:01:0D140.168.1.3

arp cache A

IP address MAC address Timestamp

D

arp cache B

IP address MAC address Timestamp

IP in the PC 140.168.1.2 requests to ARP for the MAC address of 140.168.1.1

ARP

MAC

ARP

MAC

ARP

MAC

ARP

MAC

1.- Request sending ARP_PDU request.Encapsulated in MAC_PDU with destination MAC FF:FF:FF:FF:FF:FF.

2.- Request sending ARP_PDU reply.Encapsulated in MAC_PDU with destination MAC 00:0C:01:00:01:0A.

X X

140.168.1.2 00:0C:01:00:01:0A 4 140.168.1.1 00:0C:01:00:01:0B 5

Page 40: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

5-41Data Link Layer

Internet network layer

routingtable

IP protocol (RFC 791)•addressing conventions•Datagram (N_PDU) format•Forwarding N_PDU

ICMP protocol•error reporting•router “signaling”

Transport layer: TCP, UDP

Link layer

physical layer

Networklayer

ARP protocol• Mapping physical addr and IP addr

Routing protocols•path selection•RIP, OSPF, BGP

ARP cache

Page 41: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

Data-Link Layer

5.1 Introduction and services5.2 Data Link layer functions5.3 Local Area Networks (LAN)

MAC address Ethernet (802.3) Link-layer switches

5.5 ARP protocol5.6 Example

Data Link Layer 5-42

Page 42: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

5-43Data Link Layer

Network example (I)DB

00:0C:01:00:01:0B

E FE0

E1

00:0C:01:00:01:0A

C

00:0C:01:00:01:0C

E0 E1

A

E2

00:0C:01:00:01:0D

E2

E3

SW1

SW2

E0

00:0C:01:00:01:0F

E1

00:0C:01:00:01:0E

How many bandwidth domains are there? And broadcast domains?

What is the rate (R) for each link? If classless addressing is used, how

many bits, at least, are necessary to identify a host in every logical network?

Is it possible to address this network from the CIDR block 193.198.25.0/28?

If all devices are unconfigured and they are just turned on, what is the content of the switching table, routing table and arp cache of every device?

00:0C:01:00:01:E0

00:0C:01:00:01:E1

Page 43: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

5-44Data Link Layer

Network example (II)DB

00:0C:01:00:01:0B193.198.25.1/29

E FE0

E1

00:0C:01:00:01:0A193.198.25.18/29

C

00:0C:01:00:01:0C193.198.25.19/29

E0 E1

A

E2

00:0C:01:00:01:0D193.198.25.3/29

E2

E3

SW1

SW2

E0

00:0C:01:00:01:0F193.198.25.4/29

E1

00:0C:01:00:01:0E193.198.25.2/29

Which netmask has been configured in PC A?

Which default router has been configured in PC F?

If no traffic has been generated yet inside the network, which is the content of switching table, routing table and arp cache of every device?

00:0C:01:00:01:E0193.198.25.5/29

00:0C:01:00:01:E1193.198.25.17/29

Page 44: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

5-45Data Link Layer

Network example (III)DB

00:0C:01:00:01:0B193.198.25.1/29

E FE0

E1

00:0C:01:00:01:0A193.198.25.18/29

C

00:0C:01:00:01:0C193.198.25.19/29

E0 E1

A

E2

00:0C:01:00:01:0D193.198.25.3/29

E2

E3

SW1

SW2

E0

00:0C:01:00:01:0F193.198.25.4/29

E1

00:0C:01:00:01:0E193.198.25.2/29

00:0C:01:00:01:E0193.198.25.5/29

00:0C:01:00:01:E1193.198.25.17/29

All devices arp cache

IP address MAC address Timestamp

Switches switching table

Interface MAC Timestamp

RT Router

Network Next hop Interface

193.198.25.0/29 - E0

193.198.25.16/29 - E1

RT Host Network 193.198.25.0/29

Network Next hop Interface

193.198.25.0/29 - E

0.0.0.0/0 193.198.25.5 E

RT Host Network 193.198.25.16/29

Network Next hop Interface

193.198.25.16/29 - E

0.0.0.0/0 193.198.25.17 E

Page 45: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

5-46Data Link Layer

Network example (IV)DB

00:0C:01:00:01:0B193.198.25.1/29

E FE0

E1

00:0C:01:00:01:0A193.198.25.18/29

C

00:0C:01:00:01:0C193.198.25.19/29

E0 E1

A

E2

00:0C:01:00:01:0D193.198.25.3/29

E2

E3

SW1

SW2

E0

00:0C:01:00:01:0F193.198.25.4/29

E1

00:0C:01:00:01:0E193.198.25.2/29

00:0C:01:00:01:E0193.198.25.5/29

00:0C:01:00:01:E1193.198.25.17/29

Sucessful connectivity test from 193.198.25.18 to 193.198.25.19.

Which is the content of the switching table and cache arp of every device after the connectivity test?

Remember

Page 46: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

5-47Data Link Layer

Network example (V)DB

00:0C:01:00:01:0B193.198.25.1/29

E FE0

E1

00:0C:01:00:01:0A193.198.25.18/29

C

00:0C:01:00:01:0C193.198.25.19/29

E0 E1

A

E2

00:0C:01:00:01:0D193.198.25.3/29

E2

E3

SW1

SW2

E0

00:0C:01:00:01:0F193.198.25.4/29

E1

00:0C:01:00:01:0E193.198.25.2/29

00:0C:01:00:01:E0193.198.25.5/29

00:0C:01:00:01:E1193.198.25.17/29

arp cache A

IP address MAC address Timestamp

193.198.25.19 00:0C:01:00:01:0C 2

SW2 switching table

Interface MAC Timestamp

E0 00:0C:01:00:01:0A 3

E1 00:0C:01:00:01:0C 5

SW1 switching table

Interface MAC Timestamp

arp cache C

IP address MAC address Timestamp

193.198.25.18 00:0C:01:00:01:0A 4

Page 47: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

5-48Data Link Layer

Network example (VI)DB

00:0C:01:00:01:0B193.198.25.1/29

E FE0

E1

00:0C:01:00:01:0A193.198.25.18/29

C

00:0C:01:00:01:0C193.198.25.19/29

E0 E1

A

E2

00:0C:01:00:01:0D193.198.25.3/29

E2

E3

SW1

SW2

E0

00:0C:01:00:01:0F193.198.25.4/29

E1

00:0C:01:00:01:0E193.198.25.2/29

00:0C:01:00:01:E0193.198.25.5/29

00:0C:01:00:01:E1193.198.25.17/29

Sucessful connectivity test from 193.198.25.19 to 193.198.25.4. Let’s suppose an idle period in

the network. arp cache and switching

table are empty.

Which is the content of the switching table and cache arp of each device after the connectivity test?

Page 48: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

5-49Data Link Layer

Network example (VII)DB

00:0C:01:00:01:0B193.198.25.1/29

E FE0

E1

00:0C:01:00:01:0A193.198.25.18/29

C

00:0C:01:00:01:0C193.198.25.19/29

E0 E1

A

E2

00:0C:01:00:01:0D193.198.25.3/29

E2

E3

SW1

SW2

E0

00:0C:01:00:01:0F193.198.25.4/29

E1

00:0C:01:00:01:0E193.198.25.2/29

00:0C:01:00:01:E0193.198.25.5/29

00:0C:01:00:01:E1193.198.25.17/29

arp cache router

IP address MAC address Timestamp

193.198.25.19 00:0C:01:00:01:0C 7

193.198.25.4 00:0C:01:00:01:0F 3

SW2 switching table

Interface MAC Timestamp

E1 00:0C:01:00:01:0C 2

E2 00:0C:01:00:01:E1 8

SW1 switching table

Interface MAC Timestamp

E1 00:0C:01:00:01:0F 6

E3 00:0C:01:00:01:E0 4

arp cache C

IP address MAC address Timestamp

193.198.25.17 00:0C:01:00:01:E1 1

arp cache F

IP address MAC address Timestamp

193.198.25.5 00:0C:01:00:01:E0 5

Page 49: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

Unit 5: Summary Principles behind data link layer services:

error control (detection, correction) medium access control in multipoint links physical addressing

Example, LAN Ethernet switch LAN

ARP protocol

5-50Data Link Layer

Page 50: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

What is missing? Complete last level of the layer architecture.

Physical layer issues. Some topics that have not been studied:

Routing algorithms DNS Email… ... and more... You may study them in other subjects!!!

• wireless• multimedia• multicast• security • network management• network design

5-51Data Link Layer

Page 51: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

PROBLEMS AND EXERCISES

Computer Networking – Unit 5: Data Link layer

Departamento deTecnología Electrónica

Data Link Layer 5 - 52

Page 52: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

Pr1

Data Link Layer 5-53

Consider the network in the figure. Initially, bridges P1 and P2 have empty switching tables. Indicate, for the following frame sequence (in order), in which collision domains are the frames visible (including source), and the content of the switching tables in the brigdes.

a)Frame with source host A and destination host B.b)Frame with source host D and destination host A.c)Frame with source host B and destination host D.

Page 53: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

Pr2

Data Link Layer 5-54

Consider the network in the figure (Ethernet/802.3). Initially, all thebridges have empty switching tables. Questions a) to c) indicate the send of particular frames that make up a sequence. Indicate in which collision domains are the frames visible (including source), and the content of the tables in the brigdes.

a)Frame with source host A and destination host E.b)Frame with source host C and destination host A.c)Frame with source host D and destination host C.

C1 C2

C3

C4

C5

Page 54: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

Pr3

Data Link Layer 5-55

Consider the network in the figure. Initially, all the bridges have empty switching tables.

a)Indicate the existing collision domains.b)Indicate, for the following frame sequence (in order), in which collision domain are the frames visible (including source), and the content of the switching tables for all bridges:

1. A sends a frame to B.2. G sends a frame to A.3. D sends a frame to G.

C1

C2 C3

C4 C5

Page 55: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

Pr4

Data Link Layer 5-56

Consider the network in the figure. Method to map 3-layer and 2-layer addresses is similar to ARP. All routers have their routing tables configured in a correct way. Also consider the next frame format: {Destination_MAC_addr, Source_MAC_addr,[Destination_Network_addr, Source_Network_addr, TRANSPORT_DATA]}

To map the addresses, the following frame format is used:

{Dest_MAC_addr, Source_MAC_addr, [ Who is Net_addr? ] -> Request{Dest_MAC_addr, Source_MAC_addr, [ Net_addr is in MAC_addr] -> Response

Suppose that no frame was sent in theNetwork before. Answer these questions reasonably:a)Indicate the frame sequence (using the indicated format) to send a datagram from A .3 to A.2.b)Repeat a) considering that A.3 sends a frame to C.2.c)Indicate if it is possible to send the following frame, and which network/s would it be visible for?

{ Broadcast, MAC_A2, [ Who is C.3? ] }

Page 56: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

Pr5

Data Link Layer 5-57

Consider three LAN, interconnected by two routers, as it is shown in the figure:

a)Assign IP addresses to all interfaces. For Subnet 1, use 192.168.1.X addresses; for subnet 2, use 192.168.2.X addresses; and for subnet 3, use 192.168.3.X addresses.b)Assign MAC addresses to all adapters .c)Consider an IP datagram that is sent from host E to host B. Suppose all ARP tables are updated. List all steps.d)Repeat question c) supposing that ARP table of the sender host is empty (and the rest are updated).e)Repeat the problem distributing subnets if CIDR block assigned is 192.168.1.0/27.

R1

B

A

R2

D

C

F

E

Subnet 1 Subnet 2 Subnet 3

Page 57: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

Pr6

Data Link Layer 5-58

Consider the figure of the previous problem. Now, replace router R1 by a switch (S1).a)Consider an IP datagram that is sent from host E to host F. Will host E ask the router R2 to forward the datagram? Why? In the Ethernet frame that carries the IP datagram, what are the source and destination IP and MAC addresses?b)Suppose that E wants to send an IP datagram to B. Suppose that the ARP cache of E is empty. Will E do an ARP request to find out the MAC address of B? Why? In the Ethernet frame (that carries the IP datagram whose destination is B) that is delivered to the router R2, what are the source and destination IP and MAC addresses?c)Suppose that host A wants to send an IP datagram to host B. Neither ARP cache of A contains the MAC address of B nor ARP cache of B contains MAC address of A. Suppose also that the switching table of S1 contains entries only for host B and router R2. Is A sending an ARP request? What will S1 do when it receives the ARP request? Will router R2 receive this ARP request? If so, will R2 forward the message to subnet 3? When host B receives this ARP request, it returns an ARP response to host A. Does it send an ARP request to ask the MAC address of A? Why? What will S1 do when it receives the ARP response from host B?

Page 58: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

Pr7

Data Link Layer 5-59

Consider the previous problem but replace router R2 by a switch (S1).

Answer the questions a), b) and c) of the previous problem in this new context.

R1

B

A

D

C

F

E

Subred 1 Subred 2 Subred 3

Page 59: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

Pr8

Data Link Layer 5-60

For the figure, consider the CIDR block 193.98.3.0/27 and suppose all ARP cache of all nodes have been filled manually.

Assign MAC and IP addresses to: host A, both routers and host F. Suppose that host A sends a datagram to host F. Indicate source and destination MAC addresses contained in the frame that encapsulates this IP datagram, as the frame is being transmitted:a)From A to router R1b)From router R1 to router R2 andc)From router R2 to host F. Indicate also source and destination IP addresses of the IP datagram encapsulated inside the frame.

R1

B

A

R2

D

C

F

E

Subred 1 Subred 2 Subred 3

Page 60: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

Pr9

Data Link Layer 5-61

Suppose now that router R1 in the figure of the previous problem is replaced by a switch. Hosts A, B, C and D and router R2 are connected to this switch using a star configuration. a) Is it necessary to change host A configuration? If so, point out the new

configuration. b) Is it necessary to configure all the interfaces of SW1? Why? If so, point out

the new configuration. c) Indicate source and destination MAC addressess contained in the frame that

encapsulates this IP datagram, as the frame is being transmitted:- From A to the switch- From the switch to router R2- From router R2 to host F. Indicate source and destination IP addresses contained

in the IP datagram encapsulated inside the frame.

Page 61: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

5-62

Example 1 (I) How many bandwidth domains are there? F sends a MAC_PDU to A . “Who” receives and processes it? A minute later C sends a MAC_PDU to F. “Who” receives and processes

it? Two minutes later F sends a MAC_PDU with broadcast MAC as

destination. “Who” receives and processes it?

Data Link Layer

Interface MAC TIME

E3 00:0C:01:00:01:0F 5

E1 00:0C:01:00:01:0C 3

00:0C:01:00:01:0A

C

00:0C:01:00:01:0C

00:0C:01:00:01:0E00:0C:01:00:01:0F

E0 E1

E

A

FE2 E3

Page 62: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

5-63

Example 2 (II) F sends a MAC_PDU to B. “Who” receives and processes it?

Data Link Layer

DB

00:0C:01:00:01:0B

00:0C:01:00:01:0F

Switch 2

Interfaz MAC TIEMPO

E1 00:0C:01:00:01:0C 5

E FE0 E1

00:0C:01:00:01:0A

C

00:0C:01:00:01:0C

E0 E1

A

E2

00:0C:01:00:01:0D

E2

E3SW1

SW2

Switch 1

Interfaz MAC TIEMPO

E2 00:0C:01:00:01:0B 4

E1 00:0C:01:00:01:0F 5

Page 63: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

5-64

Example 2 (III)

Data Link Layer

DB

00:0C:01:00:01:0B

00:0C:01:00:01:0F

Switch 2

Interfaz MAC TIEMPO

E1 00:0C:01:00:01:0C 4

E2 00:0C:01:00:01:0D 5

E FE0 E1

00:0C:01:00:01:0A

C

00:0C:01:00:01:0C

E0 E1

A

E2

00:0C:01:00:01:0D

E2

E3SW1

SW2

Switch 1

Interface MAC TIME

E2 00:0C:01:00:01:0B 3

E1 00:0C:01:00:01:0 4

E2 00:0C:01:00:01:0D 5

One minute later D sends a MAC_PDU to C. “Who” receives and processes it?

Page 64: Chapter 5 The Data Link Layer Departamento de Tecnología Electrónica Computer Networking Some of these slides are given as material with copyright from:

5-65Data Link Layer

DB

00:0C:01:00:01:0B

00:0C:01:00:01:0F

Switch 2

Interface MAC TIME

E1 00:0C:01:00:01:0C 1

E2 00:0C:01:00:01:0D 2

E2 00:0C:01:00:01:0E 5

E FE0 E1

00:0C:01:00:01:0A

C

00:0C:01:00:01:0C

E0 E1

A

E2

00:0C:01:00:01:0D

E2

E3SW1

SW2

Switch 1

Interface MAC TIME

E1 00:0C:01:00:01:0F 4

E2 00:0C:01:00:01:0D 2

E0 00:0C:01:00:01:0E 5

Three minutes later E sends a MAC_PDU with broadcast MAC as destination. “Who” receives and processes it?

00:0C:01:00:01:0E

Example 2 (IV)