×

Warning message

  • Cisco Support Forums is in Read Only mode while the site is being migrated.
  • Cisco Support Forums is in Read Only mode while the site is being migrated.

Saving all routers configuration by one command in GNS3.

Answered Question
Oct 3rd, 2013
User Badges:
  • Gold, 750 points or more
  • Почетные Знаки Сообщества,

    Лучшая публикация, Декабрь 2013

When working with GNS need to save the configuration on each device separately, so that it can be saved as a file in the GNS on exit. I thought this problem as follows:


Available:

In my case, the virtual topology GNS (CCNP-CCIE) of 12 routers.

Model at all: 2691.

Version: (C2691-ADVENTERPRISEK9-M), Version 12.4 (23)


I created an additional router called it SAVER (IP 10.100.100.1), connected it to a network switch pseudo GNS via FastEthernet. Next, all 12 routers connected to this switch. Set up IP addressing, so that all the routers could see 10.100.100.1 ip address. Within this network is only allowed ICMP traffic. Next to each of the 12 routers I enter the following commands (give an example of one of the routers, since the rest are all identical):



# Enable the console output from the monitor reactions

ip sla monitor logging traps

ip sla monitor reaction-configuration 1 connection-loss-enable timeout-enable threshold-falling 5000 action-type trapOnly

# Create a monitor

ip sla monitor 1

# Use the IP address of the router SAVER, sending frequency and timeouts. These parameters can regulate themselves.

type echo protocol ipIcmpEcho 10.100.100.1

timeout 250

frequency 2

#Launch Monitor

ip sla monitor schedule 1 life forever start-time now



Next, create an applet that will save the configuration and based on the response of the monitor:


event manager applet saving

# If you encounter the following message, perform an action

event syslog pattern "%RTT-4-OPER_TIMEOUT"

action 1 cli command "enable"

action 2 cli command "write"

# At the end to display a message to the console

action 3 syslog msg "Configuration Successfully Saved. You can save GNS project and close it"


Next on the router SAVER create an applet that will provoke the message "%RTT-4-OPER_TIMEOUT" on other routers:


event manager applet saver

#When you enter the save command to run the applet

event cli pattern "save" sync yes

action 1.1 cli command "enable"

action 1.2 cli command "conf t"

# In my case, I used the Fa0/0, you can set up your interface

action 1.3 cli command "interface Fa0/0"

action 1.4 cli command "shutdown"

# Because in my version of IOS there is no commands Wait, I pull time, by generating syslog messages. The lower the frequency of sending ICMP on other routers, the more time you need to pull that load monitor.

action 2.10 syslog msg "Saving Configuration Please Wait"

action 2.11 syslog msg "Saving Configuration Please Wait"

action 2.12 syslog msg "Saving Configuration Please Wait"

action 2.13 syslog msg "Saving Configuration Please Wait"

action 2.14 syslog msg "Saving Configuration Please Wait"

action 2.15 syslog msg "Saving Configuration Please Wait"

action 2.16 syslog msg "Saving Configuration Please Wait"

action 2.17 syslog msg "Saving Configuration Please Wait"

action 2.18 syslog msg "Saving Configuration Please Wait"

action 2.19 syslog msg "Saving Configuration Please Wait"

action 2.20 syslog msg "Saving Configuration Please Wait"

action 2.21 syslog msg "Saving Configuration Please Wait"

action 3.4 cli command "no shutdown"

action 3.5 cli command "end"

action 3.6 cli command "write"



Result: enter the command save, and after 1-2 seconds, all configurations are stored on your routers.

If you are using TACACS then you need to specify the Event Manager user who has privileges.

If you do not have free FastEthernet interfaces on routers, we can arrange it all through routing, but it can create some problems.



To me this solution saves time, offer your solutions, thank you for your attention.





Correct Answer by cadet alain about 3 years 10 months ago

Hi,

I've made it work with ssh, in the batch file:

D:\Alain\Desktop\putty.exe -ssh -l alain   -pw cisco -m D:\Alain\Desktop\test.txt  192.168.10.254

And on the router:

line vty 0 15

login local

privilege level 15


Regards


Alain



Don't forget to rate helpful posts.

Correct Answer by cadet alain about 3 years 10 months ago

Hi,

Yes you're right, GNS3 will save the startup and if you don't copy the running to startup then GNS3 will do nothing for you.

I like your EEM script but why not use a script with putty to send the wr command on all routers and do a cron job for this script ? Wouldn't it be simpler ?


Regards


Alain


Don't forget to rate helpful posts.

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 5 (5 ratings)
Loading.
burleyman Thu, 10/03/2013 - 13:21
User Badges:
  • Blue, 1500 points or more

If you are working on a project you can make GNS3 save all the configs when you save the project...nothing extra needed. But like the EEM stuff.


Mike

Vitaliy Zinatov Thu, 10/03/2013 - 22:34
User Badges:
  • Gold, 750 points or more
  • Почетные Знаки Сообщества,

    Лучшая публикация, Декабрь 2013

Its true but it save startup-configs not running-configs or am I wrong?

Correct Answer
cadet alain Fri, 10/04/2013 - 01:03
User Badges:
  • Purple, 4500 points or more

Hi,

Yes you're right, GNS3 will save the startup and if you don't copy the running to startup then GNS3 will do nothing for you.

I like your EEM script but why not use a script with putty to send the wr command on all routers and do a cron job for this script ? Wouldn't it be simpler ?


Regards


Alain


Don't forget to rate helpful posts.

Vitaliy Zinatov Fri, 10/04/2013 - 02:10
User Badges:
  • Gold, 750 points or more
  • Почетные Знаки Сообщества,

    Лучшая публикация, Декабрь 2013

Thanks for the advice, to be honest I did not even consider this option. Today I'll try.

Vitaliy Zinatov Fri, 10/04/2013 - 04:31
User Badges:
  • Gold, 750 points or more
  • Почетные Знаки Сообщества,

    Лучшая публикация, Декабрь 2013

I tried the option suggested by you, but something I can not. So


I created a script file (r1.txt)  with the following content:


enable

write


Then i created batch file with the following content:


D:\putty\putty.exe -telnet -m D:\putty\r1.txt -P 2106 127.0.0.1


When i run this batch file i recieve folowing output:


Connected to Dynamips VM "R1" (ID 5, type c2691) - Console port

Press ENTER to get the prompt.


or , If I press enter, enter configuration mode, close the terminal window and run the script again:


Connected to Dynamips VM "R1" (ID 5, type c2691) - Console port

Press ENTER to get the prompt.

E{M'}T

R1#p}

R1#









cadet alain Fri, 10/04/2013 - 05:37
User Badges:
  • Purple, 4500 points or more

Hi,

I've got the same behaviour here, I'm going to investigate and let you know.


Regards


Alain



Don't forget to rate helpful posts.

Correct Answer
cadet alain Fri, 10/04/2013 - 06:55
User Badges:
  • Purple, 4500 points or more

Hi,

I've made it work with ssh, in the batch file:

D:\Alain\Desktop\putty.exe -ssh -l alain   -pw cisco -m D:\Alain\Desktop\test.txt  192.168.10.254

And on the router:

line vty 0 15

login local

privilege level 15


Regards


Alain



Don't forget to rate helpful posts.

Actions

This Discussion