Archive for February, 2011

Disabling Spanning Tree on Cisco Switches

Monday, February 21st, 2011

Spanning Tree Protocol has always been a problem with Mac OS X Server. This goes back to the early days when OS’s whacked each other over the head with rocks to go from Alpha to Beta. This usually manifests itself in weird speed and connectivity issues. You can mitigate by changing timing values, but when testing, it is often easiest to start by disabling Spanning Tree Protocol, seeing if the problems you have go away and then working from there.

By default, Spanning Tree is enabled on all Cisco Switches. In this article we’ll look at disabling Spanning Tree Protocol. But it is important to point out that once disabled, it is important to keep in mind that creating an additional VLAN automatically runs another instance of spanning tree protocol, so you may need to repeat this process in the future.

First backup the device. Then, ssh into the device:

ssh admin@64.32.49.172

You should be prompted for credentials at this time if using telnet. If you are using SSH you should only be prompted for the password. Once connected to the device you will need to go into enable mode by typing en at the command prompt and hit enter:

en

It may prompt you for a password, which you will need to know. Once complete you will notice that the prompt turns from an > to an # symbol. Now that you have administrative access, you will need to go into global configuration mode using the config t command:

config t

Now let’s actually disable spanning tree protocol. Enter in the no verb followed by spanning-tree, the protocol we’re disabling, followed by VLAN, followed by the VLAN identifier:

no spanning-tree VLAN vlan-id

Repeat for each VLAN if you need to do this on multiple. When done, exit config mode by entering the end command:

end

You can then enter the show command along with the spanning-tree option and view to see if there are any remaining spanning tree’s still active and verify if your command took:

show spanning-tree

If the command took and spanning tree is no longer enabled. Run the coppy command, followed by running-config and then startup-config, which copies your running configuration to your startup configuration making your change permanent:

copy running-config startup-config

It is then usually recommended to go ahead and reboot servers and clients prior to testing.

Backing Up Cisco Configurations Using Mac OS X

Friday, February 18th, 2011

Before you make configuration changes on devices you should make a backup of the device. You can basically use any platform you want to backup Cisco devices. Doing so in Mac OS X starts with the Terminal. So to backup a Cisco device you must first connect to the device in Terminal either through SSH or Telnet.

Then SSH to the device using the ssh command, followed by the username, an @ symbol and then the IP address or hostname of your device. Here, we’ll use an example of 64.32.49.172:

ssh admin@64.32.49.172

Note: One could also use telnet using the same type of string, but ssh is more secure.

Next, provide the password and you will see a prompt with the device name. Once connected to the device you will need to go into enable mode by typing “en” at the command prompt and hit enter. It may prompt you for an elevated privileges password, which you will need to know.

Once complete you will notice that the prompt turns from a > to a # symbol. The # symbol is akin to having root access. Now to backup the configuration of this device you will enter “show run” which is short for show running-config:

show run

You will see a ←-more→ prompt at the bottome of the page. Just hit the space bar until you are back a the prompt. Once you are at the prompt you will highlight all the text using your mouse that was just generated in the terminal and after its all highlighted hit “Command C” to copy the contents. Open your favorite text editor and use the “Command V” to paste the text. Be careful to use plain text here (I prefer to just use pico or vi rather than Word or TextEdit). Save the file as your configuration backup file for the Device.

NOTE: If you want to also get the IOS (IOS is different than iOS) version info you can run the “show version” instead of the “show run” command. And use the same steps to cut and paste.

If you cannot log into a device remotely, you can use a Keyspan adapter to use the serial port to connect to the device.

Install Powerchute Using a Script

Friday, February 11th, 2011

Here’s a little shell script that can be deployed from ARD to install and configure APC’s Powerchute Network software for Mac OS X clients. It’s currently only been tested with 2.2.4, but was used it to deploy Powerchute to 7 servers and can be quite a time saver. The only prereq is that the APC tar file be located at the path specified by variable ‘apcfile’ and the other variables in the script be completed.

Let us know if you have any questions!

### sends keystrokes to configure APC Powerchute software.

apcfile='/tmp/pcns224Mac.tar'
localadminpassword='Creative1'
nictoregister='en0'
apcip='192.168.11.220'
apcadmin='apc'
apcpassword='apc'
apcsharedsecret='apcismyfavoriteperson'

## start script
mkdir /tmp/apc_temp &> /dev/null
cd /tmp/apc_temp
tar -xf "$apcfile"

## get our IP
IP="$(ifconfig $nictoregister | awk '/inet / {print $2}' | head -1)"

open /tmp/apc_temp/install.command
sleep 3

osascript < tell application "System Events"
keystroke "$localadminpassword"
delay .2
keystroke return
delay 2
keystroke space
delay 1
keystroke space
delay 1
keystroke space
delay 1
keystroke space
delay 1
keystroke "$apcip"
delay .1
keystroke tab
delay .1
keystroke tab
delay .1
keystroke tab
delay .1
keystroke tab
delay .1
keystroke tab
delay .1
keystroke space
delay 1
keystroke tab
delay .1
keystroke "$IP"
delay .1
keystroke tab
delay .1
keystroke tab
delay .1
keystroke tab
delay .1
keystroke tab
delay .1
keystroke space
delay 1
keystroke "$apcadmin"
delay .1
keystroke tab
delay .1
keystroke "$apcpassword"
delay .1
keystroke tab
delay .1
keystroke "$apcsharedsecret"
delay .1
keystroke tab
delay .1
keystroke tab
delay .1
keystroke tab
delay .1
keystroke space

end tell
EOL