Lecture 03 Data Link Layer - Switching

Download as pdf or txt
Download as pdf or txt
You are on page 1of 38

Lecture 3: Data Link Layer -

Switching
Outline
Topic Title Topic Objective
Purpose of the Data Link Layer Describe the purpose and function of the data link layer
in preparing communication for transmission on specific
media.

Data Link Frame Describe the characteristics and functions of the data
link frame.

Explain how the Ethernet sublayers are related


Ethernet Frame
to the frame fields.

Ethernet MAC Address Describe the Ethernet MAC address.

Explain how a switch builds its MAC address


The MAC Address Table
table and forwards frames.

Describe switch forwarding methods and port


Switch Speeds and Forwarding Methods
settings available on Layer 2 switch ports.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 2
Purpose of the Data Link
Layer

© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 3
Purpose of the Data Link Layer
The Data Link Layer
• The Data Link layer is responsible for
communications between end-device
network interface cards.
• It allows upper layer protocols to access
the physical layer media and
encapsulates Layer 3 packets (IPv4
and IPv6) into Layer 2 Frames.
• It also performs error detection and
rejects corrupts frames.

© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 4
Purpose of the Data Link Layer
IEEE 802 LAN/MAN Data Link Sublayers
IEEE 802 LAN/MAN standards are specific to
the type of network (Ethernet, WLAN, WPAN,
etc).

The Data Link Layer consists of two


sublayers. Logical Link Control (LLC) and
Media Access Control (MAC).
• The LLC sublayer communicates
between the networking software at the
upper layers and the device hardware at
the lower layers.
• The MAC sublayer is responsible for
data encapsulation and media access
control.

© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 5
Purpose of the Data Link Layer
Data Link Layer Standards
Data link layer protocols are
defined by engineering
organizations:
• Institute for Electrical and
Electronic Engineers (IEEE).
• International Telecommunications
Union (ITU).
• International Organizations for
Standardization (ISO).
• American National Standards
Institute (ANSI).

© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 7
Half and Full Duplex Communication

Half-duplex communication
• Only allows one device to send or receive at a time on a shared medium.
• Used on WLANs and legacy bus topologies with Ethernet hubs.

Full-duplex communication
• Allows both devices to simultaneously transmit and receive on a shared medium.
• Ethernet switches operate in full-duplex mode.

© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 8
Access Control Methods

Contention-based access
All nodes operating in half-duplex, competing for use of the medium. Examples are:
• Carrier sense multiple access with collision detection (CSMA/CD) as used on legacy
bus-topology Ethernet.
• Carrier sense multiple access with collision avoidance (CSMA/CA) as used on
Wireless LANs.

Controlled access
• Deterministic access where each node has its own time on the medium.
• Used on legacy networks such as Token Ring and ARCNET.

© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 9
Contention-Based Access – CSMA/CD

CSMA/CD
• Used by legacy Ethernet LANs.
• Operates in half-duplex mode where only one device sends or receives at a time.
• Uses a collision detection process to govern when a device can send and what
happens if multiple devices send at the same time.

CSMA/CD collision detection process:


• Devices transmitting simultaneously will result in a signal collision on the shared
media.
• Devices detect the collision.
• Devices wait a random period of time and retransmit data.

© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 10
Contention-Based Access – CSMA/CA

CSMA/CA
• Used by IEEE 802.11 WLANs.
• Operates in half-duplex mode where only one device sends or receives at a time.
• Uses a collision avoidance process to govern when a device can send and what
happens if multiple devices send at the same time.

CSMA/CA collision avoidance process:


• When transmitting, devices also include the time duration needed for the
transmission.
• Other devices on the shared medium receive the time duration information and know
how long the medium will be unavailable.

© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 11
Data Link Frame

© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 12
Data Link Frame
The Frame
Data is encapsulated by the data link layer with a header and a trailer to form a frame.
A data link frame has three parts:
• Header
• Data
• Trailer
The fields of the header and trailer vary according to data link layer protocol.

The amount of control information carried with in the frame varies according to access
control information and logical topology.

© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 13
Data Link Frame
Frame Fields

Field Description
Frame Start and Stop Identifies beginning and end of frame
Addressing Indicates source and destination nodes
Type Identifies encapsulated Layer 3 protocol
Control Identifies flow control services
Data Contains the frame payload
Error Detection Used for determine transmission errors

© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 14
Data Link Frame
Layer 2 Addresses
• Also referred to as a physical address.
• Contained in the frame header.
• Used only for local delivery of a frame on the link.
• Updated by each device that forwards the frame.

© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 15
Data Link Frame
LAN and WAN Frames

The logical topology and physical media determine the data link
protocol used:
• Ethernet
• 802.11 Wireless
• Point-to-Point (PPP)
• High-Level Data Link Control (HDLC)
• Frame-Relay

Each protocol performs media access control for specified logical


topologies.

© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 16
Switching

© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 17
Module Objectives
Module Title: Ethernet Switching

Module Objective: Explain how Ethernet works in a switched network.

Topic Title Topic Objective

Explain how the Ethernet sublayers are related to the frame


Ethernet Frame
fields.

Ethernet MAC Address Describe the Ethernet MAC address.

Explain how a switch builds its MAC address table and


The MAC Address Table
forwards frames.
Describe switch forwarding methods and port settings
Switch Speeds and Forwarding Methods
available on Layer 2 switch ports.

© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 18
Ethernet MAC Address

© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 25
Ethernet MAC Addresses
MAC Address and Hexadecimal

• An Ethernet MAC address consists of a 48-bit binary value, expressed using 12


hexadecimal values.
• Given that 8 bits (one byte) is a common binary grouping, binary 00000000 to
11111111 can be represented in hexadecimal as the range 00 to FF,
• When using hexadecimal, leading zeroes are always displayed to complete the 8-bit
representation. For example the binary value 0000 1010 is represented in hexadecimal
as 0A.
• Hexadecimal numbers are often represented by the value preceded by 0x (e.g., 0x73)
to distinguish between decimal and hexadecimal values in documentation.
• Hexadecimal may also be represented by a subscript 16, or the hex number followed
by an H (e.g., 73H).

© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 26
Ethernet MAC Addresses
Ethernet MAC Address
• In an Ethernet LAN, every network device is connected to the same, shared media. MAC
addressing provides a method for device identification at the data link layer of the OSI
model.
• An Ethernet MAC address is a 48-bit address expressed using 12 hexadecimal digits.
Because a byte equals 8 bits, we can also say that a MAC address is 6 bytes in length.
• All MAC addresses must be unique to the Ethernet device or Ethernet interface. To ensure
this, all vendors that sell Ethernet devices must register with the IEEE to obtain a unique 6
hexadecimal (i.e., 24-bit or 3-byte) code called the organizationally unique identifier (OUI).
• An Ethernet MAC address consists of a 6 hexadecimal vendor OUI code followed by a 6
hexadecimal vendor-assigned value.

© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 27
Ethernet MAC Addresses
Frame Processing
• When a device is forwarding a message to an Ethernet
network, the Ethernet header include a Source MAC
address and a Destination MAC address.
• When a NIC receives an Ethernet frame, it examines the
destination MAC address to see if it matches the physical
MAC address that is stored in RAM. If there is no match, the
device discards the frame. If there is a match, it passes the
frame up the OSI layers, where the de-encapsulation
process takes place.
Note: Ethernet NICs will also accept frames if the destination MAC
address is a broadcast or a multicast group of which the host is a
member.
• Any device that is the source or destination of an Ethernet
frame, will have an Ethernet NIC and therefore, a MAC
address. This includes workstations, servers, printers,
mobile devices, and routers.

© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 28
Ethernet MAC Addresses
Unicast MAC Address
In Ethernet, different MAC addresses are
used for Layer 2 unicast, broadcast, and
multicast communications.
• A unicast MAC address is the unique
address that is used when a frame is sent
from a single transmitting device to a
single destination device.
• The process that a source host uses to
determine the destination MAC address
associated with an IPv4 address is known
as Address Resolution Protocol (ARP).
The process that a source host uses to
determine the destination MAC address
associated with an IPv6 address is known
as Neighbor Discovery (ND).
Note: The source MAC address must always
be a unicast.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 29
Ethernet MAC Addresses
Broadcast MAC Address
An Ethernet broadcast frame is received and
processed by every device on the Ethernet LAN.
The features of an Ethernet broadcast are as
follows:
• It has a destination MAC address of FF-FF-FF-
FF-FF-FF in hexadecimal (48 ones in binary).
• It is flooded out all Ethernet switch ports except
the incoming port. It is not forwarded by a
router.
• If the encapsulated data is an IPv4 broadcast
packet, this means the packet contains a
destination IPv4 address that has all ones (1s)
in the host portion. This numbering in the
address means that all hosts on that local
network (broadcast domain) will receive and
process the packet.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 30
Ethernet MAC Addresses
Multicast MAC Address
An Ethernet multicast frame is received and processed by a group of
devices that belong to the same multicast group.
• There is a destination MAC address of 01-00-5E when the
encapsulated data is an IPv4 multicast packet and a
destination MAC address of 33-33 when the encapsulated
data is an IPv6 multicast packet.
• There are other reserved multicast destination MAC
addresses for when the encapsulated data is not IP, such as
Spanning Tree Protocol (STP).
• It is flooded out all Ethernet switch ports except the incoming
port, unless the switch is configured for multicast snooping. It
is not forwarded by a router, unless the router is configured to
route multicast packets.
• Because multicast addresses represent a group of addresses
(sometimes called a host group), they can only be used as the
destination of a packet. The source will always be a unicast
address.
• As with the unicast and broadcast addresses, the multicast IP
address requires a corresponding multicast MAC address.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 31
The MAC Address Table

© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 32
The MAC Address Table
Switch Fundamentals
• A Layer 2 Ethernet switch uses Layer 2 MAC addresses to make forwarding
decisions. It is completely unaware of the data (protocol) being carried in the data
portion of the frame, such as an IPv4 packet, an ARP message, or an IPv6 ND
packet. The switch makes its forwarding decisions based solely on the Layer 2
Ethernet MAC addresses.
• An Ethernet switch examines its MAC address table to make a forwarding decision for
each frame, unlike legacy Ethernet hubs that repeat bits out all ports except the
incoming port.
• When a switch is turned on, the MAC address table is empty

Note: The MAC address table is sometimes referred to as a content addressable memory
(CAM) table.

© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 33
The MAC Address Table
Switch Learning and Forwarding
Examine the Source MAC Address (Learn)
Every frame that enters a switch is checked for new information to learn. It does this by
examining the source MAC address of the frame and the port number where the frame
entered the switch. If the source MAC address does not exist, it is added to the table
along with the incoming port number. If the source MAC address does exist, the switch
updates the refresh timer for that entry. By default, most Ethernet switches keep an entry
in the table for 5 minutes.

Note: If the source MAC address does exist in the table but on a different port, the switch
treats this as a new entry. The entry is replaced using the same MAC address but with the
more current port number.

© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 34
The MAC Address Table
Switch Learning and Forwarding (Contd.)
Find the Destination MAC Address (Forward)
If the destination MAC address is a unicast address, the switch will look for a match
between the destination MAC address of the frame and an entry in its MAC address table.
If the destination MAC address is in the table, it will forward the frame out the specified
port. If the destination MAC address is not in the table, the switch will forward the frame
out all ports except the incoming port. This is called an unknown unicast.

Note: If the destination MAC address is a broadcast or a multicast, the frame is also
flooded out all ports except the incoming port.

© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 35
The MAC Address Table
Filtering Frames
As a switch receives frames from different devices, it is able to populate its MAC address
table by examining the source MAC address of every frame. When the MAC address
table of the switch contains the destination MAC address, it is able to filter the frame and
forward out a single port.

© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 36
The MAC Address Table
Video – MAC Address Tables on Connected Switches

© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 37
Search for:Check Sequence: Detect corrupted data by using CRC
FCS : Frame
FCSFCS : Frame Check
: Frame CheFCS Sequence:
: Frame Check Sequence:Detect
Detect corrupted
corrupted data
data byCRC
by using using CRC
algorithm over algorithm
the received data
over the received CRC: cyclic
dataRedundancy check
ck Sequence: Detect corrupted data by using CRC algorithm over the
CRC: cyclic Redundancy check
received data
CRC: cycl

© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 38
Switch Speeds and
Forwarding Methods

© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 39
Switch Speeds and Forwarding Methods
Frame Forwarding Methods on Cisco Switches
Switches use one of the following forwarding methods for switching data between network ports:
• Store-and-forward switching - This frame forwarding method receives the entire frame and
computes the CRC. If the CRC is valid, the switch looks up the destination address, which
determines the outgoing interface. Then the frame is forwarded out of the correct port.
• Cut-through switching - This frame forwarding method forwards the frame before it is entirely
received. At a minimum, the destination address of the frame must be read before the frame can
be forwarded.

• A big advantage of store-and-forward switching is that it determines if a frame has errors before
propagating the frame. When an error is detected in a frame, the switch discards the frame.
Discarding frames with errors reduces the amount of bandwidth consumed by corrupt data.
• Store-and-forward switching is required for quality of service (QoS) analysis on converged
networks where frame classification for traffic prioritization is necessary. For example, voice over
IP (VoIP) data streams need to have priority over web-browsing traffic.

© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 40
Switch Speeds and Forwarding Methods
Memory Buffering on Switches
An Ethernet switch may use a buffering technique to store frames before forwarding them or when the
destination port is busy because of congestion.
Method Description

•Frames are stored in queues that are linked to specific incoming and outgoing ports.
•A frame is transmitted to the outgoing port only when all the frames ahead in the queue
have been successfully transmitted.
Port-based memory
•It is possible for a single frame to delay the transmission of all the frames in memory
because of a busy destination port.
•This delay occurs even if the other frames could be transmitted to open destination ports.
•Deposits all frames into a common memory buffer shared by all switch ports and the
amount of buffer memory required by a port is dynamically allocated.
Shared memory •The frames in the buffer are dynamically linked to the destination port enabling a packet
to be received on one port and then transmitted on another port, without moving it to a
different queue.

• Shared memory buffering also results in larger frames that can be transmitted with fewer dropped
frames. This is important with asymmetric switching which allows for different data rates on different
ports. Therefore, more bandwidth can be dedicated to certain ports (e.g., server port).
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 42
Switch Speeds and Forwarding Methods
Duplex and Speed Settings
Two of the most basic settings on a switch are the bandwidth (“speed”) and duplex
settings for each individual switch port. It is critical that the duplex and bandwidth settings
match between the switch port and the connected devices.

There are two types of duplex settings used for communications on an Ethernet network:
• Full-duplex - Both ends of the connection can send and receive simultaneously.
• Half-duplex - Only one end of the connection can send at a time.

Autonegotiation is an optional function found on most Ethernet switches and NICs. It


enables two devices to automatically negotiate the best speed and duplex capabilities.

Note: Gigabit Ethernet ports only operate in full-duplex.

© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 43
Switch Speeds and Forwarding Methods
Duplex and Speed Settings
• Duplex mismatch is one of the most common causes of performance issues on
10/100 Mbps Ethernet links. It occurs when one port on the link operates at half-
duplex while the other port operates at full-duplex.
• This can occur when one or both ports on a link are reset, and the autonegotiation
process does not result in both link partners having the same configuration.
• It also can occur when users reconfigure one side of a link and forget to reconfigure
the other. Both sides of a link should have autonegotiation on, or both sides should
have it off. Best practice is to configure both Ethernet switch ports as full-duplex.

© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 44
Switch Speeds and Forwarding Methods
Auto-MDIX
Connections between devices once required the use of either a crossover or straight-
through cable. The type of cable required depended on the type of interconnecting
devices.
Note: A direct connection between a router and a host requires a cross-over connection.

• Most switch devices now support the automatic medium-dependent interface


crossover (auto-MDIX) feature. When enabled, the switch automatically detects the
type of cable attached to the port and configures the interfaces accordingly.
• The auto-MDIX feature is enabled by default on switches running Cisco IOS Release
12.2(18)SE or later. However, the feature could be disabled. For this reason, you
should always use the correct cable type and not rely on the auto-MDIX feature.
• Auto-MDIX can be re-enabled using the mdix auto interface configuration command.

© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 45

You might also like