Route Policy
Route policy is the shared control-plane filter and rewrite surface used by BGP, redistribution, and import analysis. It gives protocol docs one consistent way to describe filtering and attribute changes.
Support level
Section titled “Support level”| Area | Level | Notes |
|---|---|---|
| Prefix lists | Supported | IPv4 prefix matching with ge/le where implemented. |
| Route maps | Supported | Ordered permit/deny sequences with match/set actions. |
| AS-path ACLs | Supported | Cisco AS-path regular expressions in an ordered permit/deny list. First match wins; the list ends in an implicit deny. |
| Community lists | Partial | Standard lists match exact communities. An expanded list reads the forms that name an AS or a value (_65000:, 65000:*, *:100, XR ranges); any other regex is reported unrecognized. |
| Redistribution filters | Supported | Used by BGP and OSPF-related import paths. |
| Policy-based routing | Supported | A route-map applied to an interface sets next hop, default next hop or egress interface. |
| Unsupported match lines | Supported | A match the model cannot express is reported, because it would widen the clause to every route. |
Standards coverage
Section titled “Standards coverage”| Standard | Coverage | Notes |
|---|---|---|
| RFC 4271 policy attributes | Behaviour model | LOCAL_PREF, MED, AS_PATH, NEXT_HOP, ORIGIN. |
| RFC 1997 communities | Supported | Standard community representation and matching. |
| Cisco route-map semantics | Behaviour model | Ordered sequence evaluation. |
Feature matrix
Section titled “Feature matrix”| Feature | Status | Notes |
|---|---|---|
ip prefix-list | Supported | Prefix filters. |
IOS-XR route-policy | Supported | Translated statement by statement with XR semantics. See IOS-XR route-policy. |
continue [N] | Supported | IOS, EOS and NX-OS. A matching permit applies its sets, and evaluation goes on at clause N, or the next clause. Written back. |
continue on a deny clause | No effect | A matching deny has already ended evaluation. Reported. |
route-map NAME permit/deny <seq> | Supported | Ordered policy. |
match ip address prefix-list | Supported | Prefix-list match. |
match as-path | Supported | Names an AS-path list. The whole list is evaluated against the route’s AS_PATH. |
neighbor ... filter-list N in / out | Supported | in checks the received path. out checks the path before the router prepends its own AS, so permit ^$ sends only the router’s own routes. |
match community | Supported | Community-list match. |
match metric N [+- D] | Supported | IOS, EOS and NX-OS. The MED, equal to N or within D of it. |
match local-preference N | Partial | One value. A list of values is not read. |
match origin igp|egp|incomplete | Supported | IOS, EOS and NX-OS. |
set local-preference | Supported | BGP attribute rewrite. |
set metric N | Supported | MED or protocol metric depending on context. |
set metric +N / -N | Supported | Relative to the route’s MED. It stops at 0. |
set as-path prepend | Supported | Outbound BGP path prepending. |
set as-path prepend last-as N | Supported | Repeats the path’s first AS N more times. |
set community A B C [additive] | Supported | Every value is kept. Without additive the list replaces the route’s communities. |
set community none | Supported | Strips every community. |
set comm-list NAME delete | Supported | Strips the communities the list names. EOS: set community community-list NAME delete. |
EOS set community A delete | Supported | Strips the values named. |
set weight N | Supported | In an inbound route-map: a weight per route. It overrides neighbor … weight, as on IOS. It is never advertised. |
set extcommunity rt | Supported | Route targets for VRF import/export. |
set ip next-hop A | Supported | In policy-based routing: the next hop of the packet. In a BGP route-map: the route’s NEXT_HOP, inbound and outbound. See BGP next hop. |
set ip next-hop peer-address | Supported | Inbound: the peer. Outbound: the router’s own address. self is read the same way. |
set ip next-hop A B | Not modelled | Several next hops on one line are not read. |
set origin igp|egp [AS]|incomplete | Supported | The AS after egp is accepted and dropped. IOS-XR set origin works too. |
ipv6 prefix-list | Supported | IPv6 prefix filters. |
OSPF table-map NAME filter | Supported | A route the map denies stays out of the routing table. The LSDB still holds it. Written back. |
redistribute … route-map in a VRF | Partial | Under a VRF’s BGP address family the route-map is stored and written back, not applied. |
PBR discard | Supported | PAN-OS policy-based forwarding can discard; both symbolic engines take it into account. |
Vendor command matrix
Section titled “Vendor command matrix”| Command | IOS-style | Junos-style | VyOS-style | Notes |
|---|---|---|---|---|
ip prefix-list PL permit 10.0.0.0/8 le 24 | Supported | Partial | Supported | Prefix filter. |
route-map RM permit 10 | Supported | Partial | Supported | Policy sequence. VyOS: set policy route-map RM rule 10 action|match|set. |
ip as-path access-list 10 deny _65001_ | Supported | n/a | Not modelled | Matches routes that transited AS 65001. |
ip as-path access-list 10 permit _65001_ | Supported | n/a | n/a | Used by match as-path 10 and filter-list 10. |
ip as-path access-list 10 permit ^65001$ | Supported | n/a | n/a | Anchored regex: routes originated by AS 65001 and learned from it. |
ip as-path access-list 20 permit ^$ | Supported | n/a | n/a | The router’s own routes. With filter-list 20 out, only those are sent. |
set policy-options policy-statement … | n/a | Partial | n/a | Junos terms become ordered clauses. |
ip community-list standard C permit 65000:10 | Supported | Partial | Not modelled | Community match. NX-OS reads standard and expanded lists. EOS reads them with or without standard. Junos: from community C in a term. VyOS policy community-list is not read. |
ip community-list regexp C permit _65000: | Supported | n/a | n/a | EOS name for an expanded list. |
show route-map | Supported | Partial | Partial | Policy view. |
show ip community-list [NAME] | Supported | n/a | n/a | Standard and expanded, numbered and named lists with their entries. |
Behaviour notes
Section titled “Behaviour notes”Route maps are evaluated in sequence order. A route that does not match any permit sequence is rejected in policy contexts that require an explicit permit.
AS-path regexes match the path as text, as IOS does. Supported: literals, .,
[...] and [^...], ^, $, *, +, ?, | and ( ). _ matches the
start, the end, a space, or one of ,{}(). Confederation segments are written
in ( ), an AS_SET in { , }. The match is a search: an unanchored regex may
match anywhere in the path. An invalid regex is reported. Lists are written
back under their original names.
BGP next hop
Section titled “BGP next hop”set ip next-hop A in a route-map that BGP applies rewrites the route’s
NEXT_HOP. Inbound, the router forwards to A. Outbound, A is sent to the peer,
to an eBGP peer too: a third-party next hop. It holds over next-hop-self.
In a route-map applied to an interface it stays policy-based routing.
Running config
Section titled “Running config”show running-config writes all of these lines back. EOS gets its own
spelling: ip community-list NAME permit … without standard,
ip community-list regexp … for an expanded list, and
set community community-list NAME delete. NX-OS uses the IOS spelling.
match metric and match origin are written in IOS form for EOS too.
IOS-XR route-policy
Section titled “IOS-XR route-policy”XR route-policies are translated into the same route-map model, statement by statement, with XR’s semantics:
passmarks the route accepted and continues.dropends evaluation and rejects.doneends it and accepts.- Any action also marks the route accepted.
- A route that reaches
end-policyneither passed nor modified is dropped. - Nested
if,elseif,else, andand,or,notwith parentheses all translate. apply NAME(args)is expanded in place, with$parametersubstitution. The callee may be defined above or below. Recursion and unknown callees are reported.- A neighbour bound to
route-policy NAME(220) ingets that instance.
| Feature | Status | Notes |
|---|---|---|
destination in | Supported | A prefix-set, or an inline set with ge, le, eq. |
community matches-any, matches-every | Supported | A community-set or an inline set. |
as-path in | Supported | An as-path-set, or inline ios-regex / dfa-regex. |
as-path neighbor-is, originates-from, passes-through, is-local | Supported | |
med, local-preference comparisons | Supported | eq, is, ge, le. |
set local-preference, set med, set origin | Supported | |
set next-hop <address> | Supported | |
prepend as-path N [count] | Supported | |
set community (list) / set community SET [additive] | Supported | |
delete community all, in, not in | Supported | |
set weight, set next-hop self, set med +N | No effect | Reported by line. The rest of the policy applies. |
tag, rd, community is-empty, as-path length, as-path unique-length, origin is, next-hop in | Not modelled | The whole policy is reported unread, line by line. |
if apply X, a condition split across lines, set community with a pattern set | Not modelled | The whole policy is reported unread, line by line. |
A policy that cannot be represented is abandoned whole. Half a policy would change which routes exist.
show running-config writes policies back as nested if / elseif / else
RPL. A parameterised instance bound to a neighbour is written as NAME_ARG,
for example SET-LP_220.
Examples
Section titled “Examples”Canonical example
configure terminalip prefix-list CUSTOMER permit 10.10.0.0/16 le 24route-map CUSTOMER-IN permit 10 match ip address prefix-list CUSTOMER set local-preference 200router bgp 65000 neighbor 192.0.2.2 route-map CUSTOMER-IN inendVendor styles
IOS-style
ip prefix-list CUSTOMER permit 10.10.0.0/16 le 24route-map CUSTOMER-IN permit 10 match ip address prefix-list CUSTOMER set local-preference 200Junos-style
set policy-options prefix-list CUSTOMER 10.10.0.0/16set policy-options policy-statement CUSTOMER-IN term 10 from prefix-list CUSTOMERset policy-options policy-statement CUSTOMER-IN term 10 then local-preference 200set policy-options policy-statement CUSTOMER-IN term 10 then acceptVyOS-style
set policy prefix-list CUSTOMER rule 10 action permitset policy prefix-list CUSTOMER rule 10 prefix 10.10.0.0/16set policy route-map CUSTOMER-IN rule 10 action permitset policy route-map CUSTOMER-IN rule 10 set local-preference 200Known limits
Section titled “Known limits”Large communities are not modelled. match local-preference with a list of
values and set ip next-hop with several addresses are not read. Some IOS-XR RPL conditions are not modelled (see above). Junos policy-statement import is partial.
RPKI origin validation is covered on the BGP-4 page.