Configuring ACLs with Enhanced Policy Based Routing
Enhanced Policy based routing (ePBR) is used to direct packets that arrive at an interface to a specified next-hop. ePBR is very useful in managing a large number of configured access lists more efficiently.
In ePBR, the router drops the traffic packets if the next hop configured in the PBR policy is not reachable. To avoid packet loss in such scenarios, you must configure multiple next hops for each access control entry.
Restrictions
-
PBR is not supported on Pseudowire Headend (PHWE) subinterfaces.
-
On Cisco ASR 9000 Series 3rd Generation Line Cards, compressed Access Control Lists (ACLs) are not supported when combined with Policy Based Routing (PBR). However, ACLs without compression can be used with PBR.
Configuration
Use the following sample configuration to configure ACLs with ePBR.
/* Configure an access list */
Router(config)# ipv4 access-list INBOUND-ACL
Router(config-ipv4-acl)# 10 permit ipv4 any host 1.1.1.10
Router(config-ipv4-acl)# 20 permit ipv4 any host 1.2.3.4
Router(config-ipv4-acl)# commit
Mon Nov 6 17:22:42.529 IST
Router(config-ipv4-acl)# exit
/* Configure a class map for the access list */
Router(config)# class-map type traffic match-any INBOUND-CLASS
Router(config-cmap)# match access-group ipv4 INBOUND-ACL
Router(config-cmap)# end-class-map
Router(config)# commit
Mon Nov 6 17:29:12.026 IST
/* Configure an ePBR policy map with the class map */
Router(config)# policy-map type pbr INBOUND-POLICY
Router(config-pmap)# class type traffic INBOUND-CLASS
Router(config-pmap-c)# redirect nexthop 192.168.10.1
Router(config-pmap-c)# exit
Router(config-pmap)# class type traffic class-default
Router(config-pmap-c)# transmit
Router(config-pmap-c)# commit
Mon Nov 6 17:25:33.858 IST
Router(config-pmap)# end-policy-map
/* Configure a GigE interface and apply the ePBR policy map to the interface */
Router(config)# interface GigabitEthernet 0/0/0/0
Router(config-if)# ipv4 address 10.10.10.1 255.255.255.0
Router(config-if)# service-policy type pbr input INBOUND-POLICY
Router(config-if)# commit
Mon Nov 6 17:31:23.645 IST
Router(config-if)# exit
Running Configuration
Validate the configuration by using the show run command.
Router(config)# show running-config
Mon Nov 6 17:31:59.015 IST
Building configuration...
!! IOS XR Configuration 0.0.0
!! Last configuration change at Mon Nov 6 17:31:23 2017 by UNKNOWN
!
ipv4 access-list INBOUND-ACL
10 permit ipv4 any host 1.1.1.10
20 permit ipv4 any host 1.2.3.4
!
!
class-map type traffic match-any INBOUND-CLASS
match access-group ipv4 INBOUND-ACL
end-class-map
!
!
policy-map type pbr INBOUND-POLICY
class type traffic INBOUND-CLASS
redirect ipv4 nexthop 192.168.10.1
!
class type traffic class-default
transmit
!
end-policy-map
!
interface GigabitEthernet0/0/0/0
service-policy type pbr input INBOUND-POLICY
ipv4 address 10.10.10.1 255.255.255.0
!