Using Smartports Macros

Using Smartports Macros

On some Cisco IOS versions (notably Catalyst 3750), there’s a macro that, in a distinct line

of the command-line interface (CLI), configures several recommended lines. This is the

Smartports macro.

Smartports macros accommodate a acceptable way to save and allotment accepted configurations.

You can use Smartports macros to accredit appearance and settings based on the area of a

switch in the arrangement and for accumulation agreement deployments beyond the network. Each

Smartports macro is a set of CLI commands that you define. Smartports macros do not

contain new CLI commands; they are artlessly a accumulation of absolute CLI commands.

When you administer a Smartports macro on an interface, the CLI commands aural the macro

are configured on the interface. Back the macro is activated to an interface, the existing

interface configurations are not lost. The new commands are added to the interface and are

saved in the active agreement file.

Smartports macros abide for several admission anchorage configurations:

• cisco-desktop. Use back abutting a desktop device, such as a PC, to a about-face port.

• cisco-phone. Use back abutting a desktop device, such as a PC with a Cisco IP

Phone, to a about-face port.

When applying the cisco-desktop macro to an admission port, the afterward agreement lines

are automatically generated (where $AVID is a parameter—the VLAN of the port), as

Example 14-8 shows.

Expansion of the cisco-desktop Macro

switchport admission vlan $AVID

switchport approach access

switchport port-security

switchport port-security best 1

switchport port-security abuse restrict

switchport port-security crumbling time 2

switchport port-security crumbling blazon inactivity

spanning-tree portfast

spanning-tree bpduguard enable

It is aboveboard to administer all the above-mentioned settings to one anchorage with the command macro

apply. In this case, the constant $AVID is set to 25:

IOS(config)#interface FastEthernet 0/0

IOS(config-if)# macro administer cisco-desktop $AVID 25

This is not a absolutely defended agreement because, by default, CDP, management

protocols, and so on are still enabled on the port. Smartports macros can be edited, however.

This can be an accessible way to administer a added defended ambience to assorted interfaces.