Table Of Contents
Auto Smartports and Static Smartports Macros CLI Commands
debug macro
macro
macro auto
macro auto control
macro auto device
macro auto execute
macro auto file
macro auto global control
macro auto global processing
macro auto mac-address-group
macro auto sticky
macro description
macro global
macro global description
shell trigger
show macro auto
show parser macro
show shell
Auto Smartports and Static Smartports Macros CLI Commands
•
debug macro
•
macro
•
macro auto
•
macro auto control
•
macro auto device
•
macro auto execute
•
macro auto file
•
macro auto global control
•
macro auto global processing
•
macro auto mac-address-group
•
macro auto sticky
•
macro description
•
macro global
•
macro global description
•
shell trigger
•
show macro auto
•
show parser macro
•
show shell
debug macro
To enable debugging of the Auto Smartports macro activity, use the debug macro privileged EXEC command. Use the no form of this command to disable debugging.
debug macro {action | all | api | common | detector | policydir | server | xml}
no debug macro {action | all | api | common | detector | policydir | server | xml}
Syntax Description
action
|
Displays all action debug messages.
|
all
|
Displays all debug messages.
|
api
|
Displays all API debug messages.
|
common
|
Displays common debug messages.
|
detector
|
Displays detector error debug messages.
|
policydir
|
Displays policy director debug messages.
|
server
|
Displays server debug messages.
|
xml
|
Display XML debug messages.
|
Command Default
Debugging is disabled.
Command Modes
Privileged EXEC
Command History
Release
|
Modification
|
12.2(52)SE
|
This command was introduced on the Catalyst 3750-E, 3750, 3560-E, 3560, 2975, 2960, and 2918 switches.
|
12.2(53)SE2
|
This command was introduced on the Catalyst 3750-X and 3560-X switches.
|
Usage Guidelines
The undebug macro command is the same as the no debug macro command.
When you enable debugging on a switch stack, it is enabled only on the stack master. To enable debugging on a stack member, you can start a session from the stack master by using the session switch-number privileged EXEC command. Then enter the debug command at the command-line prompt of the stack member. You also can use the remote command stack-member-number LINE privileged EXEC command on the stack master switch to enable debugging on a member switch without first starting a session.
Related Commands
Command
|
Description
|
show debugging
|
Displays information about the enabled types of debugging.
|
macro
To apply a macro to an interface or to apply and debug a macro on an interface, use the macro interface configuration command.
macro {apply | trace} macro-name [parameter {value}] [parameter {value}]
[parameter {value}]
Syntax Description
apply
|
Applies a macro to an interface.
|
trace
|
Applies a macro to an interface and then debugs it.
|
macro-name
|
Specifies the name of the macro.
|
parameter value
|
(Optional) Specifies unique parameter values that are specific to the interface. You can enter up to three keyword-value pairs. Parameter keyword matching is case sensitive. All matching occurrences of the keyword are replaced with the corresponding value.
|
Command Default
This command has no default setting.
Command Modes
Interface configuration
Command History
Release
|
Modification
|
12.1(19)EA1
|
This command was introduced on Catalyst 3750 and 3560 switches.
|
12.2(18)SE
|
The parameter value keywords were added on Catalyst 3750 and 3560 switches.
|
12.2(25)FX
|
This command was introduced on Catalyst 2960 switches.
|
12.2(44)SE
|
This command was introduced on Catalyst 2918 switches.
|
12.2(46)EX
|
This command was introduced on Catalyst 2975 switches.
|
12.2(35)SE2
|
This command was introduced on the Catalyst 3750-E and 3560-E switches.
|
12.2(53)SE2
|
This command was introduced on the Catalyst 3750-X and 3560-X switches.
|
Usage Guidelines
You can use the macro apply macro-name interface configuration command to apply and show the macros running on an interface.
You can use the macro trace macro-name interface configuration command to apply and then debug the macro to find any syntax or configuration errors.
If a command fails because of a syntax error or a configuration error when you apply a macro, the macro continues to apply the remaining commands to the interface.
When creating a macro that requires the assignment of unique values, use the parameter value keywords to designate values specific to the interface.
Keyword matching is case sensitive. All matching occurrences of the keyword are replaced with the corresponding value. Any full match of a keyword, even if it is part of a larger string, is considered a match and is replaced by the corresponding value.
Some macros might contain keywords that require a parameter value. You can use the macro apply macro-name ? command to display a list of any required values in the macro. If you apply a macro without entering the keyword values, the commands are invalid and are not applied.
There are Cisco-default Smartports macros embedded in the switch software. You can display these macros and the commands that they contain by using the show parser macro user EXEC command.
Follow these guidelines when you apply a Cisco-default Smartports macro on an interface:
•
Display all macros on the switch by using the show parser macro user EXEC command. Display the contents of a specific macro by using the show parser macro name macro-name user EXEC command.
•
Keywords that begin with $ mean that a unique parameter value is required. Append the Cisco-default macro with the required values by using the parameter value keywords.
The Cisco-default macros use the $ character to identify required keywords. You can use the $ character to define keywords when you create a macro.
When you apply a macro to an interface, the macro name is automatically added to the interface. You can display the applied commands and macro names by using the show running-config interface interface-id user EXEC command.
A macro applied to an interface range behaves the same way as a macro applied to a single interface. When you use an interface range, the macro is applied sequentially to each interface within the range. If a macro command fails on one interface, it is still applied to the remaining interfaces.
You can delete a macro-applied configuration on an interface by entering the default interface interface-id interface configuration command.
Examples
After you use the macro name global configuration command, you can apply it to an interface. This example shows how to apply a user-created macro called duplex to an interface:
Switch(config-if)# macro apply duplex
To debug a macro, use the macro trace interface configuration command to find any syntax or configuration errors in the macro as it is applied to an interface.
Switch(config-if)# macro trace duplex
Applying command...`duplex auto'
Applying command...`speed nonegotiate'
This example shows how to display the Cisco-default cisco-desktop macro and how to apply the macro and set the access VLAN ID to 25 on an interface:
Switch# show parser macro cisco-desktop
--------------------------------------------------------------
Macro name : cisco-desktop
# Basic interface - Enable data VLAN only
# Recommended value for access vlan (AVID) should not be 1
switchport access vlan $AVID
# Enable port security limiting port to a single
# MAC address -- that of desktop
switchport port-security maximum 1
# Ensure port-security age is greater than one minute
# and use inactivity timer
switchport port-security violation restrict
switchport port-security aging time 2
switchport port-security aging type inactivity
# Configure port as an edge network port
spanning-tree bpduguard enable
--------------------------------------------------------------
Switch# configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)# interface gigabitethernet1/0/4
Switch(config-if)# macro apply cisco-desktop $AVID 25
Related Commands
Command
|
Description
|
macro description
|
Adds a description about the macros that are applied to an interface. This is a mandatory command for Auto Smartports to work.
|
macro global
|
Applies a macro on a switch or applies and traces a macro on a switch.
|
macro global description
|
Adds a description about the macros that are applied to the switch.
|
show parser macro
|
Displays the macro definition for all macros or for the specified macro.
|
macro auto
To configure and apply a global macro, use the macro auto privileged EXEC command. Use the no form of this command to return to the default setting.
Using the CLI:
macro auto {apply | config} macro-name
Using the Cisco IOS shell scripting capability:
macro auto apply macro-name
macro auto config macro-name [parameter=value [parameter=value] ...]
Syntax Description
apply
|
Applies the macro.
|
config
|
Enters the macro parameters.
|
macro-name
|
Specifies the macro name.
|
parameter=value [parameter=value] ...
|
parameter=value—Replaces values for global macro parameter values. Enter values in the form of name value pair separated by a space: <name1>=<value1> [<name2>=<value2>...].
|
Command Default
No macros are applied to the switch.
Command Modes
Privileged EXEC
Command History
Release
|
Modification
|
12.2(55)SE
|
This command was introduced on the Catalyst 3750-X, 3750-E, 3750, 3560-X, 3560-E, 3560, 2975, 2960, and 2918 switches.
|
Usage Guidelines
To remove the macro from the switch, enter the no forms of the macro commands.
If you enter the macro auto config macro-name command, you are prompted to enter values for all the macro parameters.
Use the exact text string when entering the macro-name and parameters. The entries are case sensitive.
The user-defined values appear only in the show macro auto or show running-config command output.
Examples
To display global macros:
Switch# macro auto apply ?
CISCO_SWITCH_AAA_ACCOUNTING Configure aaa accounting parameters
CISCO_SWITCH_AAA_AUTHENTICATION Configure aaa authentication parameters
CISCO_SWITCH_AAA_AUTHORIZATION Configure aaa authorization parameters
CISCO_SWITCH_AUTO_IP_CONFIG Configure the ip parameters
CISCO_SWITCH_AUTO_PCI_CONFIG Configure PCI compliant parameters
CISCO_SWITCH_DOMAIN_NAME_CONFIG Configure domain name
CISCO_SWITCH_ETHERCHANNEL_CONFIG Configure the etherchannel parameters
CISCO_SWITCH_HOSTNAME_CONFIG Configure hostname
CISCO_SWITCH_HTTP_SERVER_CONFIG Configure http server
CISCO_SWITCH_LOGGING_SERVER_CONFIG Configure logging server
CISCO_SWITCH_MGMT_VLAN_CONFIG Configure management vlan parameters
CISCO_SWITCH_NAME_SERVER_CONFIG Configure name server parameters
CISCO_SWITCH_NTP_SERVER_CONFIG Configure NTP server
CISCO_SWITCH_RADIUS_SERVER_CONFIG Configure radius server
CISCO_SWITCH_SETUP_SNMP_TRAPS Configure SNMP trap parameters
CISCO_SWITCH_SETUP_USR_CONFIG Configure the user parameters
CISCO_SWITCH_SNMP_SOURCE_CONFIG Configure snmp source interface
CISCO_SWITCH_TACACS_SERVER_CONFIG Configure tacacs server
CISCO_SWITCH_USER_PASS_CONFIG Configure username and password
Switch# macro auto config ?
CISCO_SWITCH_AAA_ACCOUNTING Configure aaa accounting parameters
CISCO_SWITCH_AAA_AUTHENTICATION Configure aaa authentication parameters
CISCO_SWITCH_AAA_AUTHORIZATION Configure aaa authorization parameters
CISCO_SWITCH_AUTO_IP_CONFIG Configure the ip parameters
CISCO_SWITCH_AUTO_PCI_CONFIG Configure PCI compliant parameters
CISCO_SWITCH_DOMAIN_NAME_CONFIG Configure domain name
CISCO_SWITCH_ETHERCHANNEL_CONFIG Configure the etherchannel parameters
CISCO_SWITCH_HOSTNAME_CONFIG Configure hostname
CISCO_SWITCH_HTTP_SERVER_CONFIG Configure http server
CISCO_SWITCH_LOGGING_SERVER_CONFIG Configure logging server
CISCO_SWITCH_MGMT_VLAN_CONFIG Configure management vlan parameters
CISCO_SWITCH_NAME_SERVER_CONFIG Configure name server parameters
CISCO_SWITCH_NTP_SERVER_CONFIG Configure NTP server
CISCO_SWITCH_RADIUS_SERVER_CONFIG Configure radius server
CISCO_SWITCH_SETUP_SNMP_TRAPS Configure SNMP trap parameters
CISCO_SWITCH_SETUP_USR_CONFIG Configure the user parameters
CISCO_SWITCH_SNMP_SOURCE_CONFIG Configure snmp source interface
CISCO_SWITCH_TACACS_SERVER_CONFIG Configure tacacs server
CISCO_SWITCH_USER_PASS_CONFIG Configure username and password
To display the parameters for a specific macro:
Switch# macro auto config CISCO_SWITCH_AUTO_IP_CONFIG ?
CISCO_SWITCH_DOMAIN_NAME_CONFIG domain name parameters
CISCO_SWITCH_LOGGING_SERVER_CONFIG logging host parameters
CISCO_SWITCH_NAME_SERVER_CONFIG name server parameters
CISCO_SWITCH_NTP_SERVER_CONFIG ntp server parameters
LINE Provide parameters of form [Parameters
Switch# macro auto config CISCO_SWITCH_AUTO_PCI_CONFIG ?
CISCO_SWITCH_AAA_ACCOUNTING aaa accounting parameters
CISCO_SWITCH_AAA_AUTHENTICATION aaa authentication parameters
CISCO_SWITCH_AAA_AUTHORIZATION aaa authorization parameters
CISCO_SWITCH_HTTP_SERVER_CONFIG http server parameters
CISCO_SWITCH_RADIUS_SERVER_CONFIG radius server parameters
CISCO_SWITCH_TACACS_SERVER_CONFIG tacacs server parameters
LINE Provide parameters of form [Parameters
Switch# macro auto config CISCO_SWITCH_SETUP_SNMP_TRAPS ?
CISCO_SWITCH_SNMP_SOURCE_CONFIG snmp source parameters
LINE Provide parameters of form [Parameters
Switch# macro auto config CISCO_SWITCH_SETUP_USR_CONFIG ?
CISCO_AUTO_TIMEZONE_CONFIG timezone parameters
CISCO_SWITCH_HOSTNAME_CONFIG hostname parameter
LINE Provide parameters of form [Parameters
To set macro parameters and apply the macro using the CLI:
Switch# macro auto config CISCO_SWITCH_ETHERCHANNEL_CONFIG
Enter the port channel id[1-48] for 3K & 2350,[1-6] for 2K: 2
Enter the port channel type, Layer:[2-3(L3 not supported on 2K)]: 2
Enter etherchannel mode for the interface[auto/desirable/on/active/passive]: active
Enter the channel protocol[lacp/none]: lacp
Enter the number of interfaces to join the etherchannel[8-PAGP/MODE:ON,16-LACP]: 7
Enter interface name[GigabitEthernet3/0/3]: gigabitethernet1/0/1
Enter interface name[GigabitEthernet3/0/3]: gigabitethernet1/0/2
Enter interface name[GigabitEthernet3/0/3]: gigabitethernet1/0/3
Enter interface name[GigabitEthernet3/0/3]: gigabitethernet1/0/4
Enter interface name[GigabitEthernet3/0/3]: gigabitethernet1/0/5
Enter interface name[GigabitEthernet3/0/3]: gigabitethernet1/0/6
Enter interface name[GigabitEthernet3/0/3]: gigabitethernet1/0/7
Do you want to apply the parameters? [yes/no]: yes
Enter configuration commands, one per line. End with CNTL/Z.
Enter configuration commands, one per line. End with CNTL/Z.
Enter configuration commands, one per line. End with CNTL/Z.
Enter configuration commands, one per line. End with CNTL/Z.
Enter configuration commands, one per line. End with CNTL/Z.
Enter configuration commands, one per line. End with CNTL/Z.
Enter configuration commands, one per line. End with CNTL/Z.
Switch# macro auto apply CISCO_SWITCH_ETHERCHANNEL_CONFIG
Enter configuration commands, one per line. End with CNTL/Z.
You can also use the Cisco IOS shell scripting capability to set the parameters. For examples, see the "Configuring and Applying Global Macros" section in the "Configuring Auto Smartports and Static Smartports Macros" chapter.
Related Commands
Command
|
Description
|
macro auto execute
|
Configures mapping from an event trigger to a built-in macro.
|
macro auto global processing
|
Enables Auto Smartports on a switch.
|
show macro auto
|
Displays information about macros.
|
show shell
|
Displays information about event triggers and macros.
|
macro auto control
To specify when the switch applies an Auto Smartports macro based on the detection method, device type, or trigger (referred to as event trigger control), use the macro auto control interface configuration command. Use the no form of this command to disable trigger-to-macro mapping. The switch then does not ai pply macros based on event triggers.
macro auto control {detection [cdp] [lldp] [mac-address] | device [access-point] [ip-camera]
[lightweight-ap] [media-player] [phone] [router] [switch] | trigger [last-resort]}
no macro auto control {detection [cdp] [lldp] [mac-address] | device [access-point] [ip-camera]
[lightweight-ap] [media-player] [phone] [router] [switch] | trigger [last-resort]}
Syntax Description
detection [cdp] [lldp] [mac-address]
|
detection—Sets one or more of these as an event trigger:
• (Optional) cdp—CDP messages
• (Optional) lldp—LLDP messages
• (Optional) mac-address—User-defined MAC address groups
|
device [access-point] [ip-camera] [lightweight-ap] [media-player] [phone] [router] [switch]
|
device—Sets one or more of these devices as an event trigger:
• (Optional) access-point—Autonomous access point
• (Optional) ip-camera—Cisco IP video surveillance camera
• (Optional) lightweight-ap—Lightweight access point
• (Optional) media-player—Digital media player
• (Optional) phone—Cisco IP phone
• (Optional) router—Cisco router
• (Optional) switch—Cisco switch
|
trigger [last-resort]
|
trigger—Sets a specific event trigger.
• (Optional) last-resort—Last-resort trigger.
|
Command Default
The switch uses the device type as the event trigger. If the switch cannot determine the device type, it uses MAC address groups, MAB messages, 802.1x authentication messages, and LLDP messages in random order.
Command Modes
Interface configuration
Command History
Release
|
Modification
|
12.2(55)SE
|
This command was introduced on the Catalyst 3750-X, 3750-E, 3750, 3560-X, 3560-E, 3560, 2975, 2960, and 2918 switches.
|
Usage Guidelines
If you do not set event triggers, the switch uses the device type as the event trigger. If the switch cannot determine the device type, it uses MAC address groups, MAB messages, 802.1x authentication messages, and LLDP messages in random order.
To verify that a macro is applied to an interface, use the show macro auto interface user EXEC command.
Examples
To set LLDP messages and MAC address groups as event triggers:
Switch# configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)# interface gigabitethernet 5/0/2
Switch(config-if)# macro auto control detection lldp mac-address
To set access points, video surveillance cameras, and digital media players as event triggers:
Switch# configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)# interface gigabitethernet 5/0/1
Switch(config-if)# macro auto control device access-point ip-camera media-player
The switch applies a built-in macro only when it detects an access point, video surveillance camera, or digital media player.
Related Commands
Command
|
Description
|
macro auto execute
|
Configures mapping from an event trigger to a built-in macro.
|
macro auto global processing
|
Enables Auto Smartports on a switch.
|
macro auto mac-address-group
|
Configures MAC address groups.
|
macro auto sticky
|
Configures macro persistence.
|
shell trigger
|
Creates event triggers.
|
show macro auto
|
Displays information about macros.
|
show shell
|
Displays information about event triggers and macros.
|
macro auto device
To replace macro default parameter values with values that are specific to your switch, use the macro auto device global configuration command. Use the no form of this command to remove the parameter values.
macro auto device {access-point | ip-camera | lightweight-ap | media-player | phone | router |
switch} [parameter=value]
no macro auto device {access-point | ip-camera | lightweight-ap | media-player | phone | router
| switch} [parameter=value]
Syntax Description
access-point
|
Replaces the access-point default parameter value: NATIVE_VLAN=1
|
ip-camera
|
Replaces the IP video surveillance camera default parameter value: ACCESS_VLAN=1
|
lightweight-ap
|
Replaces the lightweight access point default parameter value: ACCESS_VLAN=1
|
media-player
|
Replaces the digital media player default parameter value: ACCESS_VLAN=1
|
phone
|
Replaces the IP phone default parameter values: ACCESS_VLAN=1 VOICE_VLAN=2
|
router
|
Replaces the router default parameter value: NATIVE_VLAN=1
|
switch
|
Replaces the switch default parameter value: NATIVE_VLAN=1
|
parameter=value
|
(Optional) Replaces the macro default parameter values. Enter new values in the form of name value pair separated by spaces: [<name1>=<value1> <name2>=<value2>...]
|
Command Default
Macro default parameter values are defined previously.
Command Modes
Global configuration
Command History
Release
|
Modification
|
12.2(52)SE
|
This command was introduced on the Catalyst 3750-E, 3750, 3560-E, 3560, 2975, 2960, and 2918 switches.
|
12.2(53)SE2
|
This command was introduced on the Catalyst 3750-X and 3560-X switches.
|
Usage Guidelines
Use the macro auto device global configuration command to replace macro default parameter values with values that are specific to your switch. Use the no form of this command to remove the parameter values.
Use the show macro device privileged EXEC command to display the contents of the macros. Use the parameter=value keywords to replace default parameter values within a specific macro.
You can also use the macro auto execute global configuration command to specify default parameter values. This command also requires that you specify an event trigger and a built-in or user-defined macro. If you enable both the macro auto device and the macro auto execute commands, the parameters specified in the command last executed is applied to the switch. Only one command is active on the switch.
To verify that a macro is applied to an interface, use the show macro auto interface user EXEC command.
Examples
This example shows how to display the IP phone macro parameter values, enable the IP phone macro, and change the default voice VLAN to 20:
Switch# show macro auto device phone
Default Macro:CISCO_PHONE_AUTO_SMARTPORT
Current Macro:CISCO_PHONE_AUTO_SMARTPORT
Configurable Parameters:ACCESS_VLAN VOICE_VLAN
Defaults Parameters:ACCESS_VLAN=1 VOICE_VLAN=2
Current Parameters:ACCESS_VLAN=1 VOICE_VLAN=2
Switch# configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)# macro auto device phone VOICE_VLAN=20
Switch# show macro auto device phone
Default Macro:CISCO_PHONE_AUTO_SMARTPORT
Current Macro:CISCO_PHONE_AUTO_SMARTPORT
Configurable Parameters:ACCESS_VLAN VOICE_VLAN
Defaults Parameters:ACCESS_VLAN=1 VOICE_VLAN=2
Current Parameters:VOICE_VLAN=20
Related Commands
Command
|
Description
|
macro auto execute
|
Configures mapping from an event trigger to a built-in macro.
|
macro auto global processing
|
Enables Auto Smartports on a switch.
|
macro auto mac-address-group
|
Configures MAC address groups.
|
macro auto sticky
|
Configures macro persistence.
|
shell trigger
|
Creates event triggers.
|
show macro auto
|
Displays information about macros.
|
show shell
|
Displays information about event triggers and macros.
|
macro auto execute
To replace built-in macro default values and to configure mapping from an event trigger to a built-in or user-defined macro, use the macro auto execute global configuration command.
macro auto execute event trigger {[builtin built-in macro name] | [remote url]}
[parameter=value]
macro auto execute event trigger [parameter=value] [{ function contents }]
no macro auto execute event trigger {[builtin built-in macro name] | [remote url]}
[parameter=value]
no macro auto execute event trigger [parameter=value] [{ function contents }]
Syntax Description
event trigger
|
Defines mapping from an event trigger to a built-in macro.
Specifies an event trigger:
• CISCO_CUSTOM_EVENT
• CISCO_DMP_EVENT
• CISCO_IPVSC_EVENT
• CISCO_LAST_RESORT_EVENT
• CISCO_PHONE_EVENT
• CISCO_ROUTER_EVENT
• CISCO_SWITCH_EVENT
• CISCO_WIRELESS_AP_EVENT
• CISCO_WIRELESS_LIGHTWEIGHT_AP_EVENT
• WORD—Apply a user-defined event trigger such as a MAC address group.
|
builtin built-in macro name
|
(Optional) Specifies a builtin built-in macro name:
• CISCO_AP_AUTO_SMARTPORT Specify the parameter value: NATIVE_VLAN=1.
• CISCO_DMP_AUTO_SMARTPORT Specify the parameter value: ACCESS_VLAN=1.
• CISCO_IPVSC_AUTO_SMARTPORT Specify the parameter value: ACCESS_VLAN=1.
• CISCO_LWAP_AUTO_SMARTPORT Specify the parameter value: ACCESS_VLAN=1.
• CISCO_PHONE_AUTO_SMARTPORT Specify the parameter values: ACCESS_VLAN=1 and VOICE_VLAN=2.
• CISCO_ROUTER_AUTO_SMARTPORT Specify the parameter value: NATIVE_VLAN=1.
• CISCO_SWITCH_AUTO_SMARTPORT Specify the parameter value: NATIVE_VLAN=1.
|
parameter=value
|
(Optional) parameter=value—Replaces default values for parameter values shown for the bultin-macro name, for example, ACCESS_VLAN=1. Enter new values in the form of name value pair separated by a space: [<name1>=<value1> <name2>=<value2>...].
|
{function contents}
|
(Optional) {function contents} Specifies a user-defined macro to associate with the trigger. Enter the macro contents within braces. Begin the Cisco IOS shell commands with the left brace and end the command grouping with the right brace.
|
remote url
|
(Optional) Specifies a remote server location:
• The syntax for the local flash file system on the standalone switch or the stack master: flash:
• The syntax for the local flash file system on a stack member: flash member number:
• The syntax for the FTP: ftp:[[//username[:password]@location]/directory]/filename
• The syntax for an HTTP server: http://[[username:password]@]{hostname | host-ip}[/directory]/filename
• The syntax for a secure HTTP server: https://[[username:password]@]{hostname | host-ip}[/directory]/filename
• The syntax for the NVRAM: nvram://[[username:password]@][/directory]/filename
• The syntax for the Remote Copy Protocol (RCP): rcp:[[//username@location]/directory]/filename
• The syntax for the Secure Copy Protocol (SCP): scp:[[//username@location]/directory]/filename
• The syntax for the TFTP: tftp:[[//location]/directory]/filename
|
Command Default
This command has no default setting.
Command Modes
Global configuration
Command History
Release
|
Modification
|
12.2(50)SE
|
This command was introduced on the Catalyst 3750-E, 3750, 3560-E, 3560, 2960, and 2918 switches. It replaced the macro name global configuration command.
|
12.2(52)SE
|
The remote keyword and url argument were added on the Catalyst 3750-E, 3750, 3560-E, 3560, 2960, and 2918 switches.
The command was introduced on Catalyst 2975 switches.
|
12.2(53)SE2
|
This command was introduced on the Catalyst 3750-X and 3560-X switches.
|
Usage Guidelines
Use the macro auto execute global configuration command to replace the built-in macro default values with values that are specific to your switch.
The switch automatically maps from event triggers to built-in macros. The built-in macros are system-defined macros in the software image. You can also create user-defined macros by using the Cisco IOS shell scripting capability.
You can create new event triggers by using the shell trigger global configuration commands. Use the show shell triggers privileged EXEC command to display the contents of the user-defined triggers and macros.
You can use the macro auto mac-address-group global configuration command to create event triggers for devices that do not support Cisco Discovery Protocol (CDP) or Link Layer Discovery Protocol (LLDP).
You can use the remote macro feature to store macros in a central location for designated network switches to use. You can then maintain and update the macro files for use by multiple switches. Use remote url to configure the remote server location and macro path information. There are no specific file extension requirements for saved macro files.
Auto Smartports macros and antimacros (the antimacro is the portion of the applied macro that removes it at link down) have these guidelines and limitations:
•
You can delete or change the built-in macros. However, you can override a built-in macro by creating a user-defined macro with the same name. To restore the original built-in macro, delete the user-defined macro.
•
If you enable both the macro auto device and the macro auto execute global configuration commands, the parameters specified in the command last executed are applied to the switch. Only one command is active on the switch.
•
To avoid system conflicts when macros are applied, remove all port configurations except for 802.1x authentication.
•
Do not configure port security when enabling Auto Smartports on the switch.
•
If the macro conflicts with the original configuration, either the macro does not apply some of the original configuration commands, or the antimacro does not remove them. (The antimacro is the portion of the applied macro that removes the macro at a link-down event.)
For example, if 802.1x authentication is enabled, you cannot remove the switchport-mode access configuration. Remove the 802.1x authentication before removing the switchport mode configuration.
•
A port cannot be a member of an EtherChannel when you apply Auto Smartports macros.
•
The built-in-macro default data VLAN is VLAN 1. The default voice VLAN is VLAN 2. If your switch uses different access, native, or voice VLANs, use the macro auto device or the macro auto execute global configuration commands to configure the values.
•
For 802.1x authentication or MAC authentication bypass (MAB), to detect non-Cisco devices, configure the RADIUS server to support the Cisco attribute-value pair auto-smart-port=event trigger.
•
The switch supports Auto Smartport macros only on directly connected devices. Multiple device connections, such as hubs, are not supported.
•
If authentication is enabled on a port, the switch ignores a MAC address trigger if authentication fails.
•
The order of CLI commands within the macro and the corresponding antimacro can be different.
Examples
This example shows how to use two built-in macros for connecting Cisco switches and Cisco IP phones to the switch. This example modifies the default voice VLAN, access VLAN, and native VLAN for the trunk interface:
Switch# configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#!!! the next command modifies the access and voice vlans
Switch(config)#!!! for the built in Cisco IP phone auto smartport macro
Switch(config)# macro auto execute CISCO_PHONE_EVENT builtin CISCO_PHONE_AUTO_SMARTPORT
ACCESS_VLAN=10 VOICE_VLAN=20
Switch(config)#!!! the next command modifies the Native vlan used for inter switch trunks
Switch(config)# macro auto execute CISCO_SWITCH_EVENT builtin CISCO_SWITCH_AUTO_SMARTPORT
NATIVE_VLAN=10
Switch(config)#!!! the next command enables auto smart ports globally
Switch(config)# macro auto global processing
Switch# !!! here is the running configuration of the interface connected
Switch# !!! to another Cisco Switch after the Macro is applied
Switch# show running-config interface gigabitethernet1/0/1
Building configuration...
Current configuration : 284 bytes
interface GigabitEthernet1/0/1
switchport trunk encapsulation dot1q
switchport trunk native vlan 10
srr-queue bandwidth share 10 10 60 20
macro description CISCO_SWITCH_EVENT
This example shows how to map a user-defined event trigger called media player to a user-defined macro.
1.
Connect the media player to an 802.1x- or MAB-enabled switch port.
2.
On the RADIUS server, set the attribute-value pair to auto-smart-port=MP_EVENT.
3.
On the switch, create the event trigger MP_EVENT, and enter the user-defined macro commands.
4.
The switch recognizes the attribute-value pair=MP_EVENT response from the RADIUS server and applies the macro associated with this event trigger.
Switch(config)# shell trigger MP_EVENT mediaplayer
Switch(config)# macro auto execute MP_EVENT {
if [[ $LINKUP -eq YES ]]; then
macro description $TRIGGER
switchport port-security maximum 1
switchport port-security violation restrict
switchport port-security aging time 2
switchport port-security aging type inactivity
spanning-tree bpduguard enable
if [[ $LINKUP -eq NO ]]; then
no macro description $TRIGGER
no switchport access vlan 1
if [[ $AUTH_ENABLED -eq NO ]]; then
no switchport mode access
no switchport port-security
no switchport port-security maximum 1
no switchport port-security violation restrict
no switchport port-security aging time 2
no switchport port-security aging type inactivity
no spanning-tree portfast
no spanning-tree bpduguard enable
Table 3-1 Supported Cisco IOS Shell Keywords
Command
|
Description
|
{
|
Begin the command grouping.
|
}
|
End the command grouping.
|
[[
|
Use as a conditional construct.
|
]]
|
Use as a conditional construct.
|
else
|
Use as a conditional construct.
|
-eq
|
Use as a conditional construct.
|
fi
|
Use as a conditional construct.
|
if
|
Use as a conditional construct.
|
then
|
Use as a conditional construct.
|
-z
|
Use as a conditional construct.
|
$
|
Variables that begin with the $ character are replaced with a parameter value.
|
#
|
Use the # character to enter comment text.
|
Table 3-2 Unsupported Cisco IOS Shell Reserved Keywords
Command
|
Description
|
|
|
Pipeline.
|
case
|
Conditional construct.
|
esac
|
Conditional construct.
|
for
|
Looping construct.
|
function
|
Shell function.
|
in
|
Conditional construct.
|
select
|
Conditional construct.
|
time
|
Pipeline.
|
until
|
Looping construct.
|
while
|
Looping construct.
|
Related Commands
Command
|
Description
|
macro auto device
|
Configures macro default parameter values.
|
macro auto global processing
|
Enables Auto Smartports on a switch.
|
macro auto mac-address-group
|
Configures MAC address groups.
|
macro auto sticky
|
Configures macro persistence.
|
shell trigger
|
Creates event triggers.
|
show macro auto
|
Displays information about macros.
|
show shell
|
Displays information about event triggers and macros.
|
macro auto file
To deregister the Cisco IOS shell scripts and to register user-defined scripts, use the macro auto file global configuration command. Use the no form of this command to remove the registration of system-defined scripts from the policy engine.
macro auto file {directory word} | {register word type [system | user]}
no macro auto file {directory word} | {register word type [system | user]}
Syntax Description
directory word
|
Specifies the auto execution user file directory path.
|
register word type
|
Specifies the name and type of the file to register.
|
system
|
(Optional) Searches for a system policy file.
|
user
|
(Optional) Searches for a user policy file.
|
Command Default
There is no default.
Command Modes
Global configuration
Command History
Release
|
Modification
|
12.2(52)SE
|
This command was introduced on the Catalyst 3750-E, 3750, 3560-E. 3560, 2975, 2960, and 2918 switches.
|
12.2(53)SE2
|
This command was introduced on the Catalyst 3750-X and 3560-X switches.
|
Usage Guidelines
Use the macro auto file global configuration command to deregister the Cisco IOS shell scripts and to register user-defined scripts.
Examples
This example shows how to deregister the system-defined file Mandatory.cdp.sh, copy the user-defined script to flash, register the location of the user-defined file, register the file Mandatory.cdp.sh, and how to verify your entries:
3 -rwx 3533 Mar 1 1993 00:02:26 +00:00 Mandatory.cdp.sh
Switch(config)# no macro auto file register Mandatory.cdp.sh
Switch(config)# macro auto file directory "flash:"
Switch(config)# macro auto file register Mandatory.cdp.sh type user
Switch# show running config | inc macro
macro auto file directory "flash:/"
macro auto file register Mandatory.cdp.sh type user
For ASP EEM registers the following policy scripts:
Mandatory.cdp.sh Mandatory.link.sh Mandatory.lldp.sh
Mandatory.identity.sh Mandatory.link2.sh Mandatory.mat.sh
Related Commands
Command
|
Description
|
macro auto global processing
|
Enables Auto Smartports on a switch.
|
shell trigger
|
Creates event triggers.
|
show macro auto
|
Displays information about macros.
|
show shell
|
Displays information about event triggers and macros.
|
macro auto global control
To specify when the switch applies an Auto Smartports macro based on the detection method, device type, or trigger (referred to as event trigger control), use the macro auto global control global configuration command. Use the no form of this command to disable trigger-to-macro mapping. The switch then does not apply macros based on event triggers.
macro auto global control {detection [cdp] [lldp] [mac-address] | device [access-point]
[ip-camera] [lightweight-ap] [media-player] [phone] [router] [switch] | trigger
[last-resort]}
no macro auto global control {detection [cdp] [lldp] [mac-address] | device [access-point]
[ip-camera] [lightweight-ap] [media-player] [phone] [router] [switch] | trigger
[last-resort]}
Syntax Description
detection [cdp] [lldp] [mac-address]
|
detection—Sets one or more of these as an event trigger:
• (Optional) cdp—CDP messages
• (Optional) lldp—LLDP messages
• (Optional) mac-address—User-defined MAC address groups
|
device [access-point] [ip-camera] [lightweight-ap] [media-player] [phone] [router] [switch]
|
device—Sets one or more of these devices as an event trigger:
• (Optional) access-point—Autonomous access point
• (Optional) ip-camera—Cisco IP video surveillance camera
• (Optional) lightweight-ap—Lightweight access point
• (Optional) media-player—Digital media player
• (Optional) phone—Cisco IP phone
• (Optional) router—Cisco router
• (Optional) switch—Cisco switch
|
trigger [last-resort]
|
trigger—Sets a specific event trigger.
• (Optional) last-resort—Last-resort trigger.
|
Command Default
The switch uses the device type as the event trigger. If the switch cannot determine the device type, it uses MAC address groups, MAB messages, 802.1x authentication messages, and LLDP messages in random order.
Command Modes
Global configuration
Command History
Release
|
Modification
|
12.2(55)SE
|
This command was introduced on the Catalyst 3750-X, 3750-E, 3750, 3560-X, 3560-E, 3560, 2975, 2960, and 2918 switches.
|
Usage Guidelines
If you do not set event triggers, the switch uses the device type as the event trigger. If the switch cannot determine the device type, it uses MAC address groups, MAB messages, 802.1x authentication messages, and LLDP messages in random order.
To verify that a macro is applied to a switch, use the show macro auto global user EXEC command.
Examples
To set CDP messages, LLDP messages and MAC address groups as event triggers:
Switch# configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)# macro auto global control detection cdp lldp mac-address
To set autonomous access points, lightweight access points, and IP phones:
Switch# configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)# macro auto global control device access-point lightweight-ap phone
Related Commands
Command
|
Description
|
macro auto execute
|
Configures mapping from an event trigger to a built-in macro.
|
macro auto global processing
|
Enables Auto Smartports on a switch.
|
macro auto mac-address-group
|
Configures MAC address groups.
|
macro auto sticky
|
Configures macro persistence.
|
shell trigger
|
Creates event triggers.
|
show macro auto
|
Displays information about macros.
|
show shell
|
Displays information about event triggers and macros.
|
macro auto global processing
To enable Auto Smartports macros on the switch, use the macro auto global processing global configuration command. Use the no form of this command to disable the macros.
macro auto global processing [fallback cdp]
no macro auto global processing [fallback cdp]
Syntax Description
fallback cdp
|
(Optional) Use the Cisco Discovery Protocol (CDP) as the fallback mechanism if authentication fails.
Starting in Cisco IOS Release 12.2(58)SE, these keywords are no longer supported.
|
Command Default
Auto Smartports is disabled.
Command Modes
Global configuration
Command History
Release
|
Modification
|
12.2(50)SE
|
This command was introduced on the Catalyst 3750-E. 3750, 3560-E, 3560, 2960, and 2918 switches.
|
12.2(52)SE
|
The command changed from macro auto global processing [cdp-fallback] to macro auto global processing [fallback cdp] on Catalyst 3750-E. 3750, 3560-E, 3560, 2960, and 2918 switches.
The command was introduced on Catalyst 2975 switches.
|
12.2(53)SE2
|
This command was introduced on Catalyst 3750-X and 3560-X switches.
|
12.2(58)SE
|
The fallback cdp keywords are no longer supported.
|
Usage Guidelines
Use the macro auto global processing global configuration command to globally enable macros on the switch. To disable macros on a specific port, use the no macro auto processing command in interface mode.
When using 802.1x or MAB authentication, you need to configure the RADIUS server to support the Cisco attribute-value pair auto-smart-port=event trigger. If authentication fails, the macro is not applied. If the 802.1x or MAB authentication fails on the interface, the switch does not use the fallback CDP event trigger.
When CDP-identified devices advertise multiple capabilities, the switch chooses a capability first by switch and then by router.
To verify that a macro is applied to an interface, use the show macro auto interface privileged EXEC command.
Examples
This example shows how enable Auto Smartports on the switch and to disable the feature on a specific interface:
Switch(config)# macro auto global processing
Switch(config)# interface interface_id
Switch(config-if)# no macro auto processing
Related Commands
Command
|
Description
|
macro auto device
|
Configures macro default parameter values.
|
macro auto execute
|
Configures mapping from an event trigger to a built-in macro.
|
macro auto mac-address-group
|
Configures MAC address groups.
|
macro auto sticky
|
Configures macro persistence.
|
shell trigger
|
Creates event triggers.
|
show macro auto
|
Displays information about macros.
|
show shell
|
Displays information about event triggers and macros.
|
macro auto mac-address-group
To create an event trigger for devices that do not support Cisco Discovery Protocol (CDP) or Link Layer Discover Protocol (LLDP), use the macro auto mac-address-group global configuration command. Use the no form of this command to delete the group.
macro auto mac-address-group name [mac-address list list] | [oui [list list | range start-value size
number]]
no macro auto mac-address-group name [mac-address list list] | [oui [list list | range start-value
size number]]
Syntax Description
name
|
Specifies the group name.
|
oui
|
(Optional) Specifies an operationally unique identifier (OUI) list or range.
• list—Enter an OUI list in hexadecimal format separated by spaces.
• range—Enter the starting OUI hexadecimal value (start-value).
• size—Enter the length of the range (number) from 1 to 5 to create a list of sequential addresses.
|
mac-address list list
|
(Optional) Configures a list of MAC addresses separated by a space.
|
Command Default
No groups are defined.
Command Modes
Group configuration
Command History
Release
|
Modification
|
12.2(52)SE
|
This command was introduced on the Catalyst 3750-E, 3750, 3560-E, 3560, 2975, 2960, and 2918 switches.
|
12.2(53)SE2
|
This command was introduced on the Catalyst 3750-X and 3560-X switches.
|
Usage Guidelines
Use the macro auto mac-address-group global configuration command to create an event trigger for devices that do not support CDP or LLDP. Use the MAC address group as a trigger to map to a built-in or user-defined macro by using the macro auto execute global configuration command. At link-up the switch detects the device type and applies the specified macro.
The switch supports up to ten MAC address groups. Each group can have up to 32 OUI and 32 MAC configured addresses.
Examples
This example shows how to create a MAC-address-group event trigger called address_trigger and how to verify your entries:
Switch# configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)# macro auto address-group mac address_trigger
Switch(config-addr-grp-mac)# mac-address list 2222.3333.3334 22.33.44 a.b.c
Switch(config-addr-grp-mac)# oui list 455555 233244
Switch(config-addr-grp-mac)# oui range 333333 size 2
Switch(config-addr-grp-mac)# exit
Switch# show running configuration
!macro auto mac-address-group address_trigger
mac-address list 000A.000B.000C
mac-address list 0022.0033.0044
mac-address list 2222.3333.3334
Related Commands
Command
|
Description
|
macro auto device
|
Configures macro default parameter values.
|
macro auto execute
|
Configures mapping from an event trigger to a built-in macro.
|
macro auto global processing
|
Enables Auto Smartports on a switch.
|
macro auto sticky
|
Configures macro persistence.
|
shell trigger
|
Creates event triggers.
|
show macro auto
|
Displays information about macros.
|
show shell
|
Displays information about event triggers and macros.
|
macro auto sticky
To configure macros remain active after a link-down event, referred to as macro persistence, use the macro auto sticky global configuration command. Use the no form of this command to disable the macro persistence.
macro auto sticky
no macro auto sticky
Syntax Description
This command has no arguments or keywords.
Command Default
Macro persistence is disabled.
Command Modes
Global configuration
Command History
Release
|
Modification
|
12.2(52)SE
|
This command was introduced on the Catalyst 3750-E, 3750, 3560-E, 3560, 2975, 2960, and 2918 switches.
|
12.2(53)SE2
|
This command was introduced on the Catalyst 3750-X and 3560-X switches.
|
Usage Guidelines
Use the macro auto sticky global configuration command so that macros remain active after a link-down event.
Examples
This example shows how to enable macro persistence on an interface:
Switch# configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)# interface gigabitethernet 2/0/1
Switch(config-if)# macro auto port sticky
Related Commands
Command
|
Description
|
macro auto device
|
Configures macro default parameter values.
|
macro auto execute
|
Configures mapping from an event trigger to a built-in macro.
|
macro auto global processing
|
Enables Auto Smartports on a switch.
|
macro auto mac-address-group
|
Configures MAC address groups.
|
shell trigger
|
Creates event triggers.
|
show macro auto
|
Displays information about macros.
|
show shell
|
Displays information about event triggers and macros.
|
macro description
To enter a description about which macros are applied to an interface, use the macro description interface configuration command. Use the no form of this command to remove the description. This command is mandatory for Auto Smartports to work.
macro description text
no macro description text
Syntax Description
description text
|
Enters a description about the macros that are applied to the specified interface.
|
Command Default
This command has no default setting.
Command Modes
Interface configuration
Command History
Release
|
Modification
|
12.1(19)EA1
|
This command was introduced on the Catalyst 3750 and 3560 switches.
|
12.2(25)FX
|
This command was introduced on the Catalyst 2960 switches.
|
12.2(44)SE
|
This command was introduced on the Catalyst 2918 switches.
|
12.2(46)EX
|
This command was introduced on the Catalyst 2975 switches.
|
12.2(35)SE2
|
This command was introduced on the Catalyst 3750-E and 3560-E switches.
|
12.2(53)SE2
|
This command was introduced on the Catalyst 3750-X and 3560-X switches.
|
Usage Guidelines
Use the description keyword to associate comment text or the macro name with an interface. When multiple macros are applied on a single interface, the description text is from the last applied macro.
You can verify your settings by entering the show parser macro description privileged EXEC command.
Examples
This example shows how to add a description to an interface:
Switch(config-if)# macro description duplex settings
Related Commands
Command
|
Description
|
macro apply
|
Applies a macro on an interface.
|
macro global
|
Applies a macro on a switch or applies and traces a macro on a switch
|
macro global description
|
Adds a description about the macros that are applied to the switch.
|
macro trace
|
Applies and traces a macro on an interface.
|
show parser macro
|
Displays the macro definition for all macros or for the specified macro.
|
macro global
To apply a macro to a switch or to apply and debug a macro on a switch, use the macro global global configurationcommand.
macro global {apply | trace} macro-name [parameter {value}] [parameter {value}]
[parameter {value}]
Syntax Description
apply
|
Applies a macro to the switch.
|
trace
|
Applies a macro to a switch and debugs the macro.
|
macro-name
|
Specifies the name of the macro.
|
parameter value
|
(Optional) Specifies unique parameter values that are specific to the switch. You can enter up to three keyword-value pairs. Parameter keyword matching is case sensitive. All matching occurrences of the keyword are replaced with the corresponding value.
|
Command Default
This command has no default setting.
Command Modes
Global configuration
Command History
Release
|
Modification
|
12.2(20)SE
|
This command was introduced on the Catalyst 3750 and 3560 switches.
|
12.2(25)FX
|
This command was introduced on the Catalyst 2960 switches.
|
12.2(44)SE
|
This command was introduced on the Catalyst 2918 switches.
|
12.2(46)EX
|
This command was introduced on the Catalyst 2975 switches.
|
12.2(35)SE2
|
This command was introduced on the Catalyst 3750-E and 3560-E switches.
|
12.2(53)SE2
|
This command was introduced on the Catalyst 3750-X and 3560-X switches.
|
Usage Guidelines
Use the macro global apply macro-name global configuration command to apply the macro to an interface.
Use the macro global trace macro-name global configuration command to apply and then debug the macro to find any syntax or configuration errors.
If a command fails when you apply a macro because of a syntax error or a configuration error, the macro continues to apply the remaining commands to the switch.
When creating a macro that requires the assignment of unique values, use the parameter value keywords to designate values specific to the switch.
Keyword matching is case sensitive. All matching occurrences of the keyword are replaced with the corresponding value. Any full match of a keyword, even if it is part of a larger string, is considered a match and is replaced by the corresponding value.
Some macros might contain keywords that require a parameter value. You can use the macro global apply macro-name ? command to display a list of any required values in the macro. If you apply a macro without entering the keyword values, the commands are invalid and are not applied.
There are Cisco-default Smartports macros embedded in the switch software. You can display these macros and the commands they contain by using the show parser macro user EXEC command.
Follow these guidelines when you apply a Cisco-default Smartports macro on a switch:
•
Display all macros on the switch by using the show parser macro user EXEC command. Display the contents of a specific macro by using the show parser macro name macro-name user EXEC command.
•
Keywords that begin with $ mean that a unique parameter value is required. Append the Cisco-default macro with the required values by using the parameter value keywords.
The Cisco-default macros use the $ character to help identify required keywords. There is no restriction on using the $ character to define keywords when you create a macro.
When you apply a macro to a switch, the macro name is automatically added to the switch. You can display the applied commands and macro names by using the show running-config user EXEC command.
You can delete a global macro-applied configuration on a switch only by entering the no version of each command in the macro.
Examples
After you have created a new macro by using the macro auto execute global configuration command, you can apply it to a switch. This example shows how see the snmp macro, how to apply the macro, set the hostname to test-server, and set the IP precedence value to 7:
Switch# show parser macro name snmp
Macro type : customizable
#enable port security, linkup, and linkdown traps
snmp-server enable traps port-security
snmp-server enable traps linkup
snmp-server enable traps linkdown
#set SNMP trap notifications precedence
snmp-server ip precedence VALUE
--------------------------------------------------
Switch(config)# macro global apply snmp ADDRESS test-server VALUE 7
To debug a macro, use the macro global trace global configuration command to find any syntax or configuration errors in the macro when you apply it to a switch. In this example, the ADDRESS parameter value was not entered, the Switch(config-if)# command failed, and the remainder of the macro is applied to the switch:
Switch(config)# macro global trace snmp VALUE 7
Applying command...`snmp-server enable traps port-security'
Applying command...`snmp-server enable traps linkup'
Applying command...`snmp-server enable traps linkdown'
Applying command...`snmp-server host'
Applying command...`snmp-server ip precedence 7'
Related Commands
Command
|
Description
|
macro apply
|
Applies a macro on an interface.
|
macro description
|
Adds a description about the macros that are applied to an interface.
|
macro global description
|
Adds a description about the macros that are applied to the switch.
|
macro trace
|
Applies and traces a macro on an interface.
|
show parser macro
|
Displays the macro definition for all macros or for the specified macro.
|
macro global description
To enter a description about the macros that are applied to a switch, use the macro global description global configuration command. Use the no form of this command to remove the description.
macro global description text
no macro global description text
Syntax Description
description text
|
Enters a description about the macros that are applied to the switch.
|
Command Default
This command has no default setting.
Command Modes
Global configuration
Command History
Release
|
Modification
|
12.2(20)SE
|
This command was introduced on the Catalyst 3750 and 3560 switches.
|
12.2(25)FX
|
This command was introduced on the Catalyst 2960 switches.
|
12.2(44)SE
|
This command was introduced on the Catalyst 2918 switches.
|
12.2(46)EX
|
This command was introduced on the Catalyst 2975 switches.
|
12.2(35)SE2
|
This command was introduced on the Catalyst 3750-E and 3560-E switches.
|
12.2(53)SE2
|
This command was introduced on the Catalyst 3750-X and 3560-X switches.
|
Usage Guidelines
Use the description keyword to associate comment text or the macro name with a switch. When multiple macros are applied on a switch, the description text is from the last applied macro.
You can verify your settings by entering the show parser macro description privileged EXEC command.
Examples
This example shows how to add a description to a switch:
Switch(config)# macro global description udld aggressive mode enabled
Related Commands
Command
|
Description
|
macro apply
|
Applies a macro on an interface.
|
macro description
|
Adds a description about the macros that are applied to an interface.
|
macro global
|
Applies a macro on a switch or applies and traces a macro on a switch.
|
macro trace
|
Applies and debugs a macro on an interface.
|
show parser macro
|
Displays the macro definition for all macros or for the specified macro.
|
shell trigger
To create an event trigger, use the shell trigger global configuration command. Use the no form of this command to delete the trigger.
shell trigger identifier description
no shell trigger identifier description
Syntax Description
identifier
|
Specifies the event trigger identifier. The identifier should have no spaces or hyphens between words.
|
description
|
Specifies the event trigger description text.
|
Command Default
System-defined event triggers:
•
CISCO_DMP_EVENT
•
CISCO_IPVSC_AUTO_EVENT
•
CISCO_PHONE_EVENT
•
CISCO_SWITCH_EVENT
•
CISCO_ROUTER_EVENT
•
CISCO_WIRELESS_AP_EVENT
•
CISCO_WIRELESS_LIGHTWEIGHT_AP_EVENT
Command Modes
Global configuration
Command History
Release
|
Modification
|
12.2(50)SE
|
This command was introduced on the Catalyst 3750-E, 3750, 3560-E, 3560, and 2960 switches.
|
12.2(52)SE
|
This command was introduced on the Catalyst 2975 switches.
|
12.2(53)SE2
|
This command was introduced on the Catalyst 3750-X and 3560-X switches.
|
Usage Guidelines
Use this command to create user-defined event triggers for use with the macro auto device and the macro auto execute global configuration commands.
To support dynamic device discovery when using IEEE 802.1x authentication, you need to configure the RADIUS authentication server to support the Cisco attribute-value pair: auto-smart-port=event trigger.
Examples
This example shows how to create a user-defined event trigger called RADIUS_MAB_EVENT:
Switch# configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)# shell trigger RADIUS_MAB_EVENT MAC_AuthBypass Event
Related Commands
Command
|
Description
|
macro auto device
|
Configures macro default parameter values.
|
macro auto execute
|
Configures mapping from an event trigger to a built-in macro.
|
macro auto global processing
|
Enables Auto Smartports on a switch.
|
macro auto mac-address-group
|
Configures MAC address groups.
|
macro auto sticky
|
Configures macro persistence.
|
shell trigger
|
Creates event triggers.
|
show macro auto
|
Displays information about macros.
|
show shell
|
Displays information about event triggers and macros.
|
show macro auto
To display Auto Smartports macro information, use the show macro auto user EXEC command.
show macro auto {address-group [address-group-name] | device [access-point] [ip-camera]
[lightweight-ap] [media-player] [phone] [router] [switch] | event manager | global
[event_trigger] | interface [interface_id]}
Syntax Description
address-group [address-group-name]
|
Displays address-group information.
(Optional) address-group-name—Displays information for the specified address group.
|
device [access-point] [ip-camera] [lightweight-ap] [media-player] [phone] [router] [switch]
|
Displays device information about one or more devices.
• (Optional) access-point—Autonomous access point
• (Optional) ip-camera—Cisco IP video surveillance camera
• (Optional) lightweight-ap—Lightweight access point
• (Optional) media-player—Digital media player
• (Optional) phone—Cisco IP phone
• (Optional) router—Cisco router
• (Optional) switch—Cisco switch
|
event manager
|
Displays embedded event manager information.
|
global [event_trigger]
|
Displays Auto Smartports information about the switch.
(Optional) event_trigger—Displays information about the specified event trigger.
|
interface [interface_id]
|
Displays interface status.
(Optional) interface_id—Displays information about the specified interface.
|
Command Modes
User EXEC
Privileged EXEC
Command History
Release
|
Modification
|
12.2(52)SE
|
This command was introduced on the Catalyst 3750-E, 3750, 3560-E, 3560, 2975, 2960, and 2918 switches.
|
12.2(53)SE2
|
This command was introduced on the Catalyst 3750-X and 3560-X switches.
|
12.2(55)SE
|
The global keyword was added on the Catalyst 3750-X, 3750-E, 3750, 3560-X, 3560-E, 3560, 2975, 2960, and 2918 switches. The address-group, device, event manager, and interface keywords are not optional.
|
Usage Guidelines
Use this command to display the Auto Smartports information for the switch. Use the show macro auto device privileged EXEC command to display the configurable parameters for a device.
Examples
This example shows how to use the show macro auto device privileged EXEC command to view the configuration on the switch:
Switch> show macro auto device
Default Macro:CISCO_LWAP_AUTO_SMARTPORT
Current Macro:CISCO_LWAP_AUTO_SMARTPORT
Configurable Parameters:ACCESS_VLAN
Defaults Parameters:ACCESS_VLAN=1
Current Parameters:ACCESS_VLAN=1
Default Macro:CISCO_AP_AUTO_SMARTPORT
Current Macro:CISCO_AP_AUTO_SMARTPORT
Configurable Parameters:NATIVE_VLAN
Defaults Parameters:NATIVE_VLAN=1
Current Parameters:NATIVE_VLAN=1
Default Macro:CISCO_PHONE_AUTO_SMARTPORT
Current Macro:CISCO_PHONE_AUTO_SMARTPORT
Configurable Parameters:ACCESS_VLAN VOICE_VLAN
Defaults Parameters:ACCESS_VLAN=1 VOICE_VLAN=2
Current Parameters:ACCESS_VLAN=1 VOICE_VLAN=2
Default Macro:CISCO_ROUTER_AUTO_SMARTPORT
Current Macro:CISCO_ROUTER_AUTO_SMARTPORT
Configurable Parameters:NATIVE_VLAN
Defaults Parameters:NATIVE_VLAN=1
Current Parameters:NATIVE_VLAN=1
Default Macro:CISCO_SWITCH_AUTO_SMARTPORT
Current Macro:CISCO_SWITCH_AUTO_SMARTPORT
Configurable Parameters:NATIVE_VLAN
Defaults Parameters:NATIVE_VLAN=1
Current Parameters:NATIVE_VLAN=1
Default Macro:CISCO_IP_CAMERA_AUTO_SMARTPORT
Current Macro:CISCO_IP_CAMERA_AUTO_SMARTPORT
Configurable Parameters:ACCESS_VLAN
Defaults Parameters:ACCESS_VLAN=1
Current Parameters:ACCESS_VLAN=1
Default Macro:CISCO_DMP_AUTO_SMARTPORT
Current Macro:CISCO_DMP_AUTO_SMARTPORT
Configurable Parameters:ACCESS_VLAN
Defaults Parameters:ACCESS_VLAN=1
Current Parameters:ACCESS_VLAN=1
This example shows how to use the show macro auto address-group name privileged EXEC command to view the TEST3 address group configuration on the switch:
Switch> show macro auto address-group TEST3
MAC Address Group Configuration:
Group Name OUI MAC ADDRESS
--------------------------------------------------------------
TEST3 2233.33 0022.0022.0022
Related Commands
Command
|
Description
|
macro auto device
|
Configures macro default parameter values.
|
macro auto execute
|
Configures mapping from an event trigger to a built-in macro.
|
macro auto global processing
|
Enables Auto Smartports on a switch.
|
macro auto mac-address-group
|
Configures MAC address groups.
|
macro auto sticky
|
Configures macro persistence.
|
shell trigger
|
Creates event triggers.
|
show shell
|
Displays information about event triggers and macros.
|
show parser macro
To display the parameters for all configured macros or for one macro on the switch, use the show parser macro user EXEC command.
show parser macro [{brief | description [interface interface-id] | name macro-name}]
Syntax Description
brief
|
(Optional) Displays the name of each macro.
|
description [interface interface-id]
|
(Optional) Displays all macro descriptions or the description of a specific interface.
|
name macro-name
|
(Optional) Displays information about a single macro identified by the macro name.
|
Command Modes
User EXEC
Privileged EXEC
Command History
Release
|
Modification
|
12.1(19)EA1
|
This command was introduced on the Catalyst 3750 and 3560 switches.
|
12.2(25)FX
|
This command was introduced on the Catalyst 2960 switches.
|
12.2(44)SE
|
This command was introduced on the Catalyst 2918 switches.
|
12.2(46)EX
|
This command was introduced on the Catalyst 2975 switches.
|
12.2(35)SE2
|
This command was introduced on the Catalyst 3750-E and 3560-E switches.
|
12.2(53)SE2
|
This command was introduced on the Catalyst 3750-X and 3560-X switches.
|
Examples
This is a partial output example from the show parser macro command. The output for the Cisco-default macros varies depending on the switch platform and the software image running on the switch:
Switch# show parser macro
Total number of macros = 6
--------------------------------------------------------------
Macro name : cisco-global
Macro type : default global
# Enable dynamic port error recovery for link state
errdisable recovery cause link-flap
errdisable recovery interval 60
--------------------------------------------------------------
Macro name : cisco-desktop
Macro type : default interface
# Basic interface - Enable data VLAN only
# Recommended value for access vlan (AVID) should not be 1
switchport access vlan $AVID
--------------------------------------------------------------
Macro type : default interface
# Cisco IP phone + desktop template
# macro keywords $AVID $VVID
# VoIP enabled interface - Enable data VLAN
# Recommended value for access vlan (AVID) should not be 1
switchport access vlan $AVID
--------------------------------------------------------------
Macro name : cisco-switch
Macro type : default interface
# Access Uplink to Distribution
# Do not apply to EtherChannel/Port Group
# Define unique Native VLAN on trunk ports
# Recommended value for native vlan (NVID) should not be 1
switchport trunk native vlan $NVID
--------------------------------------------------------------
Macro name : cisco-router
Macro type : default interface
# Access Uplink to Distribution
# Define unique Native VLAN on trunk ports
# Recommended value for native vlan (NVID) should not be 1
switchport trunk native vlan $NVID
--------------------------------------------------------------
Macro type : customizable
#enable port security, linkup, and linkdown traps
snmp-server enable traps port-security
snmp-server enable traps linkup
snmp-server enable traps linkdown
#set SNMP trap notifications precedence
snmp-server ip precedence VALUE
--------------------------------------------------------------
This is an example of output from the show parser macro name command:
Switch# show parser macro name standard-switch10
Macro name : standard-switch10
Macro type : customizable
macro description standard-switch10
# Trust QoS settings on VOIP packets
# Allow port channels to be automatically formed
This is an example of output from the show parser macro brief command:
Switch# show parser macro brief
default global : cisco-global
default interface: cisco-desktop
default interface: cisco-phone
default interface: cisco-switch
default interface: cisco-router
This is an example of output from the show parser macro description command:
Switch# show parser macro description
Global Macro(s): cisco-global
Interface Macro Description(s)
--------------------------------------------------------------
Gi1/0/1 standard-switch10
Gi1/0/2 this is test macro
--------------------------------------------------------------
This is an example of output from the show parser macro description interface command:
Switch# show parser macro description interface gigabitethernet1/0/2
Interface Macro Description
--------------------------------------------------------------
Gi1/0/2 this is test macro
--------------------------------------------------------------
Related Commands
Command
|
Description
|
macro apply
|
Applies a macro on an interface or applies and traces a macro on an interface.
|
macro description
|
Adds a description about the macros that are applied to an interface.
|
macro global
|
Applies a macro on a switch or applies and traces a macro on a switch.
|
macro global description
|
Adds a description about the macros that are applied to the switch.
|
show running-config
|
Displays the operating configuration.
|
show shell
To display shell information, use the show shell user EXEC command.
show shell [environment | functions [brief | shell_function] | triggers]
Syntax Description
environment
|
(Optional) Displays shell environment information.
|
functions [brief | shell_function]
|
(Optional) Displays macro information.
• brief—Names of the shell functions.
• shell_function—Name of a shell function.
|
triggers
|
(Optional) Displays event trigger information.
|
Command Modes
User EXEC
Privilieged EXEC
Command History
Release
|
Modification
|
12.2(50)SE
|
This command was introduced on the Catalyst 3750-E, 3750, 3560-E, 3560, 2960, and 2918 switches.
|
12.2(52)SE
|
This command was introduced on the Catalyst 2975 switches.
|
12.2(53)SE2
|
This command was introduced on the Catalyst 3750-X and 3560-X switches.
|
Usage Guidelines
Use this command to display the shell information for the switch.
Examples
This example shows how to use the show shell triggers privileged EXEC command to view the event triggers in the switch software:
Switch# show shell triggers
Trigger Id: CISCO_CUSTOM_EVENT
Trigger description: Custom macroevent to apply user defined configuration
Trigger environment: User can define the macro
Trigger mapping function: CISCO_CUSTOM_AUTOSMARTPORT
Trigger Id: CISCO_DMP_EVENT
Trigger description: Digital media-player device event to apply port configuration
Trigger environment: Parameters that can be set in the shell - $ACCESS_VLAN=(1)
The value in the parenthesis is a default value
Trigger mapping function: CISCO_DMP_AUTO_SMARTPORT
Trigger Id: CISCO_IPVSC_EVENT
Trigger description: IP-camera device event to apply port configuration
Trigger environment: Parameters that can be set in the shell - $ACCESS_VLAN=(1)
The value in parenthesis is a default value
Trigger mapping function: CISCO_IP_CAMERA_AUTO_SMARTPORT
Trigger Id: CISCO_LAST_RESORT_EVENT
Trigger description: Last resortevent to apply port configuration
Trigger environment: Parameters that can be set in the shell - $ACCESS_VLAN=(1)
The value in the parenthesis is a default value
Trigger mapping function: CISCO_LAST_RESORT_SMARTPORT
Trigger Id: CISCO_PHONE_EVENT
Trigger description: IP-phone device event to apply port configuration
Trigger environment: Parameters that can be set in the shell - $ACCESS_VLAN=(1)
and $VOICE_VLAN=(2), The value in the parenthesis is a default value
Trigger mapping function: CISCO_PHONE_AUTO_SMARTPORT
Trigger Id: CISCO_ROUTER_EVENT
Trigger description: Router device event to apply port configuration
Trigger environment: Parameters that can be set in the shell - $NATIVE_VLAN=(1)
The value in the parenthesis is a default value
Trigger mapping function: CISCO_ROUTER_AUTO_SMARTPORT
Trigger Id: CISCO_SWITCH_ETHERCHANNEL_CONFIG
Trigger description: etherchannel parameter
Trigger environment: $INTERFACE_LIST=(),$PORT-CHANNEL_ID=(),
$EC_MODE=(),$EC_PROTOCOLTYPE=(),
Trigger mapping function: CISCO_ETHERCHANNEL_AUTOSMARTPORT
Trigger Id: CISCO_SWITCH_EVENT
Trigger description: Switch device event to apply port configuration
Trigger environment: Parameters that can be set in the shell - $NATIVE_VLAN=(1)
The value in the parenthesis is a default value
Trigger mapping function: CISCO_SWITCH_AUTO_SMARTPORT
Trigger Id: CISCO_WIRELESS_AP_EVENT
Trigger description: Autonomous ap device event to apply port configuration
Trigger environment: Parameters that can be set in the shell - $NATIVE_VLAN=(1)
The value in the parenthesis is a default value
Trigger mapping function: CISCO_AP_AUTO_SMARTPORT
Trigger Id: CISCO_WIRELESS_LIGHTWEIGHT_AP_EVENT
Trigger description: Lightweight-ap device event to apply port configuration
Trigger environment: Parameters that can be set in the shell - $ACCESS_VLAN=(1)
The value in the parenthesis is a default value
Trigger mapping function: CISCO_LWAP_AUTO_SMARTPORT
Trigger description: word
Trigger mapping function:
This example shows how to use the show shell functions privileged EXEC command to view the built-in macros in the switch software:
Switch# show shell functions
function CISCO_AP_AUTO_SMARTPORT () {
if [[ $LINKUP -eq YES ]]; then
macro description $TRIGGER
switchport trunk encapsulation dot1q
switchport trunk native vlan $NATIVE_VLAN
switchport trunk allowed vlan ALL
if [[ $LIMIT -eq 0 ]]; then
default srr-queue bandwidth limit
srr-queue bandwidth limit $LIMIT
if [[ $SW_POE -eq YES ]]; then
if [[ $AP125X -eq AP125X ]]; then
power inline port maximum 20000
if [[ $LINKUP -eq NO ]]; then
no switchport nonegotiate
no switchport trunk native vlan $NATIVE_VLAN
no switchport trunk allowed vlan ALL
default srr-queue bandwidth limit
if [[ $AUTH_ENABLED -eq NO ]]; then
no switchport trunk encapsulation
if [[ $STICKY -eq YES ]]; then
if [[ $SW_POE -eq YES ]]; then
if [[ $AP125X -eq AP125X ]]; then
no macro auto port sticky
no power inline port maximum
Related Commands
Command
|
Description
|
macro auto device
|
Configures macro default parameter values.
|
macro auto execute
|
Configures mapping from an event trigger to a built-in macro.
|
macro auto global processing
|
Enables Auto Smartports on a switch.
|
macro auto mac-address-group
|
Configures MAC address groups.
|
macro auto sticky
|
Configures macro persistence.
|
shell trigger
|
Creates event triggers.
|
show macro auto
|
Displays information about macros.
|