NEXUS run-script

I ran across the run-script command for the Nexus the other day. It’s very helpful for putting the base config on the switch. This is especially nice for configuring vPC’s, peer link config, port channels, anything that is ‘easy’ to mess up. First create a cut sheet in notepad with the appropriate commands. Next copy the file to a storage device on the Nexus. If you don’t have TFTP/FTP/SCP access or want to work smarter, check out this link for creating files in IOS. http://blog.ioshints.info/2008/03/phase-2-upload-text-files-through.html

Finally issue the run-script command with the parameter of the location of the file you created above.

-Example-

config terminal
feature eigrp
feature interface-vlan
feature netflow
feature hsrp
feature lacp
vlan 500
name ManagementVLAN_192.168.255.0/24
int vlan 5
ip address 192.168.255.1/24
(save the file as base.config)

NEXUS-7K-1# run-script bootflash:base.config
‘configure terminal’  
Enter configuration commands, one per line. End with CNTL/Z.  
‘feature eigrp’
‘feature interface-vlan’
‘feature netflow’
‘feature hsrp’
‘feature lacp’
‘vlan 500’
‘name ManagementVLAN_192.168.255.0/24’
‘int vlan 5’
‘ip address 192.168.255.1/24’

*There’s a sleep command you can also put in your configuration file-

sleep 10

That will cause IOS to wait 10 seconds before continuing to issue commands. Helpful in things like configuring SSH via the script. The maximum wait time is 2,147,483,647 seconds…that’s 68 years! I can think of a fun prank to play on a junior engineer…

Leave a Reply

Your email address will not be published. Required fields are marked *