👨‍💻
CCNA Cheat Sheet
  • Switching
  • Routing
  • Network Services
  • Blue Interview Questions
Powered by GitBook
On this page
  • Switch
  • VLAN
  • Spanning Tree Algorithm (STP)
  • STP exercises
  • Root Bridge ID
  • Root Ports:
  • Designated Ports
  • VTP
  • DTP
  • Inter-VLAN Routing
  • Etherchannel (portchannel)

Was this helpful?

Switching

Switch is device that works on MAC address, it is a l2 device, in which the data transmitted is in the form of a frame.

NextRouting

Last updated 3 years ago

Was this helpful?

Switch

  • It is a LAN device which connects one or more devices in the same Network.

  • Works on L2 layer of OSI model.

  • Switch has one broadcast domain .

  • MAC address is used in it.

  • MAC(Media Access Control) is a 48 bit address that is represented by 12 bit hexadecimal number.

  • Data is sent in the form of frame.

VLAN

  • Vlan is a concept in which one single broadcast domain is split into multiple broadcast domains.

  • Vlan provides layer 2 security.

  • VLAN 1 is a default vlan.

  • vlan's can be created from 2-1001

Vlans advantages.

  • Limits the number of broadcasts thus preventing broadcast storms.

  • Better performance and security.

  • based on port number.

  • one port can only be a member of a particular vlan. ( voice vlan is an exception)

  • By default all ports will be in VLAN one.

Syntax for VLAN

S1(config)#vlan 10
S1(config-vlan)#exit
S1(config)#interface range eth1/1-20
S1(config-if)#switchport mode access
S1(config-if)#switchport access vlan10
S1(config-if)#exit

Access Port

  • Access port can carry single vlan information in it.

  • Acess port can carry traffic for only one vlan.

  • Normally connected to end devices.

Trunk Port (Trunking)

  • Trunks are the links where the multiple vlan traffic passes through it.

  • It is done by adding a tag to the frame. it is called frame tagging.

  • Frame tag contains vlan number in it.

  • Vlan tag is added while entering a trunk port and removed after reaching the destination switch.

Syntax for Trunk

switch(config)#interface ethernet 1/1
switch (config-if)#switchport mode trunk
switch (config-if)#switchport trunk encapsulation dot1q
switch (config-if)#switchport trunk allowed vlan 1,2,3,4
switch (config-if)#exit

Spanning Tree Algorithm (STP)

  • STP is a l2 protocol that prevents loops in a network.

  • STP enables a loop free path between the network devices.

  • Practically in the network there are redundant links that may cause a broadcast storms in a network that might cause delay or packet loss in the network.

  • In order to prevent this stp is used.

STP working

  • Selecting the ROOT BRIDGE

  • Selecting the ROOT PORT

  • Selecting the Designated and Non-Designated ports.

Selecting the ROOT BRIDGE

  • Root Bridge = Priority + MAC address

  • Lowest bridge id

  • Default priority in cisco switch is 32,768.

Selecting the ROOT PORT

  • It is the shortest path to the root bridge.

  • It is selected on the least cost

Selecting the Designated and Non-Designated ports.

  • Designated port is the one with the lowest cost. it is marked as a forwarding port.

  • it can be both on root bridge and non root bridge.

BPDU

  • BPDU's are short for Bridge Protocol Data Units.

  • It contains information regarding local bridge and root bridge id.

  • BPDU's are sent every 2 seconds and is dead in 20 seconds.

STP Timers.

STP exercises

Determine Bridge ID, Root Port, Designated Ports and Non Designated ports(blocking port)

Root Bridge ID

  • We know that Bridge id would be lowest priority + Mac address.

  • So that rules out Switch C and D.

  • looking at priorities we see that both of them A and B are same.

  • A and B mac address we have the 000d and 0018, so obviously A is least. Hence its the Root Bridge.

Root Ports:

  • Root ports are the shortest path to the root bridge.

  • It depends on the cost of the links gigabit link has a cost of 4 whereas tengigabit link has 2.

  • so based on that lets determine the root ports

  • Te1/0/1 on the switch B is one Root port, Gi1/0/1 is Switch B, now the tricky part is in switch c.

  • Switch C has both the giga bit ports and so the cost is same, hence due to this lowest bridge id is considered, as the bridge id is also same the root port is dependent on the port number of descending switch.

  • So, due to this gi1/0/3 is less than gi1/0/4, hence other end of gi1/0/3 becomes root port.

  • Final Root port is now decided as gi1/0/11 on the switch c.

Designated Ports

  • Designated ports are all segments that are directly connected to the root,

  • Being on the root is the closest to the root, that implies gi1/0/3, gi1/0/4, gi1/0/10/ and te1/0/1 on switch A.

  • On switch B the designated ports are gi1/0/7 and gi1/0/5 as the cost from either of the ports are 2 hence both of them are 2.

  • All the ports that are not Designated ports are called Non-Designated ports/ Blocking ports.

Convergence time in STP

  • Convergence time of the STP is around 50 seconds, hence this STP is not used in real time.

  • RPVST is used instead.

  • If 100Mbps link is down, then the following actions take place.

  • Blocking : the link is still in blocking phase, here the switch A waits for BPDU's to arrive from Switch B for about 20 seconds.

  • Listening : link is now out of blocking phase and due to this the switch A enters into listing phase here it listens to BPDU's sent out from Switch B. This operation takes 15 secs.

  • Learning : Switch A learns more about the MAC address of the switch B and populates the CAM table. This is the learning phase.

  • Forwarding : Now the link segment 2 comes up.

Portfast: will bypass listening and learning phases, will transition into forwarding stages.

security issues will be there.

if a portfast port receives a BPDU msg then(only switch will generate bpdu)

BPDU Guard: will put the port in an error disabled state.

BPDU Filter: when received the portfast is disabled and restarts the stp.

bpdu guards --- error disabled

bpdu filter ------- disable port fast.

STP States
RSTP

Blocking

Disabled

Discarding

Listening

Learning

Learning

Forwarding

Forwarding

VTP

  • VLAN Trunking Protocol (VTP)

  • It is a protocol which helps in propagation of vlans in a vtp domain/network.

  • It is a cisco proprietary.

  • By default the switches are in server mode.

There are 3 modes of VTP.

  • VTP Server: Default mode in switch, sends vlan info to other switches.

  • VTP Client: Receives vlan info takes action and forwards it to other switches.

  • VTP Transparent: forwards vtp traffic and takes no action/stores in its database.

VLANs info is stored in vlan.dat file. To remove vlan info we have to delete vlan.dat file .

Syntax for configuring VTP modes

  • By default the switches are in server mode.

SW1(config)#vtp domain test
Changing VTP domain name from NULL to test
SW1(config)#vtp password cisco
Setting device VLAN database password to cisco

Client side configuration.

SW2(config)#vtp mode client 
Setting device to VTP CLIENT mode.
SW2(config)#vtp domain test 
Changing VTP domain name from NULL to study-ccna
SW2(config)#vtp password cisco
Setting device VLAN database password to cisco

DTP

  • Dynamic Trunking Protocol

  • It is used for forming a trunk dynamically.

  • By default the DTP is enabled in the switch and is in auto/desirable.

  • whenever a DTP packet request to form a trunk, then it becomes trunk port.

There are two modes in DTP.

  • Dynamic auto: Passively waits for dtp packets to form trunk.

  • Dynamic Desirable: Initiates negotiation messages and responds to negotiation to form a trunk port.

Syntax for DTP

SW2(config)#interface fastEthernet 0/24
SW2(config-if)#switchport mode {dynamic auto | dynamic desirable}
SW2(config-if)#end

Inter-VLAN Routing

  • It is a process which enables communication between two different VLANS.

  • for example from vlan 10 to vlan 20.

Inter-VLAN routing can be done by using

  • using multiple physical link called legacy intervlan routing.

  • using a trunk and sub-interfaces called Router on a stick.

  • using a multilayer switch (L3 switch)

Inter-Vlan Routing on multilayer (l3 switches) using SVI's.

  • It uses something called SVI in this case.

  • SVI is short for Switch Virtual Interfaces.

  • SVI are nothing but virtual interfaces that are created on the L3 switch.

  • Communication between VLAN 10 and VLAN 20 can be done using this SVI.


**********create a vlan10 interface*************
switch1(config)#interface vlan 10
switch1(conf-if)#ip add 192.168.1.254 255.255.255.0
switch1(conf-if)#no shut
switch1(conf-if)#exit
switch1#
**********create a vlan20 interface*************
switch1(conf)#interface vlan 20
switch1(conf-if)#ip add 10.10.10.254 255.255.255.0
switch1(conf-if)#no shut 
switch1(conf)#exit
switch1#
**********Give this Command for Enabling Routing*************
switch1#conf t
switch1(conf)#ip routing
switch1(conf)#end
switch1#
switch1#
**********Create a Routed Port******************************
switch1#
switch1#
switch1(conf)#interface fa0/1/1
switch1(conf-if)# no switchport
switch1(conf-if)#ip add 10.10.10.1 255.255.255.0
switch1(conf-if)# end
switch1#
switch1# 

Etherchannel (portchannel)

  • It is a process in which multiple physical ports are combined together to form a single logical port.

  • It helps in redundancy.

  • It helps in increasing the Bandwidth.

  • It helps in load-balancing.

  • helps with the decrease in loops in the network.

  • to create a port-channel all should be having same speed, duplex and physical port(fiber or ethernet).

sw2(config)#int ran fa0/1-5
sw2(config-if-range)#speed auto	{speed&duplex are to be set auto, in order to use mdix(mdix is used when you dont have crossover cable to connect each other)}
sw2(config-if-range)#duplex auto		
sw2(config-if-range)#mdix auto
sw2(config-if-range)#channel-group 1 mode active/auto/desirable/on/passive
sw2(config-if-range)#exit

sw2(config)#int port-channel 1
sw2(config-if)#switchport trunk encapsulaton dot1q
sw2(config-if)#switchport mode trunk
sw2(config-if)#exit
sw2(config)#exit

Etherchannel has two protocols:

  • PAgP(Port Aggregation Protocol)

  • LACP (Link Aggregation Control Protocol)

PAgP:

  • It is a cisco proprietary protocol.

  • it has two modes Auto and Desirable.

LACP

  • It is a open standard protocol.

  • it has two modes Active and Passive.

Cisco 2960 catalyst switch
Bandwidth vs Cost
Root bridge switch A.
STP root bridge, Root Port ,Designated ports and Blocking Port.
If network segment1 100Mbps link fails then it will take 50 seconds for network segment 2 to come up.
Effect of DTP at both ends
Switching using SVI in L3 switches