Configuring policy-based routing (PBR) on a Cisco Layer 3 switch involves setting up rules to forward traffic based on specific criteria, such as source IP address, protocol, or application. Here’s a general guide on how to configure PBR on a Cisco Layer 3 switch:
- Access the Configuration Mode:
Log in to the Cisco Layer 3 switch and access privileged EXEC mode:
enable
- Enter Global Configuration Mode:
configure terminal
- Create an Access Control List (ACL):
Define the criteria for policy-based routing using an ACL. For example, to match traffic from a specific source IP address:
access-list <acl_number> permit ip <source_ip> <wildcard_mask>
Replace <acl_number>
with a numerical value to identify the ACL, <source_ip>
with the specific source IP address, and <wildcard_mask>
with the corresponding wildcard mask.
- Configure Route Map:
Create a route map that references the previously created ACL and specifies the next hop IP address for matched traffic:
route-map <route_map_name> permit <sequence_number>
match ip address <acl_number>
set ip next-hop <next_hop_ip>
Replace <route_map_name>
with a name to identify the route map, <sequence_number>
with a numerical value to specify the order of precedence, <acl_number>
with the ACL number created in step 3, and <next_hop_ip>
with the IP address of the next hop router.
- Apply Route Map to Interface:
Apply the route map to the interface where traffic should be subjected to PBR:
interface <interface_type> <interface_number>
ip policy route-map <route_map_name>
Replace <interface_type>
and <interface_number>
with the corresponding interface type and number (e.g., GigabitEthernet
, FastEthernet
, etc.), and <route_map_name>
with the name of the route map created in step 4.
- Verify Configuration:
Verify the PBR configuration using theshow route-map
andshow ip policy
commands:
show route-map <route_map_name>
show ip policy
Ensure that the ACL, route map, and interface configuration are correctly applied.
- Save Configuration:
Save the configuration changes:
end
write memory
This ensures that the configuration persists across device reboots.
Remember to replace placeholder values with your specific network requirements. Additionally, always test the PBR configuration in a controlled environment to ensure that it behaves as expected before deploying it in a production network.