Smartport Commands

This chapter contains the following sections:

macro auto (Global)

The macro auto Global Configuration mode command sets the Auto Smartports administrative global state. The no format of the command returns to the default.

Syntax

macro auto {enabled | disabled | controlled}

no macro auto

Parameters

  • enabled—Auto Smartport administrative global and operational states are enabled.

  • disabled—Auto Smartport administrative global and operational states are disabled.

  • controlled—Auto Smartport administrative global and operational states are enabled when Auto Voice VLAN is in operation.

Default Configuration

Administrative state is Disabled

Command Mode

Global Configuration mode

User Guidelines

Regardless of the status of Auto Smartport, you can always manually apply a Smartport macro to its associated Smartport type. A Smartport macro is either a built-in macro or a user-defined macro. You can define and apply a macro using the CLI commands presented in the Macro Commands section.

If the Auto Smartport Administrative state is controlled, the Auto Smartport Operational state is managed by the Voice VLAN manager and is set as follows:

  • Auto Smartport Operational state is disabled when the OUI Voice VLAN is enabled.

    Auto Smartport Operational state is enabled when the Auto Voice VLAN is enabled.

A user cannot enable Auto Smartport globally if the OUI Voice VLAN is enabled.

Example

This example shows an attempt to enable the Auto Smartport feature globally in the controlled mode. This is not possible because the OUI voice feature is enabled. The voice VLAN state is then disabled, after which Auto Smartports can be enabled. The appropriate VLANs are automatically enabled because the ports are configured for Auto Smartports on these VLANs.

switchxxxxxx(config)# macro auto controlled
switchxxxxxx(config)# macro auto enabled
Auto smartports cannot be enabled because OUI voice is enabled.
switchxxxxxx(config)# voice vlan state disabled
switchxxxxxx(config)# macro auto enabled
switchxxxxxx(config)#
10-Apr-2011 16:11:31 %LINK-I-Up:  Vlan 20
10-Apr-2011 16:11:33 %LINK-I-Up:  Vlan 5
10-Apr-2011 16:11:33 %LINK-I-Up:  Vlan 6
10-Apr-2011 16:11:33 %LINK-I-Up:  Vlan 7
10-Apr-2011 16:11:33 %LINK-I-Up:  Vlan 8
10-Apr-2011 16:11:33 %LINK-I-Up:  Vlan 9
10-Apr-2011 16:11:33 %LINK-I-Up:  Vlan 10

macro auto built-in parameters

The macro auto built-in parameters Global Configuration mode command replaces the default Auto Smartport values of built-in Smartport macros. The no format of the command returns to the default values.

Syntax

macro auto built-in parameters smartport-type [parameter-name value [parameter-name value [parameter-name value]]]

no macro auto built-in parameters smartport-type

Parameters

  • smartport-type—Smartport type (range: printer, desktop, guest, server, host, ip_camera, ip_phone, ip_phone_desktop, switch, router or wireless access point (ap)).

  • parameter-name value—Specifies the parameter name and its value. These are the parameters of the built-in or user-defined macro defined in the macro auto user smartport macro command

Default Configuration

The default value of parameter $native_vlan of the built-in Smartport macros is 1.

For other parameters, the default value is the parameter’s default value. For instance, if the parameter is the native VLAN, the default value is the default native VLAN.

Command Mode

Global Configuration mode

User Guidelines

By default, each Smartport type is associated with a pair of built-in macros: a macro that applies the configuration and the anti macro (no macro) to remove the configuration. The Smartport types are the same as the name of the corresponding built-in Smartport macros, with the anti macro prefixed with no_.

The value of the parameter $voice_vlan cannot be changed by this command.

Example

To change the parameters of a built-in macro:

switchxxxxxx(config)# macro auto built-in parameters switch $native_vlan 2

macro auto persistent

The macro auto persistent Interface Configuration mode command sets the interface as a Smartport persistent interface. The no format of the command returns it to default.

Syntax

macro auto persistent

no macro auto persistent

Parameters

This command has no parameters or keywords.

Default Configuration

Persistent is set.

Command Mode

Interface (Ethernet, Port Channel) Configuration mode

User Guidelines

A Smartport’s persistent interface retains its dynamic configuration in the following cases: link down/up, the attaching device ages out, and reboot. Note that for persistence and the Smartport configuration to be effective across reboot, the Running Configuration file must be saved to the Startup Configuration file.

Example

The example establishes two port ranges and makes one persistent and the other not.

switchxxxxxx(config)# interface range gi1/0/1-2
switchxxxxxx(config-if-range)# macro auto persistent
switchxxxxxx(config-if-range)# exit
switchxxxxxx(config)# interface range gi1/0/3-4
switchxxxxxx(config-if-range)# no macro auto persistent

macro auto processing cdp

The macro auto processing cdp Global Configuration mode command enables using CDP capability information to identify the type of an attached device.

When Auto Smartport is enabled on an interface and this command is run, the switch automatically applies the corresponding Smartport type to the interface based on the CDP capabilities advertised by the attaching device(s).

The no format of the command disables the feature.

Syntax

macro auto processing cdp

no macro auto processing cdp

Parameters

This command has no parameters or keywords.

Default Configuration

Enabled

Command Mode

Global Configuration mode

Example

To enable CDP globally:

switchxxxxxx(config)# macro auto processing cdp

macro auto processing lldp

The macro auto processing lldp Global Configuration mode command enables using the LLDP capability information to identify the type of an attached device.

When Auto Smartport is enabled on an interface and this command is run, the switch automatically applies the corresponding Smartport type to the interface based on the LLDP capabilities advertised by the attaching device(s).

The no format of the command disables the feature.

Syntax

macro auto processing lldp

no macro auto processing lldp

Parameters

This command has no parameters or keywords.

Default Configuration

Enabled

Command Mode

Global Configuration mode

Example

To enable LLDP globally:

switchxxxxxx(config)# macro auto processing lldp

macro auto processing type

The macro auto processing type Global Configuration mode command enables or disables automatic detection of devices of given type. The no format of the command returns to the default.

Syntax

macro auto processing type smartport-type {enabled | disabled}

no macro auto processing type smartport-type

Parameters

  • smartport-type—Smartport type (range: host, ip_phone, ip_phone_desktop, switch, router or wireless access point (ap)).

Default Configuration

By default, auto detection of ip_phone, ip_phone_desktop, switch, and wireless access point (ap) is enabled.

Command Mode

Global Configuration mode

Example

In this example, automatic detection of wireless access points (ap) is enabled.

switchxxxxxx(config)# macro auto processing type ?
  host                 set type to host
  ip_phone             set type to ip_phone
  ip_phone_desktop     set type to ip_phone_desktop
  switch               set type to switch
  router               set type to router
  ap                   set type to access point
switchxxxxxx(config)# macro auto processing type ap enabled

macro auto resume

The macro auto resume Interface Configuration mode command changes the Smartport type from unknown to default and resumes the Smartport feature on a given interface (but does not reapply the Smartport macro; this is done by the macro auto trunk refresh command).

Syntax

macro auto resume

Parameters

This command has no parameters or keywords.

Default Configuration

None

Command Mode

Interface (Ethernet, Port Channel) Configuration mode

User Guidelines

When a Smartport macro fails at an interface, the Smartport type of the interface becomes Unknown. You must diagnose the reason for the failure on the interface and/or Smartport macro, and correct the error.

Example

Changes the Smartport type from unknown to default and resumes the Smartport feature on port 1.

switchxxxxxx(config)# interface gi1/0/1
switchxxxxxx(config-if)# macro auto resume

macro auto smartport (Interface)

The macro auto smartport Interface Configuration mode command enables the Auto Smartport feature on a given interface. The no format of the command disables the feature on the interface.

Syntax

macro auto smartport

no macro auto smartport

Parameters

This command has no parameters or keywords.

Default Configuration

Enabled.

Command Mode

Interface (Ethernet, Port Channel) Configuration mode

User Guidelines

This command is effective only when Auto Smartport is globally enabled.

Example

Enables the Auto Smartport feature on port 1:

switchxxxxxx(config)# interface gi1/0/1
switchxxxxxx(config-if)# macro auto smartport

macro auto smartport type

The macro auto smartport type Interface Configuration mode command manually (statically) assigns a Smartport type to an interface. The no format of the command removes the manually-configured type and returns it to default.

Syntax

macro auto smartport type smartport-type [parameter-name value [parameter-name value [parameter-name value]]]

no macro auto smartport type

Parameters

  • smartport-type—Smartport type.

  • parameter-name value —Specifies the parameter name and its value (Range: printer, desktop, guest, server, host, ip_camera, ip_phone, ip_phone_desktop, switch, router or wireless access point (ap)).

Default Configuration

parameter-name value—Parameter default value. For instance, if the parameter is the voice VLAN, the default value is the default voice VLAN.

Command Mode

Interface (Ethernet, Port Channel) Configuration mode

User Guidelines

A static type set by the command cannot be changed by a dynamic type.

Example

This example shows an attempt to set the Smartport type of port 1 to printer (statically). The macro fails at line 10.

switchxxxxxx(config)# interface gi1/0/1
switchxxxxxx(config-if)# macro auto smartport type printer
30-May-2011 15:02:45 %AUTOSMARTPORT-E-FAILEDMACRO: Macro printer for auto smar
port type Printer on interface gi1/0/1 failed at command number 10
switchxxxxxx(config-if)# exit
switchxxxxxx(config)# do show parser macro name printer
Macro name : printer
Macro type : default interface
  1. #macro description printer
  2. #macro keywords $native_vlan
  3. #
  4. #macro key description:  $native_vlan: The untag VLAN which will be configu
red on the port
  5. #Default Values are
  6. #$native_vlan = Default VLAN
  7. #
  8. #the port type cannot be detected automatically
  9. #
 10. switchport mode access
 11. switchport access vlan $native_vlan
 12. #
 13. #single host
 14. port security max 1
 15. port security mode max-addresses
 16. port security discard trap 60
 17. #
 18. smartport storm-control broadcast level 10
 19. smartport storm-control include-multicast
 20. smartport storm-control broadcast enable
switchxxxxxx(config)#

macro auto trunk refresh

The macro auto trunk refresh Global Configuration command reapplies the Smartport macro on a specific interface, or to all the interfaces with the specified Smartport type.

Syntax

macro auto trunk refresh [smartport-type] [interface-id]

Parameters

  • smartport-type—Smartport type (switch, router, wireless access point (ap))

  • interface-id—Interface Identifier (port or port channel).

Default Configuration

See User Guidelines.

Command Mode

Global Configuration mode

User Guidelines

The macro auto smartport command becomes effective only when the Auto Smartport is globally enabled.

If both smartport-type and interface-id are defined, the attached Smartport macro is executed on the interface if it has the given Smartport type.

If only smartport-type is defined, the attached Smartport macro is executed on all interfaces having the given Smartport type.

If only interface-id is defined then the corresponding attached Smartport macro is executed if the interface has one of the following Smartport types: switch, router or wireless access point (ap).

If a Smartport macro contains configuration commands that are no longer current on one or more interfaces, you can update their configuration by reapplying the Smartport macro on the interfaces.

Example

Adds the ports of Smartport type switch to all existing VLANs by running the associated Smartport macros.

switchxxxxxx(config)# macro auto trunk refresh switch

macro auto user smartport macro

The macro auto user smartport macro Global Configuration mode command links user-defined Smartport macros to a Smartport type. This is done by replacing the link to the built-in macro with the link to the user-defined macro. The no format of the command returns the link to the default built-in Smartport macro.

Syntax

macro auto user smartport macro smartport-type user-defined-macro-name [parameter-name value [parameter-name value [parameter-name value]]]

no macro auto user smartport macro smartport-type

Parameters

  • smartport-type—Smartport type (range: printer, desktop, guest, server, host, ip_camera, ip_phone, ip_phone_desktop, switch, router or wireless access point (ap)).

  • user-defined-macro-name—Specifies the user-defined macro name that replaces the built-in Smartport macro.

  • parameter-name value—Specifies the parameter name and its value in the user-defined macro.

Default Configuration

parameter-name value—Parameter’s default value. For instance, if the parameter is the native VLAN, the default value is the default native VLAN.

Command Mode

Global Configuration mode

User Guidelines

The scope of each parameter is the macro in which it is defined, with the exception of the parameter $voice_vlan, which is a global parameter and its value is specified by the switch and cannot be defined in a macro.

The macros must be defined before linking them in this command.

Smartport macros must be disconnected from the Smartport type before removing them (using the no version of this command).

To associate a Smartport type with a user-defined macros, you must have defined a pair of macros: one to apply the configuration, and the other (anti macro) to remove the configuration. The macros are paired by their name. The name of the anti macro is the concatenation of no_ with the name of the corresponding macro. Please refer to the Macro Command section for details about defining macro.

Example

To link the user-defined macro: my_ip_phone_desktop to the Smartport type: ip_phone_desktop and provide values for its two parameters:

switchxxxxxx(config)# macro auto user smartport macro ip_phone_desktop my_ip_phone_desktop $p1 1 $p2 2

show macro auto ports

The show macro auto ports EXEC mode command displays information about all Smartport ports or a specific one. If a macro was run on the port and it failed, the type of the port is displayed as Unknown.

Syntax

show macro auto ports [interface-id | detailed]

Parameters

  • interface-id—Interface Identifier (Ethernet interface, port channel)

  • detailed—Displays information for non-present ports in addition to present ports.

Default Configuration

Information about all ports is displayed.

Command Mode

User EXEC mode

Examples

Example 1—Note that Smartport on switch and phone types was configured automatically. Smartport on routers was configured statically. Auto smartports are enabled globally.

switchxxxxxx# show macro auto ports
Smartport is enabled
Administrative Globally Auto Smartport is enabled
Operational Globally Auto Smartport is enabled

Interface
-----------
gi1/0/1
gi1/0/2
gi1/0/3
gi1/0/4

Auto Smartport
Admin State
-------------- disabled
disabled
enabled
enabled

Persistent
State
----------
enabled
enabled
disabled
enabled

Smartport Type
--------------
router(static)
switch
default
phone

Example 2—Note that Smartport on switch and phone types was configured automatically. Smartport on routers was configured statically. Auto smartports are enabled globally.

switchxxxxxx# show macro auto ports
Smartport is enabled
Administrative Globally Auto Smartport is disabled
Operational Globally Auto Smartport is disabled

Interface
-----------
gi1/0/1
gi1/0/2
gi1/0/3
gi1/0/4

Auto Smartport
Admin State
-------------- disabled
disabled
enabled
enabled

Persistent
State
----------
enabled
enabled
disabled
enabled

Smartport Type
--------------
router(static)
switch
default
phone

Example 3—Disabling auto SmartPort on gi1/0/2:

switchxxxxxx(config)# interface gi1/0/2
switchxxxxxx(config-if)# no macro auto smartport
switchxxxxxx(config-if)# end
switchxxxxxx# show macro auto ports gi1/0/2
SmartPort is Enabled
Administrative Globally Auto SmartPort is controlled
Operational Globally Auto SmartPort is enabled
Auto SmartPort is disabled on gi1/0/2
Persistent state is not-persistent
Interface type is default
No macro has been activated

Example 4—Enabling auto Smartport on gi1/0/1:

switchxxxxxx(config)# interface gi1/0/1
switchxxxxxx(config-if)# macro auto smartport
switchxxxxxx(config-if)# end
switchxxxxxx# show macro auto ports gi1/0/1
SmartPort is Enabled
Administrative Globally Auto SmartPort is enabled
Operational Globally Auto SmartPort is enabled
Auto SmartPort is enabled on gi1/0/1
Persistent state is persistent
Interface type is switch
Last activated macro is switch

show macro auto processing

The show macro auto processing EXEC mode command displays information about which protocols (CDP/LLDP) are enabled and which device types can be detected automatically.

Syntax

show macro auto processing

Parameters

This command has no parameters or keywords.

Default Configuration

None

Command Mode

User EXEC mode

Example

switchxxxxxx# show macro auto processing
CDB: enabled
LLDP: enabled
host            :disabled
ip_phone        :enabled
ip_phone_desktop:enabled
switch          :enabled
router          :disabled
ap              :enabled

show macro auto smart-macros

The show macro auto smart-macros EXEC mode command displays the name of Smartport macros, their type (built-in or user-defined) and their parameters. This information is displayed for all Smartport types or for the specified one.

Syntax

show macro auto smart-macros [smartport-type]

Parameters

  • smartport-type—Smartport type (range: printer, desktop, guest, server, host, ip_camera, ip_phone, ip_phone_desktop, switch, router or wireless access point (ap)).

Default Configuration

None

Command Mode

User EXEC mode

Example

switchxxxxxx# show macro auto smart-macros
SG300-52-R#show macro auto smart-macros
SmartPort type : printer
Parameters     : $native_vlan=1
SmartPort Macro: printer (Built-In)
SmartPort type : desktop
Parameters     : $max_hosts=10 $native_vlan=1
SmartPort Macro: desktop (Built-In)
SmartPort type : guest
Parameters     : $native_vlan=1
SmartPort Macro: guest (Built-In)
SmartPort type : server
Parameters     : $max_hosts=10 $native_vlan=1
SmartPort Macro: server (Built-In)
SmartPort type : host
Parameters     : $max_hosts=10 $native_vlan=1
SmartPort Macro: host (Built-In)
SmartPort type : ip-camera
Parameters     : $native_vlan=1
SmartPort Macro: ip_camera (Built-In)
SmartPort type : ip-phone
Parameters     : $max_hosts=10 $native_vlan=1 $voice_vlan=1
SmartPort Macro: ip_phone (Built-In)
SmartPort type : ip-phone-desktop
Parameters     : $max_hosts=10 $native_vlan=1 $voice_vlan=1
SmartPort Macro: ip_phone_desktop (Built-In)
SmartPort type : switch
Parameters     : $native_vlan=1 $voice_vlan=1
SmartPort Macro: switch (Built-In)
SmartPort type : router
Parameters     : $native_vlan=1 $voice_vlan=1
SmartPort Macro: router (Built-In)
SmartPort type : ap
Parameters     : $native_vlan=1 $voice_vlan=1
SmartPort Macro: ap (Built-In)
SG300-52-R#

smartport storm-control

To enable broadcast, multicast, or unicast storm control on an interface, use the storm-control command in Interface (Ethernet, Port Channel) Configuration mode. To return to default, use the no form of this command.

Syntax

smartport storm-control broadcast {level level | kbps kbps} [trap] [shutdown]

no smartport storm-control broadcast

smartport storm-control multicast [registred | unregistred] {level level | kbps kbps} [trap] [shutdown]

no smartport storm-control multicast

smartport storm-control unicast {level level | kbps kbps} [trap] [shutdown]

no smartport storm-control unicast

no smartport storm-control

Parameters

  • broadcast—Enables broadcast storm control on the port.

  • multicast [registred | unregistred]—Enables ether all multicast, only registered multicast, or only unregistered multicast storm control on the port.

  • unicast—Enables unicast unknown storm control on the port.

  • level level—Suppression level in percentage. Block the flooding of storm packets when the value specified for level is reached. (Range 1-100)

  • kbps kbps—Maximum of kilobits per second of Broadcast traffic on a port. (Range 1 –10000000)

  • trap—(Optional) Sends a trap when a storm occurs on a port. If the keyword is not specified the trap is not sent.

  • shutdown—(Optional) Shut down a port when a storm occurs on the port. If the keyword is not specified extra traffic is discarded.

Default Configuration

Storm control is disabled.

Command Mode

Interface (Ethernet, Port Channel) Configuration mode

Examples

Example 1 - Set the maximum number of kilobits per second of Broadcast traffic on port 1 to 10000.

switchxxxxxx(config)# interface gi1/0/1
switchxxxxxx(config-if)# smartport storm-control broadcast kpbs 10000

Example 2 - Set the maximum percentage of kilobits per second of Broadcast traffic on port 1 to 30%.

switchxxxxxx(config)# interface gi1/0/1
switchxxxxxx(config-if)# smartport storm-control broadcast level 30