Macros, called smartport macros by Cisco, are groups of commands saved with reference names. Macros are useful when you find yourself entering the same group of commands repeatedly. For example, say youâre adding a lot of servers. Every time you add a server, you execute the same configuration commands for the switch interface to be used for that server. You could create a macro that would execute all of the commands automatically and then simply reference this macro every time you add a new server to the switch.
You create macros are created with the
macro command. There are
two types of macros: global and
interface. An interface macro (the default type) is applied to one or
more interfaces. To make a macro global, include the
global keyword when creating it.
The way macros are created is a little strange, because the commands
are not parsed as you enter them. As a result, you can enter invalid
commands without causing errors. First, enter the
command. Because youâre not including the
global keyword, this will be an interface macro.
Then, enter the commands youâd like to include in the macro, one by one.
These commands are not checked for syntax. When youâre done entering
commands, put an at sign (
@) on a line
Here, Iâve created a macro named SetServerPorts. The commands
hhhhhh (an invalid
description <[ Server
macro name SetServerPorts Enter macro commands one per line. ...