Get an introduction to Cisco Smartports macros

Cisco Smartports macros can speed up deployment while ensuring accuracy and consistency on your switch ports. A TechRepublic member recently asked David Davis to explain Smartports, and he responded with this overview in this edition of Cisco Routers and Switches.

As regular readers of this column know, I love to get feedback from members and am always open to suggestions for article topics. After reading one of my recent articles, "Recover lost passwords using Cisco configuration registers," TechRepublic member EEnglish34 took me up on the offer:

"Could you do an article on Smartports and their functions? I noticed all of the switches I recently installed have Smartports, but I didn't configure them. Does it matter if I set them up or not? Why are they useful? That would be very helpful."

Smartports macros can speed up deployment while ensuring accuracy and consistency on your switch ports. Here's an overview of Smartports and how they can help with your Cisco switch administration.

Smartports macros are pre-created configuration scripts that work on most Cisco switches. These scripts allow an administrator to more easily configure common switch port configurations. By using these scripts, you can create more consistency with port configurations and perhaps even prevent future trouble.

Smartports macros are available from the Cisco Network Assistant (CNA), the Web interface of the switch itself, and the Cisco IOS CLI. GUI applications can usually tell you the type of devices connected to the port, and they can recommend specific Smartports macros for the proper kind of device.

By default, Cisco switches include macros covering the following types of devices:

  • Cisco-desktop
  • Cisco-phone
  • Cisco-switch
  • Cisco-router
  • Cisco-wireless

These macros automatically configure the port with important commands that pertain to that specific type of device. To determine which preconfigured macros are available on your switch, use the show parser macro command. This command also displays what each macro does. Listing A offers sample output from this command.

Let's look at the most frequently used macro—the Cisco-desktop macro. This macro has a parameter that you must specify when applying it; you need to define which VLAN you want this port to be a part of. Here's an example:

Switch(config)# int fa0/19              
Switch(config-if)# macro apply cisco-desktop $access_vlan 1

Of course, you could also apply the macro to a range of switch ports in one sweep. Now let's look at what this macro did to our switch port, fa0/19:

Switch#sh run int fa0/19
Building configuration...

Current configuration : 343 bytes
interface FastEthernet0/19
 switchport mode access
 switchport port-security
 switchport port-security aging time 2
 switchport port-security violation restrict
 switchport port-security aging type inactivity
 mls qos cos override
 macro description cisco-desktop | cisco-desktop
 spanning-tree portfast
 spanning-tree bpduguard enable


The Cisco-desktop Smartport macro applied all of the above settings on the port. Each macro has its own specific settings to apply and parameters that you need to specify. Keep in mind that you can create your own Cisco IOS Smartports macros to apply your own settings to switch ports.

For more information, check out this Cisco video about Smartports. For more information on Smartports macro commands and configuration, see Cisco's Configuring Smartports Macros documentation for the Catalyst 2950.

Do you have a good switch configuration recommendation to share? What other switch topics are you interested in? Share your comments in this article's discussion.

Miss a column?

Check out the Cisco Routers and Switches Archive, and catch up on David Davis' most recent columns.

Want to learn more about router and switch management? Automatically sign up for our free Cisco Routers and Switches newsletter, delivered each Friday!

David Davis has worked in the IT industry for 12 years and holds several certifications, including CCIE, MCSE+I, CISSP, CCNA, CCDA, and CCNP. He currently manages a group of systems/network administrators for a privately owned retail company and performs networking/systems consulting on a part-time basis.

Editor's Picks

Free Newsletters, In your Inbox