Backup a Dell 2824 Switch from Command Line
Hi All – ever need to backup your Dell 2824 Managed Switch? If so…you know that the only way to do this is by the Web UI. Which isn’t very helpful if you want to keep your switch configuration backed up automatically. Read on for our solution!
Impatient? Me, too…to just Get the Code download sab-dell2824-backup-sh.txt here. Then rename it to
sab-dell2824-backup.sh and whale away with it. Have fun!
Today’s article addresses a shortcoming in the Dell 2824 SMB workgroup switch. While these are nice enough machines – VLAN tags (802.1Q), auto-negotiation, and port bonding come to mind – they do *not* have a very good command line interface (CLI). While a rudimentary CLI does exist, it’s missing both
show running-config and
copy running-config [tftp://dest]. (Not to mention that the CLI can only be connected to using
telnet – eck.)
However, I have some of these beasts under my purview so I must manage them. And when they are managed I want backups – without depending on an admin to login to the switch and use the “File Upload” menu command.
So I finally sat down and wrote the code to do this. It’s all in
bash and uses curl. Let’s get down to it.
To handle this, I do the following:
- Treat each part of the interaction separately. I create necessary work files with a number to clearly indicate the processing order.
- Drive everything from variables. You’ll notice in the below that almost all of the variables passed to curl are defined in the shell script’s configuration section. That’s to isolate changes as much as possible.
- Account for errors. Actually, in the script as I have it there’s not that much error checking. I depend on curl for most operations, and keep my own error checking to a minimum. I would do more error checking but the script just ended up taking too much time. Perhaps some other person will be inspired to improve it?
Rather than writing a tome on shell script processing, I’ll just present the code as-is. Hope it’s useful!
Here’s some expected output:
[root@mysrv foo]# ./sab-dell2824-backup.sh Logging in to Dell2824...OK Configure switch for logged-in user...OK Finishing session setup for logged-in user...OK Checking switch copy history...OK Querying switch for download instructions...OK (index: 84) Downloading switch configuration via HTTP to 'Dell2824-config-20150122.cfg'...OK (6745 bytes) Checking to see if we got a good download...OK (6745 bytes) Checking switch copy history...delete index 84...OK Logging out of Dell2824...OK
That is all.