Interface Templates

Interface Templates

An interface template provides a mechanism to configure multiple commands at the same time and associate it with a target such as an interface. An interface template is a container of configurations or policies that can be applied to specific ports.

Restrictions for Interface Templates

  • Interface templates are not applicable for wireless sessions.

  • Remote storing and downloading of templates is not supported.

  • The same configuration cannot be used for port and interface template on the switch.

Information About Interface Templates

About Interface Templates

An interface template is a container of configurations or policies that can be applied to specific ports. When an interface template is applied to an access port, it impacts all traffic that is exchanged on the port.

There are two types of interface templates; user and builtin templates. Builtin templates are created by the system.

You can modify builtin templates. If you delete a modified builtin template the system restores the original definition of the template.

The following are the available builtin templates:

  • AP_INTERFACE_TEMPLATE (Access Point)

  • DMP_INTERFACE_TEMPLATE (Digital Media Player)

  • IP_CAMERA_INTERFACE_TEMPLATE

  • IP_PHONE_INTERFACE_TEMPLATE

  • LAP_INTERFACE_TEMPLATE (Lightweight Access Point)

  • MSP_CAMERA_INTERFACE_TEMPLATE

  • MSP_VC_INTERFACE_TEMPLATE (Video Conferencing)

  • PRINTER_INTERFACE_TEMPLATE

  • ROUTER_INTERFACE_TEMPLATE

  • SWITCH_INTERFACE_TEMPLATE

  • TP_INTERFACE_TEMPLATE (TelePresence)

Following is an example of a builtin interface template:

Template Name       : IP_CAMERA_INTERFACE_TEMPLATE
Modified            : No
Template Definition :
 spanning-tree portfast
 spanning-tree bpduguard enable
 switchport mode access
 switchport block unicast
 switchport port-security
 srr-queue bandwidth share 1 30 35 5
 priority-queue out 
!

You can also create specific user templates with the commands that you want to include.


Note


The template name must not contain spaces.


You can create an interface template using the template command in global configuration mode. In template configuration mode, enter the required commands. The following commands can be entered in template configuration mode:

Command Description
access-session

Configures access session specific interface commands.

authentication

Configures authentication manager Interface Configuration commands.

carrier-delay

Configures delay for interface transitions.

dampening

Enables event dampening.

default

Sets a command to its defaults.

description

Configures interface-specific description.

dot1x

Configures interface configuration commands for IEEE 802.1X.

hold-queue

Sets hold queue depth.

ip

Configures IP template.

keepalive

Enables keepalive.

load-interval

Specifies interval for load calculation for an interface.

mab

Configures MAC authentication bypass Interface.

mls

Enables multilayer switching configurations.

peer

Configures peer parameters for point to point interfaces.

priority-queue

To set the priority-queue size for a template.

queue-set

Configures the QoS queue set on a template.

radius-server

Enables RADIUS server configurations.

service-policy

Configures CPL service policy.

source

Gets configurations from another source.

spanning-tree

Configures spanning tree subsystem

storm-control

Configures storm control.

subscriber

Configures subscriber inactivity timeout value.

switchport

Sets switching mode configurations

trust

Sets trust value for the interface.


Note


  • System builtin templates are not displayed in the running configuration. These templates show up in the running configuration only if you edit them.

  • The stateful switchover fails if access-session and swithcport mode access are both configured in an interface template. To avoid the switchover failure, configure the switchport mode access command on the interface, instead of in an interface template.

  • When you configure an interface template, it is recommended that you enter all the required dependent commands on the same template. It is not recommended to configure the dependent commands on two different templates.


Binding an Interface Template to a Target

Each template can be bound to a target. Template binding or sourcing can be either static or dynamic. Static binding of a template involves binding the template to a target, like an interface. Only one template can be bound at a time using static binding. Static binding of another template to the same target will unbind the previously bound template. To configure static binding, use the source template command in interface configuration mode.

Any number of templates can be bound dynamically to a target. To configure dynamic binding using builtin policy maps and parameter maps, enable the autoconf feature using the autoconf enable command.


Note


You can have statically and dynamically bind templates on the same interface at a time.


Priority for Configurations Using Interface Templates

Configuration applied through dynamically-bound templates has the highest priority, followed by configuration applied directly on the interface, and then configuration applied through statically-bound templates. When similar commands are present at different priority levels, the one at the highest priority is applied. If a configuration at a higher priority level is not applied, then the configuration with the next highest priority is applied to the target.

Multiple templates can be dynamically bound to a target. When multiple templates are dynamically bound, the template that is applied last has the highest priority.

To delete a template, you must remove the binding to all targets. If you bind a template that does not exist, a new template is created with no configurations.

Configuring Interface Templates

Perform the following task to create user interface templates:

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

template name

Example:


Device(config)# template user-template1
Creates a user template and enters template configuration mode.

Note

 
Builtin template are system-generated.

Step 4

load-interval interval

Example:


Device(config-template)# load-interval 60
Configures the sampling interval for statistics collections on the template.

Note

 
Builtin template are system-generated.

Step 5

description description

Example:


Device(config-template)# description This is a user template
Configures the description for the template.

Step 6

keepalive number

Example:


Device(config-template)# Keepalive 60
Configures the keepalive timer.

Step 7

end

Example:


Device(config)# end

Exits global configuration mode and returns to privileged EXEC mode.

Configuring Static Binding for Interface Templates

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

interface type number

Example:


Device(config)# interface GigabitEthernet 1/1

Specifies the interface type and number and enters interface configuration mode.

Step 4

source template name

Example:


Device(config-if)# source template user-template1

Statically applies an interface template to a target.

Step 5

end

Example:


Device(config-if)# end

Exits interface configuration mode and returns to privileged EXEC mode.

Example

To verify static binding use the show running-config interface int-name and the show derived-config interface int-name commands.

Device# show running-config interface GigabitEthernet 1/1

Building configuration...

Current configuration : 71 bytes
!
interface GigabitEthernet1/1
source template user-template1
end
Device# show derived-config interface GigabitEthernet 1/1
Building configuration...

Derived configuration : 108 bytes
!
interface GigabitEthernet1/1
description This is a user template
load-interval 60
keepalive 60
end

Configuring Dynamic Binding of Interface Templates

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

interface type number

Example:


Device(config)# interface GigabitEthernet 1/1

Specifies the interface type and number and enters interface configuration mode.

Step 4

service-policy type control subscriber policymap-name

Example:


Device(config-if)# service-policy type control subscriber POLICY-Gi1/1

Dynamically applies an interface template to a target.

Step 5

end

Example:


Device(config-if)# end

Exits interface configuration mode and returns to privileged EXEC mode.

Verifying an Interface Template

Use one or more of the commands listed below to verify the interface template configuration.

Procedure


Step 1

enable

Example:


Device> enable

Enables privileged EXEC mode.

  • Enter your password if prompted.

Step 2

show template interface all {all | binding {temp-name | all | target int-name} | brief }

Shows all interface template configurations.

Step 3

show template interface source {built-in [original] | user}{temp-name | all}}

Shows interface template source configurations.

Step 4

show template service{all | binding target int-name | brief | source {aaa | built-in | user {temp-name | all}}

Shows all interface template service configurations.

Example: Configuring User Interface Templates

Example: Configuring User Templates

Device# enable
Device (config)# configure terminal
Device(config)# template user-template1
Device(config-template)# load-interval 60
Device(config-template)# description This is a user template
Device(config-template)# Keepalive 60
Device(config)# end

Example: Sourcing Interface Templates

Device> enable
Device# configure terminal
Device(config)# interface gigabitethernet 1/1
Device(config-if)# source template user-template1
Device(config-if)# end

Example: Dynamically Binding Interface Templates

Device> enable
Device# configure terminal
Device(config)# interface GigabitEthernet 1/1
Device(config-if)# service-policy type control subscriber POLICY_Gi1/1
Device(config-if)# end