Filters and Policies
In Juniper routers, routing filters and policies are crucial components for controlling route advertisement, acceptance, and manipulation. They help secure your network by filtering unwanted routes and implementing routing policies for different peers.
Components of Route Filtering
1. Prefix Lists
Prefix lists define sets of IP prefixes that can be referenced in routing policies. They are commonly used to specify allowed or denied routes.
prefix-list pfx-as-example {
1.1.1.0/24;
1.0.0.0/24;
}
prefix-list pfx-as-example-v6 {
2001:0000:0000::/48;
}2. Route Filter Lists
Route filter lists provide more granular control over route matching, including prefix length matching:
route-filter-list bogon-routes {
0.0.0.0/8 orlonger; # RFC 1122 'this' network
10.0.0.0/8 orlonger; # RFC 1918 private space
100.64.0.0/10 orlonger; # RFC 6598 Shared Address Space
127.0.0.0/8 orlonger; # RFC 1122 localhost
169.254.0.0/16 orlonger; # RFC 3927 link local
172.16.0.0/12 orlonger; # RFC 1918 private space
192.168.0.0/16 orlonger; # RFC 1918 private space
224.0.0.0/3 orlonger; # RFC 5771 multicast
}3. Route Filter Match Types
Common match types include:
exact: Matches the exact prefix lengthorlonger: Matches the prefix and all more specific routesprefix-length-range: Matches prefixes within a length rangelonger: Matches all more specific routes (but not the prefix itself)
Example:
Policy Statements
Policy statements combine various match conditions and actions to implement routing policies. Here's an example of a comprehensive policy:
Common Policy Components
RPKI Validation:
Bogon ASN Filtering:
Blackhole Route Handling:
Best Practices
Default Deny Always end policies with an explicit reject:
Hierarchical Filtering Structure your policies in order of priority:
RPKI validation
Bogon ASN filtering
Bogon prefix filtering
Specific prefix matches
Default action
IPv4 and IPv6 Separation Keep IPv4 and IPv6 filters separate for clarity:
Documentation Use descriptive names and comments for filters and policies:
Example Complete Configuration
Here's a complete example combining all elements:
Verification Commands
To verify your filter and policy configuration:
Security Considerations
Always filter bogon routes and ASNs
Implement RPKI validation where possible
Set appropriate prefix length limits
Filter private and reserved address space
Implement route dampening for unstable prefixes
By properly implementing routing filters and policies, you can maintain a secure and stable routing environment while enforcing your network's routing policies.
Last updated