Configuring Auto SmartPorts

Restrictions for Auto SmartPorts

  • Although Auto SmartPort detects the Cisco switch it does not invoke the event trigger automatically. The event trigger needs to be manually invoked to map the switch to macros.

Information about Auto SmartPorts

Auto SmartPort macros dynamically configure ports based on the device type detected on the port. When the switch detects a new device on a port, it applies the appropriate Auto SmartPorts macro. When a link-down event occurs on the port, the switch removes the macro. For example, when you connect a Cisco IP phone to a port, Auto SmartPorts automatically applies the Cisco IP phone macro. The Cisco IP phone macro enables quality of service (QoS), security features, and a dedicated voice VLAN to ensure proper treatment of delay-sensitive voice traffic.

Auto SmartPorts uses event triggers to map devices to macros. The most common event triggers are based on Cisco Discovery Protocol (CDP) messages received from connected devices. The detection of a device (Cisco IP phone, Cisco wireless access point, or Cisco router) invokes an event trigger for that device.

Link Layer Discovery Protocol (LLDP) is used to detect devices that do not support CDP. Other mechanisms used as event triggers include the 802.1X authentication result and MAC-address learned.

System built-in event triggers exist for various devices based mostly on CDP and LLDP messages and some MAC address. These triggers are enabled as long as Auto SmartPort is enabled.

You can configure user-defined trigger groups for profiles and devices. The name of the trigger group is used to associate a user-defined macro.

Auto SmartPort Macros

The Auto SmartPort macros are groups of CLI commands. Detection of devices on a port triggers the application of the macro for the device. System built-in macros exist for various devices, and, by default, system built-in triggers are mapped to the corresponding built-in macros. You can change the mapping of built-in triggers or macros as needed.

A macro basically applies or removes a set of CLIs on an interface based on the link status. In a macro, the link status is checked. If the link is up, then a set of CLIs is applied; if the link is down, the set is removed (the no format of the CLIs are applied). The part of the macro that applies the set of CLIs is termed macro. The part that removes the CLIs (the no format of the CLIs) are termed antimacro.

When a device is connected to an Auto SmartPort, if it gets classified as a lighting end point, it invokes the event trigger CISCO_LIGHT_EVENT , and the macro CISCO_LIGHT_AUTO_SMARTPORT is executed.

Customizing Device Classifier

The device classifier collects information from protocols such as CDP, LLDP, and DHCP to identify devices. You must enable CDP and LLDP on a device. To make DHCP options information available to the device classifier, you must enable the DHCP Snooping feature on the device. The device attributes that are collected from these protocols are evaluated against a set of profiles available to the device classifier to find the best match. The best-matched profile is used for device identification.

The device classifier uses three types of profile definitions—built-in, default, and user-defined.

  • Built-in profiles contain the device profiles that are known to the Auto SmartPort module that comprises a limited set of Cisco devices. They are built into Cisco IOS and cannot be changed.

  • Default profiles are stored as a text file in nonvolatile storage and allow the device classifier to identify a much larger set of devices. Default profiles are updated as part of the Cisco IOS archive download.

  • User-defined profiles support custom profiling based on users' input. The device classifier identifies rules, conditions, and profiles from the user input.

Commands run by CISCO_LIGHT_AUTO_SMARTPORT

When the macro is executed, it runs a series of commands on the switch.

The commands that are executed by running the macro CISCO_LIGHT_AUTO_SMARTPORT are:

  • switchport mode access

  • switchport port-security violation restrict

  • switchport port-security mac-address sticky

  • switchport port-security

  • power inline port poe-ha

  • storm-control broadcast level 50.00

  • storm-control multicast level 50.00

  • storm-control unicast level 50.00

  • spanning-tree portfast

  • spanning-tree bpduguard enable

Enabling Auto SmartPort


Note


Auto SmartPorts are disabled by default.

To disable Auto SmartPort macros on a specific port, use the no macro auto global processing interface command before enabling Auto SmartPort globally.

To enable Auto SmartPort globally, use the macro auto global processing global configuration command.


To enable an Auto SmartPort, perform this task:

Procedure

  Command or Action Purpose

Step 1

enable

Example:

Device> enable

Enables privileged EXEC mode.

Enter your password, if prompted.

Step 2

configure terminal

Example:

Device# configure terminal

Enters global configuration mode.

Step 3

device classifier

Example:

Device(config)# device classifier

Enables the device classifier.

Use no device classifier command to disable the device classifier.

Step 4

macro auto global processing

Example:

Device(config)# macro auto global processing

Enables Auto SmartPorts on the switch globally.

Use no macro auto global processing command to disable Auto SmartPort globally.

Step 5

end

Example:

Device(config)# end

Returns to privileged EXEC mode.

Step 6

show running-config

Example:

Device# show running-config

Verifies your entries.

Step 7

copy running-config startup-config

Example:

Device# copy running-config startup-config

(Optional) Saves your entries in the configuration file.

How to Configure Auto SmartPorts

The following section provides information about how to configure auto smartports.


Note


Follow these guidelines when you are configuring Auto SmartPort Macros, performing active standby sync and configuring reload from primary to standby:

  • Make sure there is no extra space in the configuration.

  • Do not add extra parenthesis and tab in the configuration.

  • Ensure that you do not use enter keyword more than required while configuring.


Configuring a Device Classifier Profile

To customise device classifier profile, follow the steps:

Before you begin

Disable device classifier before customising device classifier profiles. Use the no device classifier command to disable device classifier.

Procedure

  Command or Action Purpose

Step 1

enable

Example:

Device> enable

Enables privileged EXEC mode.

Enter your password, if prompted.

Step 2

configure terminal

Example:

Device# configure terminal

Enters global configuration mode.

Step 3

device classifier condition condition-name [op{OR | AND}]

Example:

Device(config)# device classifier condition ts-cond1

Defines device classifier condition.

  • condition-name sets the name of the condition for device classifier.

  • op OR defines OR operator of rules. If either of the protocols defined matches, the device gets classified.

  • op AND defines AND operator of rules. If all the protocols defined matches, the device gets classified.

Note

 

If you change any of the parameters of the condition, it is considered as a new condition. In this case, default AND operator of rules is applied for both the conditions.

Step 4

{cdp|dhcp|lldp}tlv-type number value{integer num|string name|regex regular expression}

Example:

Device(config-device-classifier-condition)# cdp tlv-type 1 value String TS01

Configures profiling based on match of TLV for either integer or string value of the given protocol. The protocols supported are CDP, DHCP, and LLDP.

  • tlv-type number configures application TLV type information. The number range is 1 to 255.

  • value configures application TLV value information. You can set an integer, regular expression or a string value.

Note

 

The supported protocols are CDP, DHCP, and LLDP. Protocols like HTTP, OUI are not supported in Cisco IOS XE Bengaluru 17.4.1.

Step 5

exit

Example:

Device(config-device-classifier-condition)# exit

Exits device classifier condition configuration mode.

Step 6

device classifier device-type profile-name

Example:

Device(config)# device classifier device-type Terminal-Server

Configures profile based on defined conditions.

profile-name defines a name for the device type. The device gets classified to the set profile-name if there is a match of the conditions.

Step 7

condition condition-name

Example:

Device(config-device-classifier-dtype)# condition ts-cond1

Enter name of the condition for the profile.

Step 8

end

Example:

Device(config)# end

Returns to privileged EXEC mode.

Configuring Mapping Between Event Triggers and Built-in Macros

To map an event trigger to a built-in macro, perform this task:

Before you begin

You need to enable Auto SmartPort macros globally. You need to perform this task when a Cisco switch is connected to the Auto SmartPort.

Procedure

  Command or Action Purpose

Step 1

enable

Example:

Device> enable

Enables privileged EXEC mode.

Enter your password, if prompted.

Step 2

configure terminal

Example:

Device# configure terminal

Enters global configuration mode.

Step 3

macro auto execute event trigger builtin built-in macro name

Example:


Device(config)# macro auto execute CISCO_SWITCH_EVENT builtin CISCO_SWITCH_AUTO_SMARTPORT

Specifies a user-defined event trigger and a macro name. This action configures mapping from an event trigger to a built-in Auto Smartports macro.

Step 4

macro auto trigger event trigger

Example:

Device(config)# macro auto trigger CISCO_SWITCH_EVENT

Invokes the user-defined event trigger.

Step 5

device device_ID

Example:

Device(config)# device cisco WS-C3560CX-8PT-S

Matches the event trigger to the device identifier.

Step 6

end

Example:

Device(config)# end

Returns to privileged EXEC mode.

Step 7

show shell triggers

Example:

Device# show shell triggers

Displays the event triggers on the switch.

Step 8

show running-config

Example:

Device# show running-config

Verifies your entries.

Step 9

copy running-config startup-config

Example:

Device# copy running-config startup-config

(Optional) Saves your entries in the configuration file.

Configuration Examples for Auto SmartPorts

The following sections provide configuration examples for Auto SmartPorts.

Example: Enabling Auto SmartPorts

The following example shows how you can enable an Auto SmartPort.

Device> enable
Device# configure terminal
Device(config)# device classifier
Device(config)# macro auto global processing
Device(config)# end

Example: Configuring Mapping Between Event Triggers and Built-In Macros

The following example shows how you can configure mapping between event triggers and built-in macros:

Device> enable
Device# configure terminal
Device(config)# macro auto execute CISCO_SWITCH_EVENT builtin CISCO_SWITCH_AUTO_SMARTPORT
Device(config)# macro auto trigger CISCO_SWITCH_EVENT
Device(config)# device cisco WS-C3560CX-8PT-S
Device(config)# end

Example: Configuring Device Classifier Profiles

The following is a sample configuration for profiling of a CDP packet. After the match is found, the device gets classified as Terminal-Server.

Device> enable
Device# configure terminal
Device(config)# device classifier condition ts-cond1
Device(config-device-classifier-condition)# cdp tlv-type 1 value String TS01
Device(config-device-classifier-condition)# exit
Device(config)# device classifier device-type Terminal-Server
Device(config-device-classifier-dtype)# condition ts-cond1

The following is a sample configuration of profiling for two different protocols with device name TLV of CDP packet and system name TLV of LLDP packet. If both the protocol matches are found, the device gets classified as Terminal-Server.

Device> enable
Device# configure terminal
Device(config)# device classifier condition ts-cond2 op OR
Device(config-device-classifier-condition)# cdp tlv-type 1 value integer 0x0029
Device(config-device-classifier-condition)# lldp tlv-type 5 value String TS02
Device(config-device-classifier-condition)# lldp tlv-type 4 value regex fibre*
Device(config-device-classifier-condition)# exit
Device(config)# device classifier device-type Terminal-Server
Device(config-device-classifier-dtype)# condition ts-cond2

The following is a sample configuration of profiling for two different protocols with device name TLV of CDP packet and system name TLV of LLDP packet. If both the protocol matches are found, the device gets classified as Terminal-Server.

Device> enable
Device# configure terminal
Device(config)# device classifier condition ts-cond2 op AND
Device(config-device-classifier-condition)# cdp tlv-type 1 value integer 0x0001
Device(config-device-classifier-condition)# lldp tlv-type 5 value String TS02
Device(config-device-classifier-condition)# lldp tlv-type 4 value regex fibre*
Device(config-device-classifier-condition)# exit
Device(config)# device classifier device-type Terminal-Server
Device(config-device-classifier-dtype)# condition ts-cond3

Feature History for Auto SmartPorts

This table provides release and related information for features explained in this module.

These features are available on all releases subsequent to the one they were introduced in, unless noted otherwise.

Table 1. Feature History for Auto SmartPorts

Release

Feature

Feature Information

Cisco IOS XE Everest 16.5.1a

Auto SmartPorts

Auto SmartPort macros dynamically configure ports based on the device type detected on the port. When the switch detects a new device on a port, it applies the appropriate Auto SmartPorts macro.

Cisco IOS XE Bengaluru 17.4.1

Device Classifier Profiles

Allows you to configure the rules for matching and classifying the device using device classifier conditions.

Use Cisco Feature Navigator to find information about platform and software image support. To access Cisco Feature Navigator, go to Cisco Feature Navigator.