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

Thursday, May 28, 2015

Jenkins | Deploy & Configure for Play Applications in RHEL 6.x


Jenkins is an open source server which is for continuous integration and written by JAVA. This is a world famous CI(Continuous Integration) tool. This tutorial guides you through the steps to deploy jenkins server on RHEL(Red Hat Enterprise Linux) server. The steps are given below.


  1. Check the JAVA is available on the RHEL server.
    # java -versionOutput :
    java version "1.8.0_45"Java(TM) SE Runtime Environment (build 1.8.0_45-b14)Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
  2. If there is no JAVA is installed on your, install java and get it confirmed that’s installed.# yum install java
  3. Add the Jenkins repository to the host machine, then install the rpm file.wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo rpm --import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key
  4. Install Jenkins server
    # yum install jenkins
  5. Adding jenkins to system boot
    # chkconfig jenkins on
  6. Start Jenkins and check the port 8080 is opened from the server side.
    service jenkins start# netstat -tnlp | grep 8080
  7. Open your browser and load Jenkins server http://<server_ip>:8080
  8. After successfully deploy the Jenkins server, you can setup the server to build scala applications. In here the application code will be retrieved from the git server, so git server should have a separate user for jenkins. In order to achieve that user have to generate a SSH key file from the host machine.
    ssh-keygen -t jenkin@localhost.com
    #
     ls -al ~/.ssh/
  9. Open the rsa.pub file and copy the content to the clip board then update the Github user in Github dashboard.  Go to Github -> Your Profile -> SSH Keys -> Add New
  10. Install the git plugin in Jenkins server.
    Go to Jenkins -> Manage Jenkins -> Manage Plugins -> Install git Plugin
  11. Create a job in Jenkins with you project details.
    Jenkins Dashboard -> New Item
  12. After creating the job, you will see the git server settings on configuration on the specified project.
     Go to project -> configure
13.  Under git settings in configuration page you can add the specific git configurations.

14. In Git credentials you have to add the Private key you generated at step number 8, copy the RSA         key content to the clip board, then go to Add -> select SSH Username with private key. Then add       username, private key value.
15. Then add the build step with “execute shell” and add the command to execute scala application.

16. Now add the scala command to build play applications.

17. In order to execute the play application build command in Jenkins, SBT should be installed on the       host machine. Go to this link http://www.scala-sbt.org/download.html and get the latest SBT.zip         file and extract it in a suitable directory (e.g.: /srv/sbt).
      # cd /srv/sbt/bin/
      # ./sbt

Output : 

18. Now time to build the play application, go to Jenkins server and run the "Build Now”, then you           will see the console output. Finally if you are getting message “success”, then you are done. :) 

Tuesday, April 14, 2015

Configure VisualVM on Ubuntu 14.10

VisualVM is a kind of data gathering software for application which are running under the Java Virtual Machines (JVM). This retrieve information related to the Java application, like heap size, heap dumps, RAM utilisation, CPU utilisation, thread count and so on. There is an special interface that they use for getting information from application ends and gathered information is analysed and displayed on the VisualVM dashboard. Remote application also can be monitored via VisualVM. Specially user can get snapshot of heat dumps also.

Follow the steps to install VisualVM on Ubuntu server.
# sudo apt-get install visualvm
# which viaualvm
# java -version

You can check the java is up & running up using the commands given above. And for testing purpose, I’m here using a Java testing application in the same host. Let’s open the visualVM and configure it to get the information of running applications.

# visualvm

if you need any help related to visualVM you can us,
# visualvm - -help


After open the VisualVM, then you will see the terms and condition that should be accepted. Please accept it and go ahead.


After you agreed to the license agreement you will be displayed the VisualVM home page. In this home page you can see the options that you are having on VisualVm. In the Left side all the options are available. The image given below shows the sample home page of VisualVM.


To test an application, here I’m going to run a test application which contains a digital clock. 

Download this file and extract, then run the testing java application on a terminal, then you will see the Digital clock on a particular application window.
# sudo unzip demo.zip
# cd src/
# javac DemoApp.java
# java DemoApp

After running the testing application, you will see the analytics of the application on the VisualVM dashboard. Locally running all the applications are added automatically to the VisualVM. Sample dashboard image is given below.


How to Add a Remote Host’s Application 


In order to create a connection with a remote Java Application, can be used JMX connection with the remote host. JMX is Java Management Framework, which is used to monitoring, or manage any java based application which running remotely or locally. So this is a best way to use to monitor remotely running Java Application.
In order to run a particular Java application using JMX you have to add several settings on commands.

  1. com.sun.management.jmxremote.port :state which port is assigned to the Application.
  2. com.sun.management.jmxremote.ssl : State the SSL certificate settings.
  3. com.sun.management.jmxremote.authenticate : State the remote Authentication settings.

As an example, here the command that was used to open the DemoApp,
java -Dcom.sun.management.jmxremote.port=3333 -Dcom.sun.management.jmxremote.ssl=false -
Dcom.sun.management.jmxremote.authenticate=false DemoApp

Before adding the remote application for VisualVM, user needs to add the remote host to the VisualVM dashboard. Go to the “Application" on left side and right-click on the "Remote Host”, then click on "Add Remote Host”, then you will be displayed window to add the remote host.
After adding the remote host, you can add whatever the application which are running on added remote host. So right-click on the remote host name and select "Add JMX Connection”, then enter the remote host name and the port number which was assigned previously. After adding those things you can see the added application is displayed under the remote host (Image given below).


After you double-click on the Application, dashboard will be loaded and retrieve analytics and data according to the application weight. In following image you can see, both application are in same dashboard.


In Visual VM dashboard consist of the four tabs. The descriptions for each tabs are given below. 

  • Overview : Contains PID, Host name, arguments, heap dumb, so on, this provides basic idea of the running application.
  • Monitor : Processor consuming, memori consuming likewise utilisation detail.
  • Threads : List of entire threads, state of threads, running time, and so on.
  • Sampler : Sampling information, like CPU, memory.

Finally, I can state that VisualVM can be used to get analytics and mange Java based applications for maximum throughput. 

Thank You.

Rolling Updates & Releases

Rolling update in the sense, update the existing version of an Application, Operating system etc, without interrupting the running systems. 
Most of the LINUX distribution are consisted of the rolling updated and rolling releases, they would be able to attend the updating process while running. So the users and developers are served by best patches and updates for the existing systems.
This rolling updates used several methodologies for updates the systems. one is deliver frequent small updates and patches, as an example arch LINUX would be taken. Another one is replace the old image of the operating system with the new changes, the changes are added to the updating process. The Ubuntu cover versions is an example for this.

Benefits of using Rolling updates and releases.

  1. Easy to maintain the  enterprise level servers and datacenter and clouds with the rolling releases and updates.
  2. Automatically  software applications and servers are get updated without any interruption.
  3. Does not take too long time to upgrade to major releases as the fixed releases. Because the system updates frequently.
And there also a major disadvantage of having rolling updates, because if there is a bug in a update or new release that would be directly affected to the entire system.


But according to the review and experience most of the IT industries uses the rolling update supported systems.