Posted by: Mudassir Ali | May 21, 2010

Create Macros for Cisco Switches

Create Macros for Cisco Switches

You can create macros to run a series of commands on a Cisco switch. This can be handy if you’re logged in to a remote device and want to change the configuration, but doing so will mean you lose management access part-way through. You can define a macro and run it; even though you lose management access part way through, the macro will continue to run.

To configure the macro: Enter configuration mode Use the command macro name Enter the commands you want the macro to run Finish with @

The example below shows how to change the management VLAN from 1 to 100. Removing the IP address from the current management VLAN will disconnect your telnet session, but the macro will still execute the rest of the commands.

config t

macro name Change-vlan

interface Vlan1

no ip address


interface vlan100

ip address

no shutdown @

To run the macro:

macro global apply Change-vlan

The above tip is specific to Catalyst IOS that runs on very specific switches (like the 2950) and is not a standard in the majority of the remaining IOS versions available. Please refer to the configuration guide below for more information:


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: