You are on page 1of 37

CS 342: LAN SWITCHING: ETHERNET

SWITCHING
 An Ethernet switch is Layer 2 device (Link layer
device)
 Learns MAC addresses of devices attached to each
port
 Each switch port is a collision domain
 More collision domains BUT smaller collision
domains
 Broadcasts still sent out of every port
 Each switch port has dedicated bandwidth
 100% bandwidth available

1
CS 342: LAN SWITCHING: ETHERNET
SWITCHING

 When only one node is connected to a switch port,


the collision domain on the shared media contains
only two nodes.

 The two nodes in this small segment, or collision


domain, consist of the switch port and the host
connected to it.

 These small physical segments are called micro


segments.

2
CS 342: LAN SWITCHING: ETHERNET
SWITCHING
 stores and forwards Ethernet frames

 examines frame header and selectively forwards


frame based on MAC dest address

 when frame is to be forwarded on segment, uses


CSMA/CD to access segment

3
CS 342: LAN SWITCHING: ETHERNET SWITCHING -
FORWARDING

switch
1
2 3

hub
hub hub

• How do determine onto which LAN segment to


forward frame?
• Looks like a routing problem...
4
CS 342: LAN SWITCHING: ETHERNET SWITCHING-
SELF LEARNING

• A switch has a switch table


• entry in switch table:
– (MAC Address, Interface, Time Stamp)
– stale entries in table dropped (TTL can be 60 min)
• switch learns which hosts can be reached through
which interfaces
– when frame received, switch “learns” location of
sender: incoming LAN segment
– records sender/location pair in switch table

5
CS 342: LAN SWITCHING: ETHERNET
SWITCHING
Filtering /Forwarding
When switch receives a frame:

index switch table using MAC dest address


if entry found for destination
then{
if dest on segment from which frame arrived
then drop the frame
else forward the frame on interface indicated
}
else flood

forward on all but the interface


on which the frame arrived

6
CS 342: LAN SWITCHING: ETHERNET
SWITCHING Forwarding Broadcasts and
Multicasts
• Broadcast frames

– Frames sent to a destination MAC address of


FFFF.FFFF.FFFF, such frames should be delivered to
all devices on the same LAN

• Multicast frames
– Frames sent to one of a range of multicast MAC
addresses (e.g. begin with 0100.5E or 0100.5F, such
frames should be delivered to multiple devices on the
LAN, but not necessarily to all devices

7
CS 342: LAN SWITCHING: ETHERNET
SWITCHING
SWITCH EXAMPLE
Suppose C sends frame to D

switch address interface


1 A 1
2 3
B 1
E 2
hub hub hub G 3
A
I
D F
B C G H
E

• Switch receives frame from from C


– notes in bridge table that C is on interface 1
– because D is not in table, switch forwards frame into interfaces 2
and 3
• frame received by D
8
CS 342: LAN SWITCHING: ETHERNET
SWITCHING
SWITCH EXAMPLE
Suppose D replies back with frame to C.

address interface
switch
A 1
B 1
E 2
hub hub hub G 3
A
I C 1

D F
B C G H
E

• Switch receives frame from from D


– notes in bridge table that D is on interface 2
– because C is in table, switch forwards frame only to interface 1
• frame received by C

9
CS 342: LAN SWITCHING: ETHERNET
SWITCHING
LAN SWITCH OPERATION
When a switch starts up it sends a broadcast out
of all ports to learn host MAC addresses
When a frame is received for an unknown
destination a broadcast is sent to discover
Addresses are added to a switching table mapping
them to the port on which they were learned
When a frame is received for a known destination
it is switched to the appropriate port

10
CS 342: LAN SWITCHING: ETHERNET
SWITCHING
LAN SWITCH OPERATION
 Switches
contain RAM – known as
CAM “Content Addressable Memory”
Stores MAC address table
Used as frame buffer
Used to queue frames in asymmetric
switching – switch ports operating at
different speeds e.g. 10 and 100 Mbps

11
CS 342: LAN SWITCHING: ETHERNET
SWITCHING
Securing Switch Ports
• Configure a permanent MAC address

– Does not have a TTL

• Define a static map entry


– Restricts communication between specific ports

• Set a limit on the number of MAC addresses

• Define the action when a security violation occurs

12
CS 342: LAN SWITCHING: ETHERNET
SWITCHING
LAN SWITCH OPERATION
 Symmetric switching provides switching between like
bandwidths

 Multiple simultaneous conversations increase throughput

 Asymmetric provides switching between unlike bandwidths

 Requires the switch to use memory buffering

13
CS 342: LAN SWITCHING: ETHERNET
SWITCHING
Ethernet MAC Frame Format
• Preamble: 7-octet pattern of 0s &1s used to establish
bit synchronization.

• Start Frame Delimiter (SFD): Indicates actual start of


frame.

• Destination Address (DA): Specifies the station(s) for


which the frame is intended

• Source Address (SA): Specifies the station that sent


the frame.

14
CS 342: LAN SWITCHING: ETHERNET
SWITCHING
Ethernet MAC Frame Format
• Length: Length of LLC data field in octets.

• LLC Data: Data unit supplied by LLC.

• Pad: Octets added to ensure that the frame is long


enough for proper CD operation.

• Frame Check Sequence (FCS): A 32-bit CRC, based on


all fields except preamble, SFD, and FCS.

15
CS 342: LAN SWITCHING: ETHERNET
SWITCHING
Ethernet MAC Frame

16
CS 342: LAN SWITCHING: ETHERNET
SWITCHING
Switching Methods
Four methods for processing and forwarding frames

• Store and Forward


– Entire frame received before forwarding takes place
– causes more latency but error detection is high

• Fragment-free

– Reads first 64 bytes


– Lower latency than store-and-forward
– Also known as “modified cut-through”
– Minor error detection
17
CS 342: LAN SWITCHING: ETHERNET
SWITCHING
Switching Methods

• Cut-through
– Forwards frame after destination MAC is read
– First 14 bytes of frame
– Lowest latency
– No error detection

• Adaptive cut-through
– Error sensing
– Uses cut-through and store-and-forward

18
CS 342: LAN SWITCHING: ETHERNET
SWITCHING
Switching Methods

19
CS 342: LAN SWITCHING: ETHERNET
SWITCHING
Switching Methods

20
CS 342: LAN SWITCHING: ETHERNET
SWITCHING
Switching Methods

21
CS 342: LAN SWITCHING: ETHERNET
SWITCHING
Switching Methods-Summary
Cut-through Switching
• Fast-forward – as soon as destination address is read switching
starts

Increased Latency
• Fragment-free – after 64 bytes have been received (minimum
valid frame size) frame is switched

Store & Forward Switching


• Entire frame is received before switching

22
CS 342: LAN SWITCHING: ETHERNET
SWITCHING
Buffering
• Two methods
– Port-based
• Packets stored in queues that are linked to incoming
ports – packets forwarded when queue is clear
– Shared Memory buffering
• Deposits all packets into common memory buffer
shared by all ports
– Dynamic location assigns port areas
– Switch maintains a map of ports and clears when
packet is switched

23
CS 342: LAN SWITCHING: ETHERNET
SWITCHING Transmission Time & Latency
 Bit time – time taken to recognise 1 bit
 Minimum frame size - 64 bytes – 512 bits
 Maximum frame size – 1518 bytes – 12,144 bits
 Transmission time is always 512 bit times
 10Mbps – 64 byte frame - 51,200 ns (100ns bit time)
 100Mbps – 64 byte frame 5,120 ns (10 ns bit time)
 1000Mbps – 64 byte frame – 512 ns (1ns bit time)

 Times above do not include


 Time taken to propagate signal along medium
 Delays introduced by hubs/switches/routers/NICs etc

24
CS 342: LAN SWITCHING: ETHERNET
SWITCHING
Types of Transmission
Half-duplex Full duplex
• Host checks medium for • Host can transmit
signal – if clear host immediately
transmits
• Only 1 host can transmit at • 2 hosts can transmit
a time simultaneously
• Collisions – jam signal • No collisions
generated, back-off • 100% bandwidth
algorithm before available
retransmission
• 50-60% bandwidth • Requires dedicated
available connection to a
switchport

25
CS 342: LAN SWITCHING: ETHERNET
SWITCHING
Half Duplex or Duplex
• Ethernet LANs are half-duplex technology
• Full-duplex Ethernet allows the transmission of a
packet and the reception of a different packet at
the same time – requires full duplex NIC card

– This simultaneous transmission and reception


requires the use of two pairs of wires in the
cable and a switched connection between each
node. This connection is considered point-to-
point and is collision free.

26
CS 342: LAN SWITCHING: ETHERNET
SWITCHING
Half Duplex or Duplex
• Because both nodes can transmit and receive at
the same time, there are no negotiations for
bandwidth.

• Full-duplex Ethernet can use an existing shared


medium as long as the medium meets minimum
Ethernet standards. Requires 2 pairs of wires
and switched connection

27
CS 342: LAN SWITCHING: ETHERNET
SWITCHING
Benefit of Full Duplex
• Ethernet usually can only use 50%-60% of the 10-Mbps
available bandwidth because of collisions and latency.
• Full-duplex Ethernet offers 100% of the bandwidth in both
directions.
• This produces a potential 20-Mbps throughput- 10-Mbps
TX and 10-Mbps RX.
• Remember – Transmit connects to Receive
– Think SIMPLE LAN

28
CS 342: LAN SWITCHING: ETHERNET
SWITCHING
Full Duplex
In a network that uses twisted-pair cabling, one pair is used to carry the
transmitted signal from one node to the other node.

A separate pair is used for the return or received signal.

It is possible for signals to pass through both pairs simultaneously.

The ability to communicate in both directions at once is known as full


duplex.
In full duplex mode, there is no
contention for the media.

A collision domain no longer


exists.
In theory, the bandwidth is
doubled when full duplex is used.
29
CS 342: LAN SWITCHING: ETHERNET
SWITCHING Network Latency

Latency is the delay between the time a frame begins to leave the source
device and when the first part of the frame reaches its destination.

Media delays may be caused by the finite speed that signals can
travel through the physical media.

Circuit delays may be caused by the electronics that process the


signal along the path.

Software delays may be caused by the decisions that software must


make to implement switching and protocols.

Delays may be caused by the content of the frame and the location of
the frame switching decisions. For example, a device cannot route a
frame to a destination until the destination MAC address has been
read.
30
CS 342: LAN SWITCHING: ETHERNET
SWITCHING
Auto-negotiation
Auto-negotiation allows devices to select the most
optimal way to communicate without the user having to
configure the devices.

If a manually configured device is attached to an auto-


negotiation device there can be problems which result
in a high rate of CRC errors.

While all 100 Mbps devices are required to support


auto-negotiation, most existing 10 Mbps devices do not.

31
CS 342: LAN SWITCHING: ETHERNET
SWITCHING Advantages of Switched Hubs
• No modifications needed to workstations when replacing
shared-medium hub

• Each device has a dedicated capacity equivalent to entire


LAN

• Easy to attach additional devices to the network

32
CS 342: LAN SWITCHING: ETHERNET
SWITCHING Differences Between Switched Hubs
and Bridges
• Bridge frame handling is done in software. A layer 2 switch
performs the address recognition and frame forwarding
functions in hardware.

• Bridges typically only analyze and forward one frame at a


time; a layer 2 switch can handle multiple frames at a time.

• Bridges uses store-and-forward operation; layer 2


switches use cut-through instead of store-and-forward
operation

33
CS 342: LAN SWITCHING: ETHERNET
SWITCHING Differences Between Switched
Hubs and Bridges

• New installations typically include layer 2 switches with


bridge functionality rather than bridges.

34
CS 342: LAN SWITCHING: ETHERNET
SWITCHING
Problems With Layer 2 Switches
• Broadcast overload

• Lack of multiple links

• Can be solved with subnetworks connected by routers

• However, high-speed LANs layer 2 switches process


millions of packets per second whereas a software-based
router may only be able to handle well under a million
packets per second

35
CS 342: LAN SWITCHING: ETHERNET
SWITCHING
Layer 3 Switches
• Implement the packet-forwarding logic of the router in
hardware.
• Packet-by-packet switch operates like a traditional router
– Forwarding logic is in hardware
– Achieves an order of magnitude increase in performance
compared to software-based routers
• Flow-based switch identifies flows of IP packets that have the
same source and destination
– Once flow is identified, a predefined route can be established
to speed up the forwarding process
– Again, huge performance increases over a pure software-
based router are achieved

36
CS 342: LAN SWITCHING: ETHERNET
SWITCHING

37