Backing up Brocade switch configurations

Brocade switches have become one of the most widely deployed componets in most Storage Area Networks (SANs). One thing that has led to Brocade’s success is their robust CLI, which allow you to view and modify almost every aspect of their switch. This includes zoning configurations, SNMP attributes, domain ids, switch names and network addresses, etc. All of this configuration information is necessary for the switch to function properly, and should be periodically backed up to allow speedy recovery when disaster hits.

Each Brocade switch comes with the “configUpload” and “configDownload” commands to back up a switch configuration to a remote system, or to restore a configuration from a remote system. ConfigUplaod has two modes of oepration: interactive mode and automatic mode. To use the interactive mode to upload a config from a switch named switch1 to an ftp server with the IP address 1.2.3.4, configUpload can be run to walk you through backing up the configuration:

switch1:admin> configupload
Server Name or IP Address [host]: 1.2.3.4
User Name [user]: matty
File Name [config.txt]: switch1_config.txt
Protocol (RSHD or FTP) [rshd]: ftp
Password:
upload complete

After the configuration is uploaded, you will have a text file with you switches configuration on the remove server:

$ ls -l sw*

-rw-r--r--   1 matty    other       7342 Jul  7 09:15 switch1_config.txt

To restore a configuration, you can use the configDownload command. Both of these commands allow the paramters to be passed as arguments to the script, so they are ideal for automation (there is a backup script on the Brocade support site that can be used to automate configuration backups). In case others find it useful, I placed my Brocade cheat sheet on my website.

8 thoughts on “Backing up Brocade switch configurations”

  1. I wrote this script in Python to automagically get the configs from my switches. I like it better than the AutoFTP upload because I can cron it according to my schedule. Also, this does store the password in the script and uses telnet (which clear texts the password). I did use SCP, which encrypts the configuration. I don’t have an SSH version yet.

    #! /usr/bin/env python

    # This script uploads the config from the supplied IP to the
    # brocade user’s home directory on a ssh-enabled host

    # This does not appear to work pre BOS 5.3 – it can work, but a read_all() call is required.

    # PARAMETERS
    # IPADDR: The IP address of the switch

    import telnetlib
    import sys

    # initialize variables
    user = “admin”
    password = “switchadminpassword”
    IPADDR = sys.argv[1]

    # open connection to switch
    tn = telnetlib.Telnet(IPADDR)

    # enter user name
    tn.read_until(“login: “)
    tn.write(user + “\n”)

    # enter password
    tn.read_until(“Password: “)
    tn.write(password + “\n”)

    # send configupload command
    uploadcommand = “configupload -p scp SSHHOSTIPADDRESS,brocade,\”/home/brocade/” + IPADDR + “\”\n”
    tn.write(uploadcommand)

    # stupid command does not allow for password entry while using scp
    # so wait for it to ask and then enter it.
    tn.read_until(“password: “)
    tn.write(password + “\n”)

    # wait for the command to complete
    #tn.read_until(“are uploaded”)

    # get out
    tn.write(“exit\n”)

    # we’re done.

  2. Hi,

    I have made a program based inspired on your script.

    You can find it on google code.
    the name of the project is save-simply-your-san.

    It’s easy and you can use it and provide me a feedback. Thank you.

Leave a Reply

Your email address will not be published. Required fields are marked *