Applying a Smartport Macro to an Interface - dummies

Applying a Smartport Macro to an Interface

By Edward Tetz

Applying a Smartport macro to a Cisco network interface is as easy as creating a macro. You can apply a macro to either a single interface or a range of interfaces. When you apply a macro to an interface range, the macro is individually applied to each interface in the range, sequentially. Even if the macro fails to be applied to an interface, the processing will continue on the other interfaces in the range.

First, look at the interface to which you want to apply,for example, your Awesome_Macro (in this case interface FastEthernet0/4) to see whether any configuration is currently applied to the interface. The interface is completely unconfigured, as seen by the lack of commands between the lines interface FastEthernet0/4 and end.

Switch1> enable
Switch1#show running-config interface FastEthernet 0/4
Building configuration...
Current configuration : 33 bytes
interface FastEthernet0/4

To apply a Smartport macro to an interface, you access Interface Configuration mode on the interface to which you want to apply the macro. As shown in the following output, you use the macro apply command to apply a specific macro to the selected interface.

In the following example, notice how the VLAN_ID parameter is applied, as well as how it is identified when using the context-sensitive help.

Switch1> enable
Switch1# configure terminal 
Switch1(config)#interface FastEthernet 0/4
Switch1(config-if)#macro apply Awesome_Macro ?
  WORD  Keyword to replace with a value e.g. $VLAN_ID
Switch1(config-if)# macro apply Awesome_Macro $VLAN_ID 5