Transcript

CCNA – SWITCHING By: Sameh El-HakimCyber Security Engineer

INTRODUCTION

Switching is the process of using the physical address of devices to perform forwarding decisions.

There are three distinct functions of layer 2 switching that are vital for you to remember: Address learning Forward/filter decisions Loop avoidance

ADDRESS LEARNING

When a switch is first powered on, the MAC forward/filter table Content AddressableMemory (CAM) is empty

After Learning

FORWARD/FILTER DECISIONS When a frame is received on an interface, the switch looks at the destination hardware address, then chooses the appropriate exit interface for it in the MAC database. This way, the frame is only forwarded out of the correct destination port.

LOOP AVOIDANCE

If multiple connections between switches are created for redundancy purposes, network loops can occur. Spanning Tree Protocol (STP) is used to prevent network loops while still permitting redundancy.

* Redundancy or redundant links between switches are important to have in place because they help prevent nasty network failures in the event that one link stops working.

THE SPANNING TREE PROTOCOL (STP)Responsible for identifying links in the network and shutting down the redundant ones, preventing possible network loops.

In order to do so:I. All switches in the network exchange BPDU messages between them to

agree upon the root bridge. II. Once they elect the root bridge, every switch has to determine which of its

ports will communicate with the root bridge.

* Bridge Protocol Data Units (BPDUs) are frames that contain information about the Spanning tree protocol (STP). Inside the BPDU is the bridge ID.

SPANNING-TREE TERMS

1. Root bridge is the bridge with the lowest and the best bridge ID. The switches within the STP network elect a root bridge, and once it has been elected, all other bridges must create a single path to it. The port with the best path to the root bridge is called the root port.

2. Non-root bridges These are all bridges that aren’t the root bridge.

3. BPDU

4. Bridge ID The bridge ID is how STP keeps track of all the switches in the network. It’sdetermined by a combination of the bridge priority, which is 32,768 by default on all Cisco switches, and the base MAC address. The bridge with the lowest bridge ID becomes theroot bridge in the network. Most networks benefit by forcing a specific bridge or switch to beon the Root Bridge by setting its bridge priority lower than the default value.

5. Port cost is the deciding factor used by every bridge to find the most efficient path to the root bridge.

6. Path cost A switch may encounter one or more switches on its path to the Root Bridge, andthere may be more than one possible path.

BRIDGE PORT ROLES

1. Root port is the link with the lowest path cost to the root bridge. The root bridge can never have a root port designation, while every other switch in a network must have one and only one root port.

2. Designated port A designated port is one that’s been determined to have the best (lowest) cost to get to on a given network segment. A designated port will be marked as a forwarding port.

3. Non-designated port

4. Forwarding port will be either a root port or a designated port.

5. Blocked port A blocked port won’t forward frames in order to prevent loops.

SPANNING-TREE PORT STATES1. Disabled it doesn’t participate in frame forwarding or STP.

2. Blocking As I mentioned, a blocked port won’t forward frames; it just listens to BPDUs.The purpose of the blocking state is to prevent the use of looped paths. All ports are inblocking state by default when the switch is powered up.

3. Listening This port listens to BPDUs to make sure no loops occur on the network beforepassing data frames.

4. Learning The switch port listens to BPDUs and learns all the paths in the switched network. A port in learning state populates the MAC address table but still doesn’t forwarddata frames. Forward delay refers to the time it takes to transition a port from listening tolearning mode, or from learning to forwarding mode, which is set to 15 seconds by defaultand can be seen in the show spanning-tree output.

5. Forwarding This port sends and receives all data frames on the bridged port. If the port isstill a designated or root port at the end of the learning state, it will enter the forwarding state.

* The original STP (802.1d) takes 50 seconds to go from blocking to forwarding mode by default

LINK COSTS

STP VS RSTP CONVERGENCE TIMESTP:

I. The hello time is 2 seconds. The Max Age Timer is 10x the hello timer.

II. Once a port is in blocking state, it stays there for 20 seconds. Then moves onto listening at 15 seconds, then learning at 15 seconds. That's where you get your 50 seconds.

RSTP:

III. The max age is 3x the hello. So a max of 6 seconds.

IV. Moves onto learning at 15 seconds. That's where you get your 21 seconds.

SPANNING-TREE OPERATIONS Since the priorities are all equal to 32,768, we’ll compare MAC addresses and find the MAC address of S1 is lower than that of S2 and S3, meaning that S1 has a better bridge ID.

SPANNING-TREE OPERATIONS Looking at the cost of each link, it’s clear why S2 and S3 are using their directly connected links, because a gigabit link has a cost of 4. For example, if S3 chose the path through S2 as its root port, we’d have to add up each port cost along the way to the root, which would be 4 + 4 for a total cost of 8.

Every port on the root bridge is a designated, or forwarding,

SPANNING-TREE OPERATIONS based on the bridge ID, the port with the best and lowest would become the only bridge forwarding on that segment, with the one having the highest, worst bridge ID put into blocking mode.

Since S3 had a lower bridge ID (better), S2’s port went into blocking mode.

STP EXAMPLE

THANK YOU


Top Related