Cisco Systems 2940 Switch User Manual


 
10-3
Catalyst 2940 Switch Software Configuration Guide
78-15507-02
Chapter 10 Configuring SmartPort Macros
Configuring Smart-Port Macros
The no form of the macro name global configuration command only deletes the macro definition. It
does not affect the configuration of those interfaces on which the macro is already applied. You can
delete a macro-applied configuration on an interface by entering the default interface interface-id
interface configuration command. Alternatively, you can create an anti-macro for an existing macro that
contains the no form of all the corresponding commands in the original macro. Then apply the
anti-macro to the interface.
This example shows how to define the desktop-config macro for an access switch interface, apply the
macro to Fast Ethernet interface 0/9, add a description to the interface, and verify the configuration.
Switch(config)#macro name desktop-config
# Put the switch in access mode
switchport mode access
# Allow port to move to forwarding state quickly
spanning-tree portfast
# BPDUs should not be sent into the network
spanning-tree bpduguard enable
# Restrict the port to one address -- that of desktop
switchport port-security maximum 1
# Put all data traffic in vlan 1
switchport access vlan 1
@
Switch(config)#interface fastethernet0/9
Switch(config-if)#macro apply desktop-config
Switch(config-if)#macro description desktop-config
Switch(config-if)#end
Switch#show parser macro name desktop-config
Macro name : desktop-config
Macro type : customizable
macro description desktop-config
# Put the switch in access mode
switchport mode access
# Allow port to move to forwarding state quickly
spanning-tree portfast
# BPDUs should not be sent into the network
spanning-tree bpduguard enable
# Restrict the port to one address -- that of desktop
switchport port-security maximum 1
# Put all data traffic in vlan 1
switchport access vlan 1
Switch#show parser macro description
Interface Macro Description
Step 4
macro {apply | trace} macro-name Apply each individual command defined in the macro to the interface by
entering macro apply macro-name. Specify macro trace macro-name
to apply and print each command before it is applied to the interface.
Step 5
macro description text (Optional) Enter a description about the macro that is applied to the
interface.
Step 6
end Return to privileged EXEC mode.
Step 7
show parser macro Verify that the macro was created.
Step 8
show running-config interface
interface-id
Verify that the macro is applied to an interface.
Step 9
copy running-config startup-config (Optional) Save your entries in the configuration file.
Command Purpose