Example for Configuring Interface PBR
Networking Requirements
- Redirect the packets that are received from GE2/0/0 and destined for the Server and have the source IP address 10.2.1.1 to the next hop at 10.5.1.2. The flow policy call for this interface has a higher priority.
- Redirect the HTTP packets that are received from GE2/0/0 and destined for the Server the next hop at 10.3.1.2.
Procedure
- Configure the router.
# sysname Router # acl number 3005 //Create ACL 3005 to permit packets with the source IP address 10.2.1.1. rule 0 permit ip source 10.2.1.1 0 # acl number 3006 //Create ACL 3006 to permit HTTP packets. rule 0 permit tcp destination-port eq www # traffic classifier 10.2.1.1 operator or if-match acl 3005 traffic classifier www operator or if-match acl 3006 # traffic behavior 10.2.1.1 redirect ip-nexthop 10.5.1.2 traffic behavior www redirect ip-nexthop 10.3.1.2 # Traffic policy pbr Classifier 10.2.1.1 behavior 10.2.1.1 precedence 5 Classifier www behavior www precedence 10 # interface GigabitEthernet2/0/0 ////Configure an IP address for GE2/0/0 ip address 10.1.2.1 255.255.255.0 traffic-policy pbr inbound # interface GigabitEthernet2/0/1 ip address 10.3.1.1 255.255.255.0 # interface GigabitEthernet2/0/2 ip address 10.4.1.1 255.255.255.0 # interface GigabitEthernet2/0/3 ip address 10.5.1.1 255.255.255.0 # ip route-static 192.168.1.0 24 10.3.1.2 //Configure static routes and ensure that the three paths are reachable and the default next hop is at 10.4.1.2 ip route-static 192.168.1.0 24 10.4.1.2 preference 40 ip route-static 192.168.1.0 24 10.5.1.2 # return
- Verify the configuration.
# Run the display traffic classifier user-defined [ classifier-name ] command. The command displays the traffic classifier configuration on the device.
# Run the display traffic behavior { system-defined | user-defined } [ behavior-name ] command. The command displays the traffic behavior configuration on the device.
# Run the display traffic policy user-defined [ policy-name [ classifier classifier-name ] ] command. The command displays the traffic policy configuration on the device.
# Run the display traffic-policy applied-record [ policy-name ] command. The command displays traffic policy records.