June 2012 | 9 min read
In Cisco IOS, route maps serve as a highly flexible tool for defining conditional routing and policy enforcement. They are widely used in policy-based routing (PBR), redistribution, filtering, and advanced BGP/OSPF manipulations. This post dives into their syntax, structure, and best practices.
What is a Route Map?
A route map is essentially a conditional if-then construct for modifying or filtering routes. Each route map comprises multiple numbered entries called clauses. These are evaluated sequentially until a match occurs, making the order of entries critical.
Route Map Use Cases
- Policy-Based Routing (PBR): Forwarding decisions based on source IP or packet attributes, not just destination.
- Redistribution Control: Manipulating which routes are injected between protocols (e.g., OSPF to BGP).
- Prefix Filtering: Allow or deny based on prefix-lists or access-lists.
- Attribute Manipulation: Changing BGP metrics (MED, weight, local preference).
Route Map Syntax Overview
route-map <name> permit|deny <sequence>
match ...
set ...
Each clause contains match
statements (criteria) and set
statements (actions). If no match is made, the next clause is evaluated. If no clauses match, the route is denied by default.
Policy-Based Routing Example
access-list 101 permit ip 192.168.10.0 0.0.0.255 any
route-map PBR permit 10
match ip address 101
set ip next-hop 10.1.1.1
interface FastEthernet0/0
ip policy route-map PBR
This configuration routes traffic from 192.168.10.0/24 to next-hop 10.1.1.1 regardless of the routing table.
Controlling Redistribution
Let’s look at filtering route redistribution into OSPF:
route-map REDIST deny 10
match ip address 10
route-map REDIST permit 20
router ospf 1
redistribute eigrp 100 route-map REDIST
This example denies redistribution of certain prefixes while allowing all others.
Match and Set Commands
Some of the most common match commands:
match ip address
match interface
match metric
match route-type
Useful set commands include:
set ip next-hop
set metric
set local-preference
set weight
Best Practices
- Use sequence numbers in increments (e.g., 10, 20, 30) for flexibility.
- Test route-map logic with
show route-map
anddebug ip policy
. - Document the logic inside config with comments.
- Combine with prefix-lists for efficient and readable filtering.
Verifying Route Maps
Verification tools:
show route-map
show ip policy
show ip bgp
orospf database
debug ip policy
(use with care)
Conclusion
Route maps are foundational tools in Cisco IOS. Whether directing traffic with PBR or shaping protocol behavior, mastering route-map logic will elevate your capabilities in enterprise network design and troubleshooting.
No comments:
Post a Comment