service-policy (interface)

Binds a policy map as a service policy to an interface.

Syntax

service-policy in | out policy-mapname
no service-policy in | out

Command Default

No service policy is created.

Parameters

in
Binds policy map to inbound traffic.
out
Binds policy map to outbound traffic.
policy-mapname
Name of the policy map.

Modes

Interface, Port Channel, and VE subtype configuration mode

Usage Guidelines

This command applies a policy-map containing a class-map with specific Policer parameters and match critters to a device interface. The policy map must be configured before you can apply it (refer to the description of the policy-map command).

The no form of this command removes the service policy.

Examples

To create a service policy for outbound traffic on a specific Ethernet interface:
device# configure terminal
device(config)# interface ethernet 2/8
device(conf-if-eth-2/8)# service-policy out policymap1
                    
To remove a service policy for outbound traffic from a specific Ethernet interface:
device# configure terminal
device(config)# interface ethernet 2/8 
device(conf-if-eth-2/8)# no service-policy out
                    
To remove a service-policy for inbound traffic on a specific Ethernet interface:
device# configure terminal
device(config)# interface ethernet 2/8
device(conf-if-eth-2/8)# no service-policy in 
                    
This example configures IPV4 ACL based ingress rate-limiting on a VE interface. The show command displays the current configuration for the interface.
SLX(config)# int ve 100
SLX(config-if-Ve-100)#
SLX(config-if-Ve-100)# service-policy in policy-map_1
SLX(config-if-Ve-100)#

SLX# show running-config interface Ve 100
interface Ve 100
service-policy in policy-map_1
ip address 10.0.0.2/24
no shutdown
!
SLX#

This example configures IPV4 ACL based egress rate-limiting on a VE interface. The show command displays the current configuration for the interface.

SLX(config)# int ve 100
SLX(config-if-Ve-100)#
SLX(config-if-Ve-100)# service-policy out policy-map_1
SLX(config-if-Ve-100)#

SLX# show running-config interface Ve 100
interface Ve 100
service-policy out policy-map_1
ip address 10.0.0.2/24
no shutdown
!
SLX#

The following is the configuration for the Policy map used in the above two (2) examples.

ip access-list extended ipv4acl
    seq 100 permit ip 10.10.10.10 255.255.255.0 10.10.10.20 255.255.255.0

    class-map class-map_1
        match access-group ipv4acl

    policy-map policy-map_1
        class class-map_1
        Police cir 3000000 eir 300000000