Script - Convert INE Initial Configs for your own rack

One of the problems I ran into with my own rack was that my hardware does not exactly match the hardware that INE used to setup their Intiial Configs for the workbooks.  As there are quite a few sets of intial configs per workbook, I wrote a script that will convert the Initial Configs you can download from your account into whatever you need for your own lab.

For instance, I use GNS3 for all of my routers.  That means that on R1, s0/0/0 should be s0/0, and s0/1/0 should be s0/1.  I also prefer my devices to be named R1, R2, SW1, SW2, etc instead of INE's format.  Under the "### REPLACEMENT DEFINITIONS ###' section of the script, I have this for R1:

push (@r1match, "hostname.*");
push (@r1set, "hostname R1
push (@r1match, "Serial0/0/0");
push (@r1set, "s0/0");
push (@r1match, "Serial0/1/0");
push (@r1set, "s0/1"); 

The match uses regex to match ALL LINES in the config file that match, not necessarily just the first one or the one you want.

All you should need to update is the section for each device under ### REPLACEMENT DEFINITIONS ### to match what you need to alter.  Drop the script in the same directory as the INE-supplied inital configs and run!  The script will output next files in the format "Device-converted.cfg" and will not change the original files.


  • I'm not planning on updating this script -- this is something I made for my own personal use, and it works fine for me.  If you want to edit it and improve it, please post your updates in this thread and I'll update this post with the enhanced version.  There is a lot more that could be done with it as far as options, and not having to edit the script directly.  
  • If you are a programmer by trade, don't make fun of my inefficient code -- I'm a Network Engineer, not a perl guy!
  • You should be comfortable with basic REGEX in order to effectively use this.  Some perl knowledge would be a plus.
  • The script assumes that you have a dedicated BB1 router and a dedicated frame relay switch.  If you are combining BB1 and your frame relay switch, comment out or remove lines 89-90, 98-99, and 272 to 275.
  • The script opens each file in a gedit tab by default.  If you're running this on Windows (no guarantee that will work!), don't have gedit, or think this functionality is dumb, comment out or delete lines 442 to 466.


You can get the script here:

You will need to save the file into the directory that the initial configs from INE are in, edit the script to your needs, and run.  Perl is (obviously) required, but there are no special module dependencies.




Sign In or Register to comment.