Semi-automated method of importing configs into GNS3

Hello

I ran into the following problem today: I need to import configs into my GNS3 topology but:

  • the configs to be imported are txt files formatted like R1.txt, R2.txt etc
  • my gns3 project folder has subfolders named after the device ID, e.g.  a32ebfcf-1011-46ef-a864-144ad35746aa with startup-config.cfg files inside them
  • txt configs have gigabit interfaces and not ethernet like my gns3 configs

Solution:

  1. I use Ecobyte’s Replace Text tool to replace gigabit1 string in all files in a given file hierarchy with ethernet0/0 string
  2. I copy my R1.txt, R2.txt into the folder with a specific gns3 project folder (each subfolder here is one IOU device)
  3. I have prepared a cmd .bat file that does the following for each txt file, e.g.

move R5.txt a32ebfcf-1011-46ef-a864-144ad35746aa\
del a32ebfcf-1011-46ef-a864-144ad35746aa\startup-config.cfg
ren a32ebfcf-1011-46ef-a864-144ad35746aa\R5.txt startup-config.cfg

To make things easier, you can create one project BASICPROJECT, change all the ids for R1 to be all 1s (remember to change IDs in the .gns3 file, too!!!), and then load that project and save as NEWPROJECT. IDs will stay the same and the .bat file ids can stay the same, too.

gns3structure

I change IDs also in the .gns3 file (each ID needs to be changed in two places!)

Place1

„name”: „R1”,
„node_id”: „11111111-1111-1111-1111-111111111111”,
„node_type”: „iou”,

Place2

text”: „e0/0”,
„x”: 55,
„y”: 54
},
„node_id”: „11111111-1111-1111-1111-111111111111”,
„port_number”: 0

My modified .bat file also looks much better now:

move R5.txt 55555555-5555-5555-5555-555555555555\
del 55555555-5555-5555-5555-555555555555\startup-config.cfg
ren 55555555-5555-5555-5555-555555555555\R5.txt startup-config.cfg

So once these one-off changes in the folder names and .gns3 project files are done, now every time I have to import new .txt files because i e.g. need InitialRipConfig, i ONLY:

  • copy the .txt files with the configs (R1.txt, R2.txt etc.) and the .bat file into a gns3 project folder and I run the .bat file. Magic.

 

It may not be the most elegant solution, but it works.

 

Reklamy

Skomentuj

Wprowadź swoje dane lub kliknij jedną z tych ikon, aby się zalogować:

Logo WordPress.com

Komentujesz korzystając z konta WordPress.com. Wyloguj /  Zmień )

Zdjęcie na Google

Komentujesz korzystając z konta Google. Wyloguj /  Zmień )

Zdjęcie z Twittera

Komentujesz korzystając z konta Twitter. Wyloguj /  Zmień )

Zdjęcie na Facebooku

Komentujesz korzystając z konta Facebook. Wyloguj /  Zmień )

Połączenie z %s