Thursday, June 18, 2015

Spanning Tree Protocol | Configure on Cisco Switch

Typically every network infrastructure has redundant path for better communication among the network, but there may be loops over the redundant paths. So STP(Spanning Tree Protocol) ensure loop-free network topology in the entire network and this helps to avoid the unwanted traffic over the network. To overcome this issue we STP can be used, before that Root Bridge should be selected in the network topology.


In root bridge selection, there are some facts need to consider. I will explain about this using the below example with that network diagram.

 

When Root bridge is selected other connected ports of switches are classified, those are described below.

  1. Root Port : Best port reach to the Root Bridge
  2. Designated Port : Other end of the root port connecting to the other switches.
  3. Non - Designated Port : This is the redundant port and it is blocked.

In Root Bridge selection, it is done with an election process by considering some facts. In a network topology every switches has Bridge ID (BID) which contains priority value(Default Value : 32769). When the every switches in the network boots up, they send BPDU(Bridge Protocol Data Unit) packets including BID and the Root ID to the entire network. Just after the booting up, every switches identifies then as Root Bridge itself. After that everyone sends out the BPDUs to the neighbouring switches and reads Root ID of everyone, then decide the Root Bridge. Root Bridge will be the switch which contains lowest BID value. So that switch will be the Root Bridge.

In my example, I’ll show the the spanning-tree details in each switches.

Switch0#show spanning-tree active 
VLAN0001
  Spanning tree enabled protocol ieee
  Root ID    Priority    32769
             Address     000C.CFC2.CDEA
             This bridge is the root
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32769  (priority 32768 sys-id-ext 1)
             Address     000C.CFC2.CDEA
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  20

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/4            Desg FWD 19        128.4    P2p
Fa0/6            Desg FWD 19        128.6    P2p
Fa0/7            Desg FWD 19        128.7    P2p
Fa0/5            Desg FWD 19        128.5    P2p
Fa0/1            Desg FWD 19        128.1    P2p
Fa0/2            Desg FWD 19        128.2    P2p
Fa0/3            Desg FWD 19        128.3    P2p
Fa0/8            Desg FWD 19        128.8    P2p


Switch1#show spanning-tree active 
VLAN0001
  Spanning tree enabled protocol ieee
  Root ID    Priority    32769
             Address     000C.CFC2.CDEA
             Cost        19
             Port        1(FastEthernet0/1)
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    40961  (priority 40960 sys-id-ext 1)
             Address     00D0.97DE.DEEE
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  20

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/6            Altn BLK 19        128.6    P2p
Fa0/3            Altn BLK 19        128.3    P2p
Fa0/4            Altn BLK 19        128.4    P2p
Fa0/7            Desg FWD 19        128.7    P2p
Fa0/8            Desg FWD 19        128.8    P2p
Fa0/1            Root FWD 19        128.1    P2p
Fa0/2            Altn BLK 19        128.2    P2p
Fa0/5            Altn BLK 19        128.5    P2p


Switch2#show spanning-tree active 
VLAN0001
  Spanning tree enabled protocol ieee
  Root ID    Priority    32769
             Address     000C.CFC2.CDEA
             Cost        19
             Port        1(FastEthernet0/1)
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    40961  (priority 40960 sys-id-ext 1)
             Address     0001.6338.8C20
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  20

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/8            Desg FWD 19        128.8    P2p
Fa0/6            Desg FWD 19        128.6    P2p
Fa0/3            Desg FWD 19        128.3    P2p
Fa0/4            Desg FWD 19        128.4    P2p
Fa0/5            Desg FWD 19        128.5    P2p
Fa0/1            Root FWD 19        128.1    P2p
Fa0/2            Altn BLK 19        128.2    P2p
Fa0/7            Desg FWD 19        128.7    P2p


Switch3#show spanning-tree active 
VLAN0001
  Spanning tree enabled protocol ieee
  Root ID    Priority    32769
             Address     000C.CFC2.CDEA
             Cost        19
             Port        5(FastEthernet0/5)
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    40961  (priority 40960 sys-id-ext 1)
             Address     0001.6399.2891
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  20

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/1            Desg FWD 19        128.1    P2p
Fa0/8            Desg FWD 19        128.8    P2p
Fa0/2            Desg FWD 19        128.2    P2p
Fa0/4            Altn BLK 19        128.4    P2p
Fa0/6            Altn BLK 19        128.6    P2p
Fa0/5            Root FWD 19        128.5    P2p
Fa0/7            Desg FWD 19        128.7    P2p
Fa0/3            Altn BLK 19        128.3    P2p

According to the results you can see the Bridge ID in Switch1, Switch2, Switch3 are same with 40961, but the  Switch0 has value 32769. 

                                                                            40961 > 32769
               Switch1, Switch2, Switch3 > Switch0

Therefor the Switch0 will be elected as Root Bridge. But if You want to change the root bridge you can change it by changing the BID.

Switch(config)#spanning-tree vlan 1 priority <value>
<value> : <0-61440>  bridge priority in increments of 4096




Thank You ... :)

Monday, June 8, 2015

Voice VLAN Configuration on Cisco

Voice VLAN is a feature available on cisco switches which is useful feature for Voice and DATA traffic. Voice VLAN cares about the traffic over the data and voice so the communication over the IP network does not deteriorate while voice or data transmission. 


Network Diagram for demonstrate Voice VLAN


Turn on the Cisco IP phones, click on the phone and connect the power adapter.

Switch>enable  
Switch#configure terminal 
Enter configuration commands, one per line.  End with CNTL/Z.

Switch(config)#vlan 10 
Switch(config-vlan)#name voice 
Switch(config-vlan)#exit 
Switch(config)#vlan 20 
Switch(config-vlan)#name data 
Switch(config-vlan)#exit

Switch(config)#interface range fastEthernet 0/2-5
Switch(config-if-range)#switchport mode access
Switch(config-if-range)#switchport voice vlan 10

Switch(config)#interface range fastEthernet 0/2-5
Switch(config-if-range)#switchport mode access
Switch(config-if-range)#switchport access vlan 20
Switch(config-if-range)#exit

Router>enable
Router#configure terminal
Router(config)#ip dhcp pool voice
Router(dhcp-config)#network 192.168.100.0 255.255.255.240
Router(dhcp-config)#default-router 192.168.100.1
Router(dhcp-config)#option 150 ip 192.168.100.1

Router(config)#ip dhcp pool data
Router(dhcp-config)#network 192.168.100.16 255.255.255.240
Router(dhcp-config)#default-router 192.168.100.17
Router(dhcp-config)#option 150 ip 192.168.100.17

Router(config)#interface fastEthernet 0/0.1 
Router(config-subif)# 
%LINK-5-CHANGED: Interface FastEthernet0/0.1, changed state to up 

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.1, changed state to up
Router(config-subif)#encapsulation dot1Q 10
Router(config-subif)#ip address 192.168.100.1 255.255.255.240
Router(config-subif)#no shutdown

Router(config)#interface fastEthernet 0/0.2 
Router(config-subif)# 
%LINK-5-CHANGED: Interface FastEthernet0/0.2, changed state to up 

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.2, changed state to up 

Router(config-subif)#encapsulation dot1Q 20 
Router(config-subif)#ip address 192.168.100.17 255.255.255.240 
Router(config-subif)#no shutdown

Switch(config)#interface fastEthernet 0/1  
Switch(config-if)#no shutdown
Switch(config-if)#switchport mode trunk 

Router(config)#interface fastEthernet 0/0 
Router(config-if)#no shutdown 

Router(config)#telephony-service
Router(config-telephony)#max-ephones 5
Router(config-telephony)#max-dn 5
Router(config-telephony)#ip source-address 192.168.100.1 port 2000

Router(config)#ephone 1 
Router(config-ephone)#button 1:1

Router(config)#ephone 2
Router(config-ephone)#button 1:2

Router(config)#ephone 3
Router(config-ephone)#button 1:3

Router(config)#ephone 4
Router(config-ephone)#button 1:4