Layer 2 Switch

29
Layer 2 Switch Layer 2 Switching is hardware based. Uses the host's Media Access Control (MAC) address. Uses Application Specific Integrated Circuits (ASIC) to build and maintain filter tables. Break up Collision domain but don't break up Broadcast domain. Security through VLAN implementation. Cost effective, Low Latency, Wire Speed. Provide dedicated bandwidth to end users. Avoid loops using STP (Spanning Tree Protocol).

description

Layer 2 Switch. Layer 2 Switching is hardware based. Uses the host's Media Access Control (MAC) address. Uses Application Specific Integrated Circuits (ASIC) to build and maintain filter tables. Break up Collision domain but don't break up Broadcast domain. - PowerPoint PPT Presentation

Transcript of Layer 2 Switch

Page 1: Layer 2 Switch

Layer 2 Switch

Layer 2 Switching is hardware based.

Uses the host's Media Access Control (MAC) address.

Uses Application Specific Integrated Circuits (ASIC) to build

and maintain filter tables.

Break up Collision domain but don't break up Broadcast

domain.

Security through VLAN implementation.

Cost effective, Low Latency, Wire Speed.

Provide dedicated bandwidth to end users.

Avoid loops using STP (Spanning Tree Protocol).

Page 2: Layer 2 Switch

Functions of Layer 2 Switch

• Address LearningLayer 2 switches retain, in their filter tables, the source

hardware address and port interface it was received on.

• Forward/Filter decisions When a frame is received, the switch looks at the

destination hardware address and finds the interface it is on

in the filter table.  If the address is unknown, the frame is

broadcast on all interfaces except the one it was received

on.

Page 3: Layer 2 Switch

Functions of Layer 2 Switch

• Loop Avoidance

If multiple connections between switches exist for

redundancy, network loops can occur.  Spanning Tree

Protocol is used to stop loops while still allowing

redundancy.

Page 4: Layer 2 Switch

Switching Loops

• Broadcast Storms.• Multiple copies of frames.• Database instability.• Multiple Loops

Page 5: Layer 2 Switch

Broadcast Storm

Send ARP request

Flood broadcast through non-source ports

And so on with nothing to stop it

Page 6: Layer 2 Switch

Multiple Copies of Frames

Send frame to B

A is on port 3Don’t know B

So flood

Frame arrives

And again

Page 7: Layer 2 Switch

Database Instability

Send frame to B

A is on port 1A is on port 2

???

A is on port 3A is on port 1A is on port 2

Page 8: Layer 2 Switch

Spanning Tree Protocol

• Originally created by DEC (Compaq HP)• IEEE creates its own version called 802.1 D• All CISCO switches run 802.1 D• STP’s main task is to stop network loops from

occurring in layer 2 network.• Use Spanning tree algorithm.

Page 9: Layer 2 Switch

Spanning Tree Protocol

• STP’s main task is to stop network loops from occurring in layer 2 network.

• Use Spanning tree algorithm– Create a topology database.– Search out and destroy redundant links.

Page 10: Layer 2 Switch

Without Spanning Tree

• Not a Tree, It has loops.

Page 11: Layer 2 Switch

With Spanning Tree

• No loops. Includes all devices.

Page 12: Layer 2 Switch

Spanning Tree Algorithm

The switches use this algorithm to decide which ports should be shut down.

1. Choose one switch to be “root bridge”

2. Choose a “root port” on each other switch

3. Choose a “designated port” on each segment.

4. Close down all other ports.

Page 13: Layer 2 Switch

Outline of ProcessRoot bridge

Root port

Root port

Root port

Designated portDesignated port

Designated port

Designated port Not chosenClose down

Page 14: Layer 2 Switch

1. Choose the Root Bridge

• Each switch has a bridge ID (BID) of priority value followed by MAC address

• Switches exchange Bridge Protocol Data Units (BPDUs) to compare bridge IDs

• The switch with the lowest bridge ID becomes the root bridge

• Administrator can set the priority to fix the selection

Page 15: Layer 2 Switch

Bridge ID

• The bridge ID consists of bridge priority, and MAC address

• By default the priority is 32768• Lowest priority wins• Value 1 - 65536, multiples of 4096• MAC address used if priority is the same.

Better not to rely on MAC address.

Page 16: Layer 2 Switch

Select Root Ports• Every non-root bridge (Switch) selects a root port• This is the port with the lowest cost path to the root

bridge.

Page 17: Layer 2 Switch

Finding the cost of Link

• Default port costs depend on the speed of the link. Set by IEEE.

• Costs may change as faster Ethernet is developed.

Link speed Revised cost Previous cost

10 Gbps 2 1

1 Gbps 4 1

100 Mbps 19 10

10 Mbps 100 100

Page 18: Layer 2 Switch

What if Ports have same Cost?

• Use the port priority and port number.• By default

F0/1 has 128.1F0/2 has 128.2

Page 19: Layer 2 Switch

Passing Cost InformationEach BPDU includes the cost of the path back to the root bridge.The cost is the total cost of all the links.

As a switch receives a BPDU, it updates the cost by adding on the cost of the port through which the BPDU was received

Page 20: Layer 2 Switch

Select Designated Port

• On every segment, the port with the lowest cost path to the root bridge becomes the designated port

Page 21: Layer 2 Switch

Designated Port if Cost Same

• Choose the port on the switch with the lower bridge ID. Suppose this is switch B.

Page 22: Layer 2 Switch

Close down redundant links

• Any port that is not a root port or a designated port is put in blocking state

Page 23: Layer 2 Switch

BPDU

The BPDU message is encapsulated in an Ethernet frame.The destination MAC address is 01:80:C2:00:00:00, which is a multicast address for the spanning-tree group.

Page 24: Layer 2 Switch

Port Roles

STP makes ports:Root ports (forwarding)Designated ports (forwarding)Non-designated ports (shut down)

Page 25: Layer 2 Switch

Port States in traditional STP

Blocking – receives and transmits BPDU frames.Listening - receives and transmits BPDU frames. Learning - receives and transmits BPDU frames. Learns MAC addresses.Forwarding – Fully active, forwards user data.Disabled – Administratively shut down.

Page 26: Layer 2 Switch

States and Timers

BlockingLoss of BPDU detectedMax-age = 20 sec

BlockingWhen link first comes up

ListeningForward delay = 15 sec

LearningForward delay = 15 sec

Forwarding

Hello timer 2 sec for sending BPDUs.

Up to 50 sec from broken link to forwarding again.

Page 27: Layer 2 Switch

LAN Switching Modes

Store and Forward

The entire frame is copied into its buffer and computes the Cyclic Redundancy Check (CRC).  Since it copies the entire frame, latency varies with frame length.  If the frame has a CRC error, is too short (<64 bytes), or is too long (>1518 bytes) it is discarded.  If no error, the destination address (MAC) is looked up in the filter table and is sent to the appropriate interface. Is the default state for 5000 series switches.

Page 28: Layer 2 Switch

LAN Switching Modes

Cut Through

Fastest switching mode as only the destination address is copied.  It will then look up the address in its filter table and send the frame to the appropriate interface.

Page 29: Layer 2 Switch

LAN Switching Modes

Fragment Free

Modified form of Cut Through switching.  The switch waits for the first 64 bytes to pass before forwarding the frame.  If the packet has an error, it usually occurs in the first 64 bytes of the frame. Default mode for 1900 switches.