Please note that I have moved this blog and you will be redirected to the new page @

Friday, July 23, 2010

Reset startup configs in GNS3 (and some nifty always-there aliases)

So after having manually reset my CCIE-lab of 10 devices (11 counting the FRS) about 5 times I got bored and wrote an extremely simple shell script that does it for me. And of course, don't forget to include a few aliases that really saves typing. Not to mention the risk of typos. I mean, how many times have you done "show run |include" by misstake? If you can't see what's wrong with the command than these aliases are not for you!

HOWTO reset the startup-config in GNS?

1) Paste the following into all your devices. Don't forget to add another carriage return after "wr erase" so that you don't have to [confirm] manually.
wr erase

You figure this would do it but nope, it doesn't. You need to..

2) Shut down all your devices (the big red button in GNS3) and then run this script:


for host in R1 R2 R3 R4 R5 R6 SW1 SW2 SW3 SW4 FRS
  echo "Resetting $host"
  echo "hostname $host" > $PATH/$host.cfg
  echo "alias exec srb sh run | begin" >> $PATH/$host.cfg
  echo "alias exec sri sh run | include" >> $PATH/$host.cfg
  echo "alias exec srr sh run | begin ^router" >> $PATH/$host.cfg
  echo "alias exec srs sh run | section" >> $PATH/$host.cfg
And in case you're wondering, if you don't do step 2 as suggested here you have to right click on every device, choose "Startup config" and then delete everything from the text field. And of course, click OK.


  1. Hi,

    i am not good in scripting so i just copy/paste the directory path of new configs of the new exercises in the INE workbook into the .net file.

    e.g. C:\GNS3\INE\ALL Config workbooks\15 - IP Services Solutions 14.10.11\r1.cfg

  2. Great Article
    Cyber Security Projects

    projects for cse

    Networking Security Projects

    JavaScript Training in Chennai

    JavaScript Training in Chennai

    The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training