Spanning tree protocol

Q. What is it?

A.The whole point of spanning tree is to stop loops from occurring in the network.

Q. How did the loops get there in the first place?

A. As a network admin you put them there by design to add redundancy to your network. By having multiple links going between switches the chance of a failure is reduced. However if a broadcast is sent across the network it can endlessly loop around the redundant links, causing your network to go down.

And now for the big question. How does it work?

 

802.1D The original spanning tree (STP)

2_zpsloyqhh1c

Sends out bridge protocol data units ( BPDU ) to find loops in the network.

Inside the BPDU is the bridge priority of the switch and its MAC address. Not only does it help find loops, but it also helps the switches decide the best way to get around the network and discover if a link has gone down.

By default a BDPU is sent out every 2 seconds

The bridge priority has a range of 0 – 65536 with the default set in the middle at 32768

To find the best way around the network a root bridge/switch is elected. The election is won by the switch with the lowest bridge priority. If two switches have the same bridge ID then the switch with the lowest MAC address is declared the winner.

Note: older switches normally have a lower mac address than newer switches. So if spanning tree is left unconfigured then the oldest switch becomes the root bridge. And that can be really bad!

After the root bridge is elected all the switches in the network converge to find the best path to the root bridge. Once the best path is found everything left over gets blocked.

Each port has a cost based on speed. Least total cost of all the ports determines the best path to root bridge.

Root port is the port used to reach the root bridge

Designated port is forwarding. There can only be one designated port per link

Root bridge has all designated ports

stp1_zpskkftvebbstp2_zpsemu9s0eg

STP port states:

Disabled
Listening 15 seconds listening for BPDUs and sending BPDUs
Learning 15 seconds learning MAC addresses, populating the CAM table
Forwarding Traffic is being forwarded
Blocking 20 seconds (max-age) waiting before listening again

STP port roles:

Root port The port used to get to the root bridge
Designated port Port used to forward traffic

 

The new 802.1W Rapid spanning tree (RSTP)

Sends BPDU then immediately puts the port in a discarding state. The neighboring switch will decide if the BPDU is superior and send a request to transition the port to a forwarding state. Then the neighbor will put its ports in a discarding state and the process repeats itself until the network converges. However if the BPDU is not superior then the neighbor will do nothing and the port will remain in a discarding state.

Notice how there are no timers, making RSTP very fast to converge

Note: RSTP is reverse compatible with STP

RSTP port states:

Discarding Replaces disabled, blocking and listening
Learning
Forwarding

RSTP port roles:

Root port The port used to get to the root bridge
Designated port Port used to forward traffic
Alternate port Backup for root port (alternate path to root) discarding
Backup port Backup for designated port on shared medium like a hub

 

PerVLAN spanning tree PVST+ and RPVST

On a Cisco device each VLAN has its own instance of spanning tree running. Advantages of this is that you can set a different different root bridge on each VLAN allowing the traffic to be load balanced between the core switches.

3 different ways Cisco does this:

PVST
Cisco proprietary, only works with ISL and not 801.2q meaning that it will not work with equipment from a different vendor

PVST+
Also Cisco proprietary however uses 802.1q so it will play nice with other vendors equipment and is reverse compatible with PVST

Rapid-PVST+
Same as PVST+ except its for RSTP 802.1w. This is also proprietary

 

PortFast

Before RSTP Cisco used port fast to speed up the failure recovery time of spanning tree. This is done by allowing access ports only to skip spanning tree all together and go straight to forwarding.

Warning! even though port fast cannot be configured on a trunk port two switches can be hooked together on an access port and cause a loop.

BPDU guard watches non-trunk ports for BPDUs and blocks them (errdisable) if one is detected.

Note:
Access ports only
There is also uplinkfast and backbone fast but they are not mentioned in the exam.

 

Memory tables for spanning tree

3 rules of spanning tree
1. Determine the center of the network
2. Find the fastest way to the center of the network
3. Block anything left over

STP RSTP Port included in topology Port learning MAC addresses
Disabled Discarding No No
Blocking Discarding No No
Listening Discarding Yes No
Learning Learning Yes Yes
Forwarding Forwarding Yes Yes
Link Bandwidth STP Cost RSTP Cost
10Mbps 100 2,000,000
100Mbps 19 200,000
1Gbps 4 20,000
10Gbps 2 2,000

 

 

 

This post is a part of my notes on Cisco CCNA exam and is only meant as a reference and not a complete study guide.

 

Installing Maya 2015 on a Debian based Linux

Installing Autodesk Maya 2015 onto my Debian/Ubuntu/Frankenstein Linux was much more challenging then I initially anticipated. so I thought I would post a quick work instruction for anyone trying to do the same thing.

Note that this assumes that you have some basic knowledge of terminal in Linux and you already have a copy of Maya extracted and ready to install.

First of all Maya needs to be installed onto a 64bit Linux to work. To check if your Linux is 64bit open up a terminal and type:

uname -m

If it comes back with x86_64 then your good to go. If not you can always download and install a 64bit version of your distro.

Step 1: We need to install a whole bunch of programs first that Maya needs to be able to run.

 

sudo apt-get install -y alien
sudo apt-get install -y csh tcsh libaudiofile-dev libglw1-mesa elfutils
sudo apt-get install -y gamin libglw1-mesa-dev mesa-utils xfs xfstt
sudo apt-get install -y ttf-liberation xfonts-100dpi xfonts-75dpi
sudo apt-get install -y ttf-mscorefonts-installer

Step 2: Next we need to convert the maya’s installer .rpm files into .deb files.

 

Note: last time I did this I had a problem with the Composite package installing and making a huge mess, its not necessary for Maya to run so its best to delete it

sudo alien -cv *.rpm

 

Step 3: Install the newly converted .deb files

dpkg -i *.deb

 

Step 4: Now that its installed run the installer to licence the application. It will fail to install but it will add your licence to maya.

Now that the installation is complete its time to fix all the bugs.

Bug 1: Copy across the libraries that were missed in the installation.

sudo cp <maya installation directory>/libadlmPIT* /usr/lib/
sudo cp <maya installation directory>/libadlmutil* /usr/lib/

 

Bug 2: Add a temp folder for mental ray to cache stuff to

sudo mkdir /usr/tmp
sudo chmod 777 /usr/tmp

 

Bug 3: Maya is going to complain about not having the correct version of libssl even though it doesnt come with that version, but that can be easily fixed.

sudo ln -s /usr/autodesk/maya2015-x64/support/openssl/libssl.so.6 /usr/autodesk/maya2015-x64/lib/libssl.so.10
sudo ln -s /usr/autodesk/maya2015-x64/support/openssl/libcrypto.so.6 /usr/autodesk/maya2015-x64/lib/libcrypto.so.10

 

Bug 4: Maya cannot find the systems tiff or jpg librarys because Red Hat puts them in a different place to Debian.

sudo apt-get install libjpeg62:i386
sudo ln -s /usr/lib/x86_64-linux-gnu/libjpeg.so.8.0.2 /usr/lib/libjpeg.so.62
sudo ln -s /usr/lib/x86_64-linux-gnu/libtiff.so.5 /usr/lib/libtiff.so.3

creating a sym link to the files works well in 2014 but I find that it doesn’t always work for 2015. So instead we need to modify the maya file in Maya’s bin directory.

sudo vim /usr/autodesk/maya2015-x64/bin/maya

search for the line:
setenv LIBQUICKTIME_PLUGIN_DIR “$MAYA_LOCATION/lib”

Directly under that line add the following:
# I added the next line to fix a jpg problem
setenv LD_PRELOAD /usr/lib/x86_64-linux-gnu/libjpeg.so.62

Bug 5: When trying to generate 3d text in maya it wont work because all the fonts on the debian system are the wrong type. To convert them we need to use t1ascii to convert them to the correct type one by one…. but I’m lazy so I just wrote a script to do it for me.

 

for x in `find /usr/share/fonts -name *.pfb`
do
y=$(sed s/.[^.]*$// <<< $x)
t1ascii $x $y.pfa
done
xset +fp /usr/share/fonts/X11/100dpi/
xset +fp /usr/share/fonts/X11/75dpi/
xset fp rehash

 

 

A few other notes:
Most of the commands need to be run as root.
If your not comfortable with command line text editors your can always launch gedit from the command line by typing ‘gksudo gedit’ which will launch a graphic text editor.
I wrote this little article at some ridiculous hour in the morning so it may have some mistakes.

If you are stuck and want to ask a question or if you have any suggestions feel free to comment 🙂

Installing Pixar RenderMan for Maya on Debian based Linux

I found out from a friend at work that Pixar RenderMan engine is now free for non-commercial use. I was so exited that when work was over I raced home to install it! but there was a problem… RenderMan for Linux only comes in Red Hat flavour which means it will not install natively on Debian, Ubuntu or Linux Mint. Not that something like that has ever slowed me down before! But just in case I forget how I did it I decided to write it down here.

 

Step 1: Go to this URL and sign up to the RenderMan forums to download the installer

http://rendermansite.pixar.com/view/get-renderman

 

Step 2: Convert the .rpm installer file into a .deb with alien

cd ~/Downloads

sudo alien -v *.rpm

sudo dpkg -i *.deb

This doesn’t install RenderMan, it just installs a program to download and install RenderMan.

 

Step 3: Install Renderman

cd /opt/pixar/RenderManNC-Installer/bin

sudo ./RenderManNC-Installer

Screenshot from 2015-05-11 190506_zpsdpm2zuo1

You’ll get a wizzard style installer, just follow the prompts to install the software.

This will fail to install the software because the packages it downloads are for Red Hat. But the good news is it leave behinds the .rpm files to be converted by alien

 

Step 4: Install RenderMan! for real this time

The installer was kind enough to put the .rpm files into my ~/Downloads folder.

sudo alien -v *.rpm

sudo dpkg -i *.deb

 

Step 5: With the install all done one last thing remains, getting Maya to use RenderMan

cd /usr/autodesk/maya2015-x64/modules

gksudo gedit RenderMan_for_Maya.mod

add the followin line:

+ RenderMan_for_Maya <RMS version> /opt/pixar/RenderManStudio-<RMS version>-maya<Maya version>

open maya

go to the pluging manager

Window → settings/preferences → plug-in manager

tick the loaded tick box to enable renderman

Screenshot from 2015-05-11 210547_zpszynthlxc

Now that the install is all done and RenderMan is loaded into Maya its time to have some rendering fun!

Testing out a little WebGL