320 likes | 559 Views
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.
E N D
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).
Functions of Layer 2 Switch • Address Learning • Layer 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.
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.
Switching Loops • Broadcast Storms. • Multiple copies of frames. • Database instability. • Multiple Loops
Broadcast Storm And so on with nothing to stop it Flood broadcast through non-source ports Send ARP request
Multiple Copies of Frames A is on port 3 Don’t know B So flood Send frame to B Frame arrives And again
Database Instability A is on port 1 A is on port 2 ??? A is on port 3 A is on port 1 A is on port 2 Send frame to B
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.
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.
Without Spanning Tree • Not a Tree, It has loops.
With Spanning Tree • No loops. Includes all devices.
Spanning Tree Algorithm The switches use this algorithm to decide which ports should be shut down. • Choose one switch to be “root bridge” • Choose a “root port” on each other switch • Choose a “designated port” on each segment. • Close down all other ports.
Designated port Designated port Root port Root port Root port Designated port Designated port Not chosenClose down Outline of Process Root bridge
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
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.
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.
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.
What if Ports have same Cost? • Use the port priority and port number. • By defaultF0/1 has 128.1F0/2 has 128.2
Passing Cost Information Each 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
Select Designated Port • On every segment, the port with the lowest cost path to the root bridge becomes the designated port
Designated Port if Cost Same • Choose the port on the switch with the lower bridge ID. Suppose this is switch B.
Close down redundant links • Any port that is not a root port or a designated port is put in blocking state
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.
Port Roles • STP makes ports: • Root ports (forwarding) • Designated ports (forwarding) • Non-designated ports (shut down)
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.
States and Timers BlockingLoss of BPDU detectedMax-age = 20 sec BlockingWhen link first comes up ListeningForward delay = 15 sec Hello timer 2 sec for sending BPDUs. Up to 50 sec from broken link to forwarding again. LearningForward delay = 15 sec Forwarding
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.
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.
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.