Basic switching
Basic switching
• It is a Physical layer device (Layer 1)
• It is Dummy Device
• It works with 0’s and 1’s (Bits)
• It works with broadcasting
• It works with shared bandwidth
• It is has 1 Broadcast Domain and 1 Collision Domain
• Collisions are identified using Access Methods called CSMA/CD
and CSMA/CA
Hub
• It is Datalink layer device (Layer 2)
• Its is An Intelligent device
• It works with Physical addresses (i.e. MAC addresses)
• It works with fixed bandwidth
• It works with Flooding and Unicast
• It has 1 Broadcast domain and Number of Collision domains
depends upon the number of ports.
• It maintains a MAC address table
Switch
Broadcast Domain & Collision Domain
• Broadcast Domain
Set of all devices that receive broadcast frames originating
from any device within the set.
• Collision domain
In Ethernet, the network area within which frames that have
collided are propagated is called a collision domain.
A collision domain is a network segment with two or more
devices sharing the same bandwidth.
Broadcast Domains
E0 E1
Collision Domains
E0 E1
Types of Switches
• Manageable switches
On a Manageable switch, an IP address can be assigned and
configurations can be made. It has a console port .
• Unmanageable switches
On an Unmanageable switch, configurations cannot be made,
an IP address cannot be assigned as there is no console port.
• Access Layer Switches
Switches Series : 1900 & 2900
• Distribution Layer Switches
Switches Series : 3000 & 5000
• Core Layer Switches
Switches Series : 7000, 8000 & 10,000
Cisco’s Hierarchical Design Model
Access Layer Switch
Catalyst 1900
Catalyst 2900
Three types of Switching Mode :
• Store & Forward
– A Default switching method for distribution layer switches.
– Latency : High
– Error Checking : Yes
• Fragment Free
– It is also referred to as Modified Cut-Through
– A Default Switching method for access layer switches.
– Latency : Medium
– Error Checking : On 64 bytes of Frame
• Cut through
– A Default switching method for the core layer switches
– Latency : Low
– Error Checking : No
Switching Mode
Latency is the total time taken for a Frame to pass through the
Switch. Latency depends on the switching mode and the
hardware capabilities of the Switch.
Console Connectivity
• Connect a rollover cable to the Switch console port (RJ-45 connector).
• Connect the other end of the rollover cable to the RJ-45 to DB-9 adapter
• Attach the female DB-9 adapter to a PC Serial Port.
• Open emulation software on the PC.
E0
LAN – 10.0.0.0/8
Con 0
Emulation Software
WINDOWS
• Start Programs Accessories Communications HyperTerminal HyperTerminal.
• Give the Connection Name & Select Any Icon
• Select Serial (Com) Port where Switch is Connected.
• In Port Settings Click on Restore Defaults
LINUX
• # minicom -s
switch(config)# Show mac-address-tableswitch(config)# Show interface status
To assign IP to a Switch
switch(config)# Interface Vlan 1switch(config-if)# ip address <ip> <mask>switch(config-if)# no shutdown
To assign Default Gateway to a Switchswitch(config)#ip default-gateway 192.168.20.1
Advance switching
• Spanning Tree Protocol (STP) uses Spanning Tree Algorithm to avoid
the Switching loops in layer-2 devices (bridges or switches).
• STP works when multiple switches are used with redundant links
avoiding Broadcast Storms, Multiple Frame Copies & Database
instability.
• First Developed By DEC
• STP is a open standard (IEEE 802.1D)
• STP is enabled by default on all Cisco Catalyst switches
Spanning Tree Protocol
STP
Switch D
Spanning Tree Protocol
Root :B
Root :A
Root :C
Root ID:32768.0000-0000-00001
Root ID:32768.0000-0000-00003Root ID:32768.0000-0000-00002
Bridge ID:32768.0000-0000-00001
Bridge ID:32768.0000-0000-00002 Bridge ID:32768.0000-0000-00003
FA0/23
Switch B Switch C
Switch AFA0/24
FA0/24
FA0/23 FA0/24
FA0/23
I'm the Root
I'm the RootI'm the Root
Switch D
Root :B
Root :A
Root :C
Root ID:32768.0000-0000-00001
Root ID:32768.0000-0000-00003Root ID:32768.0000-0000-00002
Bridge ID:32768.0000-0000-00001
Bridge ID:32768.0000-0000-00002 Bridge ID:32768.0000-0000-00003
FA0/23
Switch B Switch C
Switch AFA0/24
FA0/24
FA0/23 FA0/24
FA0/23
I'm the Root Because MY ID is Lesser
I'm the Not Root Because B ID is Lesser
B Root ID:32768.0000-0000-00002B Root ID:32768.0000-0000-00002B Root ID:32768.0000-0000-00002Root ID:32768.0000-0000-00002
Root :B
Switch D
Root :B
Root :A
Root :B
Root ID:32768.0000-0000-00001
Root ID:32768.0000-0000-00002Root ID:32768.0000-0000-00002
Bridge ID:32768.0000-0000-00001
Bridge ID:32768.0000-0000-00002 Bridge ID:32768.0000-0000-00003
FA0/23
Switch B Switch C
Switch AFA0/24
FA0/24
FA0/23 FA0/24
FA0/23
A Root ID:32768.0000-0000-00001A Root ID:32768.0000-0000-00001A Root ID:32768.0000-0000-00001
B is not Root Because A ID
is Lesser
I'm the Not Root Because A ID Is Lesser
Root :ARoot :A
Root ID:32768.0000-0000-00001Root ID:32768.0000-0000-00001
Root ID:32768.0000-0000-00001Root ID:32768.0000-0000-00001
Spanning Tree Protocol
Spee
d 10
0 M
bps S
peed
100 Mbps
Speed 100 Mbps
Root Port Root Port
D P
ort D P
ort
D Port Non D. Port
X
Bridge ID:32768.0000-0000-00001
Bridge ID:32768.0000-0000-00002 Bridge ID:32768.0000-0000-00003
FA0/23
Switch B Switch C
Switch AFA0/24
FA0/24
FA0/23 FA0/24
FA0/23
• BPDU
– All switches exchange information through what is called as
Bridge Protocol Data Units (BPDUs)
– BPDUs contain a lot of information to help the switches
determine the topology and any loops that result from that
topology.
– BPDUs are sent every 2 sec
• Bridge ID
– Each switch has a unique identifier called a Bridge ID or
Switch ID
– Bridge ID = Priority + MAC address of the switch
– When a switch advertises a BPDU , they place their switch id
in these BPDUs.
STP Terminology
• Root Bridge
– The bridge with the Best (Lowest) ID.
– Out of all the switches in the network , one is elected as a
root bridge that becomes the focal point in the network.
• Non-Root bridge
– All Switches other than the Root Bridge are Non-Root
Bridges
STP Terminology
• Designated port
– Either a port On a root bridge or a port that has been
determined as having the best (lower) cost.
– A designated port will always in Forward Mode
• Root port
– The link directly connected to the root bridge, or the
shortest path to the root bridge.
– Priority and Alternatives if Config occurred.
• Root port with the least cost (Speed) connecting to the root bridge.
• The bridge with the Best (Lowest) Switch ID.
• Lowest Physical Port Number.
– Only One root port will Be in Bridge or switch.
• Non Designated port
– All the Port or ports which are blocked by STP to avoid switching loop.
– A Non Designated port Will Always in Blocked Mode.
STP Terminology
• Blocking - 20 Sec Or No Limits.
• Listening - 15 Sec.
• Learning - 15 Sec.
• Forwarding - No Limits.
• Disable - No Limits.
Typical Costs of Different Ethernet NetworksSpeed New IEEE Cost Original IEEE Cost
10Gbps 2 1
1Gbps 4 1
100Mbps 19 10
10Mbps 100 100
Switch - Port States of STP
• Blocking : Won’t forward frames; listens to BPDUs. All ports are in blocking state by default when the switch is powered up.
• Listening : Listens to BPDUs to make sure no loops occur on the network before passing data frames.
• Learning : Learns MAC addresses and builds a filter table but does not forward frames.
• Forwarding : Sends and receives all data on the bridged port.
Switch - Port States
• Spanning Tree Port Fast causes an interface configured as a Layer 2 access port to transition from blocking to forwarding state immediately, bypassing the listening and learning states.
• If you have a server or other devices connected into your switch that you’re totally sure won’t create a switching loop and you want the STP to be disabled, you can use something called portfast on these type of ports.
• If the portfast is enabled the port won’t spend the usual 50 seconds to come up into forwarding mode while STP is converging.
Switch(config-if)# spanning-tree portfast
Spanning Tree Port Fast
Switch(config-if)# interface Fastethernet 0/1Switch(config-if)# spanning-tree portfast
%Warning: portfast should only be enabled on ports connected to a single host. Connecting hubs, concentrators, switches, bridges, etc... to this interface when portfast is enabled, can cause temporary bridging loops.
Use with CAUTION %Portfast has been configured on FastEthernet0/1 butwill only have effect when the interface is in a non-trunking mode.
Switch(config-if)#
The range command, you can use on switches to help youconfigure multiple ports at the same time.
Switch(config)# int range fastEthernet 0/1 - 12Switch(config-if-range)# spanning-tree portfast
The preceding range command allows me to set all 12 of my switch ports into portfast mode by typing in one command and then simply pressing the Enter key.
Note: I also want you to know that the interface range command can be used in conjunction with any command.
The range command
• UplinkFast is a Cisco-specific feature that improves the convergence time of STP in case of a link failure.
• The UplinkFast feature is designed to run in a switched environment when the switch has at least one alternate/backup root port (a port in blocking state).
• UplinkFast allows a switch to find alternate paths to the root bridge before the primary link fails. This means that if the primary link fails, the secondary link would come up more quickly—the port wouldn’t wait for the normal STP convergence time of 50 seconds
Spanning Tree Uplink Fast
Here’s how to configure UplinkFast on our Access layer switches (S1 and S2):
S1# config tS1(config)# spanning-tree uplinkfast
S2# config tS2(config)# spanning-tree uplinkfastS1(config)# do show spanning-tree uplinkfast
UplinkFast is enabledStation update rate set to 150 packets/sec.UplinkFast statisticsNumber of transitions via uplinkFast (all VLANs) : 1 Number of proxy multicast addresses transmitted (all VLANs) : 8Name Interface ListVLAN0001 Fa0/1(fwd), Fa0/2
S1(config)#The uplinkfast command is a global command and it’s enabled onevery port
Spanning Tree Uplink Fast
• BackboneFast is used for speeding up convergence.
• Backbone Fast should be enabled on all Catalyst switches to allow for detection of indirect link failures.
• Enabling BackboneFast is also beneficial because it starts the spanning tree reconfiguration more quickly
• it can save 20 seconds on the default 50-second STP convergence time.
Spanning Tree BackboneFast
• Cisco created PortFast, UplinkFast, and BackboneFast to “fix” the holes and liabilities the IEEE 802.1d standard presented.
• The drawbacks to these enhancements are only that they are Cisco proprietary and need additional configuration.
• But the new 802.1w standard (RSTP) addresses all these issues.
• To enable PVRST+, use the following command:
Switch(config)# spanning-tree mode rapid-pvst
Rapid Spanning Tree Protocol (RSTP) 802.1w
Once enabled, you can view the STP on a per-VLAN basis with this command:
Switch# show spanning-tree vlan VLAN_# [detail]
Here’s an example of this command:
Switch# show spanning-tree vlan 10
VLAN0010Spanning tree enabled protocol rstpRoot ID Priority 32768This bridge is rootHello Time 2 sec Mag Age 20 sec Forward Delay 15 secBridge ID Priority 32768 (priority 32768 sys-id-ext 10)Address 0000.01c1.1111Hello Time 2 sec Mag Age 20 sec Forward Delay 15 secAging Time 300Interface Role Sts Cost Pior.Nbr Type--------- ---- --- ---- -------- ----Fa0/1 Desg FWD 19 128.1 P2pFa0/2 Desg FWD 19 128.2 P2pFa0/3 Desg FWD 19 128.3 P2p
• By using port security, you can limit the number of MAC addresses that can be assigned dynamically to a port.
• A secured switch port can associate anywhere from 1 to 8,192 MAC addresses, but the ’50 series can support only 192.
• You can choose to allow the switch to learn these values dynamically, or you can set a static address for each port using the switchport port-security mac-address mac-address command.
Port Security
S1#config tEnter configuration commands, one per line. End with CNTL/Z.
S1(config)# int range fa0/3 - 4S1(config-if-range)# switchport port-security maximum ?
<1-8192> Maximum addresses
S1(config-if-range)# switchport port-security maximum 1S1(config-if-range)# switchport port-security mac-address stickyS1(config-if-range)# switchport port-security violation ?
protect Security violation protect moderestrict Security violation restrict modeshutdown Security violation shutdown mode
S1(config-if-range)# switchport port-security violation shutdownS1(config-if-range)# exit
S1# config t
S1(config)# mac-address-table static aaaa.bbbb.cccc vlan 1 int fa0/5
S1(config)# do show mac address-table
With show spanning-tree, you can see who the root bridge is and what our priorities are set to for each VLAN.
S1# show spanning-tree
Assigning Static MAC Addresses