ElKono

Cisco… what else…

Tag Archives: Cisco

Daily Backup from Cisco Router Configuration with SCP (Secure Copy)

hi,

today I let you know how you can do a “secure” automatic backup from your router configuration… let’s go! I’ve done it with an Windows Server 2003 as backup server you can also try it with a Linuxbox 😉

Note: the username and password are stored in cleartext in the config.

Download & Install OpenSSH for windows (http://sshwindows.sourceforge.net)

  • Install default
  • open services.msc -> start OpenSSH server

Create a local user:

  • User: cisco
  • Pass: secure
    • Add user to local ADMINISTRATOR group (otherwise you cannot connect)

open cmd

  • cd “\Program Files\OpenSSH\bin\”
  • mkgroup –l >> ..\etc\group
  • mkpasswd –l >> ..\etc\passwd
    • this 2 cmds creates local group & user files

open  regedit

  • HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\Cygwin\mounts v2/home2
    • Change key “native” from “C:\Documents and Settings” to your Backup Drive i.e. “e:\”
    • Now you can change the homepath from “/home/cisco” in the passwd file to “/”

open services.msc and start this service -> “OpenSSH”

Now test with putty if you can connect to this SSH Server

  • 127.0.0.1 port 22
  • User: cisco
  • Pass: secure

Now we have to configure the router that it does the backup automatically.

Variables:

  • $h = hostname
  • $t = time (command does not work fine – better leave it away)

Path: save path
Write-memory – when you save manually he will save also via SCP
Time-period: 1440 Minutes -> daily backup | 10080 weekly backup

Connect to router via SSH and execute following commands

router# conf t
router(config)# archive
router(config-archive)# path scp://cisco:secure@10.10.10.10//cygdrive/e/backup/network/switch/$h/$t-$h
router(config-archive)# write-memory
router(config-archive)# time-period 1440
router(config-archive)# exit
router(config)# exit
router# write memory

You are done!

Every time you do a write memory – it will also save via SCP!

[best regs]
elkono

Advertisements

CISCO IOS Recovery 3750X and 3560X with USB flash drive

Today i get a call from a customer that he had deleted the whole flash from his 3560X switch and when he restarted the switch it won’t come up… why? 😉

so i told him that without the .bin image on the flash it’s not possible that the switch will run…

What can i do?

You can do an IOS recovery… but not with the very slow xmodem  (i know you can tune it up to !WOW! 115kbps)… but nowadays with an USB flash drive…

Here you can see how it works:

NOTE: Not all USB flash drives are supported, hence my recommendation to get several ready.

1. USB pen drive max. 16GB format as FAT16
2. copy the .bin image onto the flash drive
3. disconnect the switch from power
4. connect the flash drive to the switch
5. hold the “mode” button on the switch, give power, hold the button until the SYST LED flashes only green fast and when it is green and stop flashing hold on 2 seconds and then leave the button, otherwise it will boot “normaly”  (takes about ca. 30-40 seconds)
6. switch: flash_init
7. …wait… (it could be that the switch will hang on —more— push enter and it will go on, try it)
8. switch: dir usbflash0:       !!check if the switch can read from USB
9. switch: copy usbflash0:IOS-IMAGE.bin flash: IOS-IMAGE .bin        !!copy the image from usb to flash
10. switch: boot flash: IOS-IMAGE .bin        !! with this command the switch boots up with the image immediately
11. conf t      !! enter to conf t
12. boot system flash:.bin      !! don’t forget to set the image as bootvar 😉
13. wr mem       !! and save it, so it will boot also when it get powered off 😉

I tried it also to recover the IOS image with TFTP via the management port… but it doesn’t worked for me… it get not up the management port, so i couldn’t copy the file from TFTP to FLASH…

[best regs]
elkono