cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2670
Views
0
Helpful
7
Replies

How do you reload a switch via a config file?

Comm4nd0
Level 1
Level 1

Hi, so i have a number of 3050s with come shipped with an old IOS Version 03.07.04E. This version has a bug with the 40Gb SFPs we have. So, using ZTP i've got a config script hosted on a tftp server which downloads the new Everest firmware but i need to make the switch reboot at the end. Any ideas how i do this?

 

currently the config file that's pulled down and run during ZTP looks like this:

hostname netdevice
ip domain-name MYDOMAIN
crypto key generate rsa modulus 2048
aaa new-model
aaa authentication login default local
aaa authorization console
aaa authorization exec default local
user-name cisco
secret cisco
privilege 15
ip ssh version 2
ip ssh time-out 90
ip scp server enable
line vty 0 15
do write memory
do copy ftp://192.168.0.128/cat3k_caa-universalk9.16.06.02.SPA.bin flash:
boot system switch all flash:cat3k_caa-universalk9.16.06.02.SPA.bin
do write memory

After this is complete i'd like the switch to reboot. I've tried variations of do reload and do reload\ny but nothing seems to work.

 

Thanks in advance.

1 Accepted Solution

Accepted Solutions

tried that too, but i also don't want to wait 10 minutes. This is the version that works:

 

hostname netdevice
ip domain-name DOMAIN
crypto key generate rsa modulus 2048
aaa new-model
aaa authentication login default local
aaa authorization console
aaa authorization exec default local
user-name cisco
secret cisco
privilege 15
ip ssh version 2
ip ssh time-out 90
ip scp server enable
line vty 0 15
do write memory
do copy ftp://192.168.0.128/cat3k_caa-universalk9.16.06.02.SPA.bin flash:
boot system switch all flash:cat3k_caa-universalk9.16.06.02.SPA.bin
do write memory
!
event manager applet reload
event none sync yes
action 1.0 syslog msg "router about to reload"
action 2.0 reload
exit
!
do event manager run reload

needed the do even manager run reload at the end. i'm 100% new to EEM but it makes sense now. You build your command then run it when ready. pretty cool

View solution in original post

7 Replies 7

Mark Malone
VIP Alumni
VIP Alumni
did you try do reload in 5 then write

Seb Rupik
VIP Alumni
VIP Alumni

Hi there,

Why don't you use an EEM script, something like:

!
event manager applet RELOAD
  event time countdown time 10
  action 1.0 cli command "reload"
!

 

cheers,

Seb.

 

 

Do i simply add that on to the end of my script?

Yes, a similar technique is used with APIC-EM builds on some switches.

 

https://communities.cisco.com/community/developer/dna/blog/2016/11/15/next-generation-network-deployment-plug-and-play-part7

 

cheers,

Seb.

So i just tried this...

 

hostname netdevice
ip domain-name SOMEDOMAIN
crypto key generate rsa modulus 2048
aaa new-model
aaa authentication login default local
aaa authorization console
aaa authorization exec default local
user-name cisco
secret cisco
privilege 15
ip ssh version 2
ip ssh time-out 90
ip scp server enable
line vty 0 15
do write memory
do copy ftp://192.168.0.128/cat3k_caa-universalk9.16.06.02.SPA.bin flash:
boot system switch all flash:cat3k_caa-universalk9.16.06.02.SPA.bin
do write memory
!
event manager applet RELOAD
  action 1.0 cli command "reload"
!

But nothing happened. it's like it just ignored the event manager line. What did i do wrong? remember this is on a 3850 IOS-XE Version 03.07.04E. Is the syntax correct?

 

The is the output on the terminal:

Would you like to enter the initial configuration dialog? [yes/no]:
Loading config.sh from 192.168.0.128 (via Vlan1): !
[OK - 559 bytes]
The name for the keys will be: netdevice.SOMEDOMAIN

% The key modulus size is 2048 bits
% Generating 2048 bit RSA keys, keys will be non-exportable...
[OK] (elapsed time was 4 seconds)

Building configuration...
Compressed configuration from 4421 bytes to 1843 bytes[OK]
Destination filename [cat3k_caa-universalk9.16.06.02.SPA.bin]?
Accessing ftp://192.168.0.128/cat3k_caa-universalk9.16.06.02.SPA.bin...
Loading cat3k_caa-universalk9.16.06.02.SPA.bin !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!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!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
[OK - 409853870/4096 bytes]

409853870 bytes copied in 313.540 secs (1307182 bytes/sec)
Building configuration...
Compressed configuration from 4489 bytes to 1904 bytes[OK]
Startup-config is ignored. So, HTTP Secure server configuration not done


Press RETURN to get started!

What happened to the

event time countdown time 10

..line?

 

!
event manager applet RELOAD
  event time countdown time 10
  action 1.0 cli command "reload"
!

 

 

tried that too, but i also don't want to wait 10 minutes. This is the version that works:

 

hostname netdevice
ip domain-name DOMAIN
crypto key generate rsa modulus 2048
aaa new-model
aaa authentication login default local
aaa authorization console
aaa authorization exec default local
user-name cisco
secret cisco
privilege 15
ip ssh version 2
ip ssh time-out 90
ip scp server enable
line vty 0 15
do write memory
do copy ftp://192.168.0.128/cat3k_caa-universalk9.16.06.02.SPA.bin flash:
boot system switch all flash:cat3k_caa-universalk9.16.06.02.SPA.bin
do write memory
!
event manager applet reload
event none sync yes
action 1.0 syslog msg "router about to reload"
action 2.0 reload
exit
!
do event manager run reload

needed the do even manager run reload at the end. i'm 100% new to EEM but it makes sense now. You build your command then run it when ready. pretty cool

Review Cisco Networking for a $25 gift card