Monday, December 28, 2009

Script to turn off PoE power using Energywise

My environment: Cisco 3560E

Besides shutting down the switchport, you can turn off the PoE power via the Energywise command.  Before you run this script, setup your energywise domain with the command “energywise domain panda security shared-secret eatsbamboo”


set timeout 5
log_user 1
set hostlist "pandasw01"
set prompt "pandasw01"
foreach host $hostlist {
#set prompt [append $host "#"]
set promptcfg [append $prompt "(config)#"]
spawn telnet $host
expect $prompt
send "conf t\r"
expect $promptcfg
send "int range fa0/1 - 23\r"
expect $promptcfg
send "energywise level 0\r"
expect $promptcfg
send "end\r"
expect $prompt
send "exit\r"

Script to Turn off Cisco Autonomous Access Point radio interface

My environment: Cisco 861W

You can turn off the radio interface of the autonomous AP when you don’t use it to save power.


set timeout 5
log_user 1
set hostlist "pandaap01"
foreach host $hostlist {
set prompt [append $host "#"]
set promptcfg [append $prompt "(config)#"]
spawn telnet $host
expect $prompt
send "conf t\r"
expect $promptcfg
send "int dot11radio0\r"
expect $promptcfg
send "shut\r"
expect $promptcfg
send "end\r"

Friday, December 18, 2009

Script to backup Cisco Device Config

A handy expect script on Linux to backup your routers, switches, AP, or other IOS devices configuration.  Make sure you have “expect” installed on your Linux box.


set timeout 5
log_user 1

# Include your hosts in the hostlist
set hostlist "rt01 rt02 sw01 sw02"
foreach host $hostlist {
set prompt [append $host "#"]
spawn telnet $host
expect $prompt
send "term len 0\r"
expect $prompt
set time [exec date \+\%y\%m\%dT\%H\%MJ]
set filename [append host "-" $time]

# The config file storage location
log_file /home/pandaeatsbamboo/cfgbackup/$filename
send "show run\r"
expect $prompt
send "exit\r"

Latest Cisco Collaboration Demo by John and Jim

Cisco vs Aruba – 60-client High Density Test

Auto Smartports Macros

My environment: Cisco 3560E, IOS 12.2(53)SE

Auto Smartports Macros is a feature that provide easy and automatic way in deploying switchport configuration based on the endpoint types.  The device is identified based on CDP, MAC address, OUI etc.

To enable Auto Smartports:

macro auto global processing

You might want to change the Auto Smarport Macro default value say for example the access and voice vlan, say for example if you want to change the IP phone access vlan to 10 and voice vlan to 20:

macro auto device phone ACCESS_VLAN=10 VOICE_VLAN=20

to verify the change, type:

show macro auto device


If the end device doesn’t support CDP, you can classify the device based on OUI (the first 3 bytes of the MAC address) or full MAC address.  Say for example you want to use mac address trigger for your digital media player (DMP) which is not defined in the default OUI list.

macro auto mac-address group DMP-MAC-GROUP

mac-address list 000f.1234.5678


to verify, type:

show macro auto address-group

To see which port applies what macros:

show macro auto interface


show run interface gi0/16


Tuesday, December 15, 2009

CIFS Mounted Drive for Apache

My environment: Apache 2.2.9 on Fedora Core 10 x86_64

Although it is not a good idea to do something like this, I’ve come across a case that I need to mount a CIFS drive and serve the content inside for an apache web server on Linux.  After some googling, the trick to make this work is to turn off a parameter called EnableSendfile in httpd.conf

# EnableSendfile: Control whether the sendfile kernel support is
# used to deliver files (assuming that the OS supports it).
# The default is on; turn this off if you serve from NFS-mounted
# filesystems.  Please see
EnableSendfile off

Sunday, December 6, 2009

IPv6 PTR Record configuration in BIND

My environment: RedHat Fedora Core 12 x86_64

BIND version: bind-9.6.1-11.P1.fc12.x86_64

Let’s see an example how to configure IPv6 reverse lookup record in BIND.

Forward Lookup:

www   AAAA   2001:123:45:678:20c:29ff:fe6a:7f93

It just like normal IPv4 host record, except it is a “AAAA” record instead of an “A” record.

Reverse Lookup zone configuration in named.conf:

zone "" {
        type master;
        file "2001.123.45.678-db";

The name of the zone is the reverse of the /64 prefix 2001:123:45:678::/64

In the reverse lookup zone file, the PTR record is:

3.9.f.7.a.6.e.f.f.f.9.2.c.0.2.0   IN   PTR   www

The PTR record is the reverse of the host portion of the IPv6 address.

Try a dig -x 2001:123:45:678:20c:29ff:fe6a:7f93 and see if the BIND server replies with the reverse lookup record correctly.

IPv6 Tunnel Broker Setup on IOS router

My environment: Cisco 2801 router

IOS version: 12.4(24)T1 Advanced Enterprise

I have registered an account on Hurricane Electric, it is free and you will get an tunnel IPv6 address and a routed /64 block IPv6 address. Follow the below steps to get your tunnel working:

1. Enable IPv6 unicast routing

 ipv6 unicast routing

2. Configure your tunnel to HE

interface Tunnel0
description IPv6 tunnel to HE Tunnel Broker
no ip address
ipv6 address <Your Tunnel IPv6 Address>
ipv6 enable
tunnel source <Your Internet facing interface>
tunnel destination <HE tunnel destination IPv4 address>
tunnel mode ipv6ip

3. Configure your LAN-facing interface

interface FastEthernet0/0
ip address <LAN IP address>
ipv6 address <The routed /64 address provided by HE>
ipv6 enable
ipv6 nd prefix
<The prefix of the routed /64 address>

4. Create a IPv6 default route

ipv6 route ::/0 Tunnel0

5. If you doesn’t have a fixed Internet IP address, you can use the DDNS service to update the tunnel IP address

ip ddns update method v6tunnelbroker
interval maximum 1 0 0 0
interval minimum 1 0 0 0

interface FastEthernet0/1
ip ddns update v6tunnelbroker host


You should be able to access the IPv6 Internet now!  Try to access from a PC behind the router!

Tuesday, December 1, 2009

Date/Time Group settings not effective on IP Phone

UCM Version:

IP Phone: 7942, 7965 with firmware version 8.5.2SR1

Normally if you want different phones to display time in different timezone, you can create multiple Date/Time Group and then apply to the respective Device Pool on UC Manager.  I’ve found it is not working on my UC Manager.  I tried to change the time zone from GMT to

(GMT+8:00) Asia/Hong_Hong

It doesn’t work.  The phone still shows the GMT timezone.  Other settings like I’ve change the Separator to “-“ dash, the changes is effective on the phone, only the timezone is not working.  After some research I’ve found that my phone load 8.5.2SR1 or even the latest 8.5.3, only support the timezone with the “*” entry.  In my case, change it to

(GMT+8:00) Australia/Perth*

and it works like a charm!