Skip to content

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.

AreaLevelNotes
Prefix listsSupportedIPv4 prefix matching with ge/le where implemented.
Route mapsSupportedOrdered permit/deny sequences with match/set actions.
AS-path ACLsSupportedCisco AS-path regular expressions in an ordered permit/deny list. First match wins; the list ends in an implicit deny.
Community listsPartialStandard 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 filtersSupportedUsed by BGP and OSPF-related import paths.
Policy-based routingSupportedA route-map applied to an interface sets next hop, default next hop or egress interface.
Unsupported match linesSupportedA match the model cannot express is reported, because it would widen the clause to every route.
StandardCoverageNotes
RFC 4271 policy attributesBehaviour modelLOCAL_PREF, MED, AS_PATH, NEXT_HOP, ORIGIN.
RFC 1997 communitiesSupportedStandard community representation and matching.
Cisco route-map semanticsBehaviour modelOrdered sequence evaluation.
FeatureStatusNotes
ip prefix-listSupportedPrefix filters.
IOS-XR route-policySupportedTranslated statement by statement with XR semantics. See IOS-XR route-policy.
continue [N]SupportedIOS, 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 clauseNo effectA matching deny has already ended evaluation. Reported.
route-map NAME permit/deny <seq>SupportedOrdered policy.
match ip address prefix-listSupportedPrefix-list match.
match as-pathSupportedNames an AS-path list. The whole list is evaluated against the route’s AS_PATH.
neighbor ... filter-list N in / outSupportedin 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 communitySupportedCommunity-list match.
match metric N [+- D]SupportedIOS, EOS and NX-OS. The MED, equal to N or within D of it.
match local-preference NPartialOne value. A list of values is not read.
match origin igp|egp|incompleteSupportedIOS, EOS and NX-OS.
set local-preferenceSupportedBGP attribute rewrite.
set metric NSupportedMED or protocol metric depending on context.
set metric +N / -NSupportedRelative to the route’s MED. It stops at 0.
set as-path prependSupportedOutbound BGP path prepending.
set as-path prepend last-as NSupportedRepeats the path’s first AS N more times.
set community A B C [additive]SupportedEvery value is kept. Without additive the list replaces the route’s communities.
set community noneSupportedStrips every community.
set comm-list NAME deleteSupportedStrips the communities the list names. EOS: set community community-list NAME delete.
EOS set community A deleteSupportedStrips the values named.
set weight NSupportedIn an inbound route-map: a weight per route. It overrides neighbor … weight, as on IOS. It is never advertised.
set extcommunity rtSupportedRoute targets for VRF import/export.
set ip next-hop ASupportedIn 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-addressSupportedInbound: the peer. Outbound: the router’s own address. self is read the same way.
set ip next-hop A BNot modelledSeveral next hops on one line are not read.
set origin igp|egp [AS]|incompleteSupportedThe AS after egp is accepted and dropped. IOS-XR set origin works too.
ipv6 prefix-listSupportedIPv6 prefix filters.
OSPF table-map NAME filterSupportedA route the map denies stays out of the routing table. The LSDB still holds it. Written back.
redistribute … route-map in a VRFPartialUnder a VRF’s BGP address family the route-map is stored and written back, not applied.
PBR discardSupportedPAN-OS policy-based forwarding can discard; both symbolic engines take it into account.
CommandIOS-styleJunos-styleVyOS-styleNotes
ip prefix-list PL permit 10.0.0.0/8 le 24SupportedPartialSupportedPrefix filter.
route-map RM permit 10SupportedPartialSupportedPolicy sequence. VyOS: set policy route-map RM rule 10 action|match|set.
ip as-path access-list 10 deny _65001_Supportedn/aNot modelledMatches routes that transited AS 65001.
ip as-path access-list 10 permit _65001_Supportedn/an/aUsed by match as-path 10 and filter-list 10.
ip as-path access-list 10 permit ^65001$Supportedn/an/aAnchored regex: routes originated by AS 65001 and learned from it.
ip as-path access-list 20 permit ^$Supportedn/an/aThe router’s own routes. With filter-list 20 out, only those are sent.
set policy-options policy-statement …n/aPartialn/aJunos terms become ordered clauses.
ip community-list standard C permit 65000:10SupportedPartialNot modelledCommunity 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:Supportedn/an/aEOS name for an expanded list.
show route-mapSupportedPartialPartialPolicy view.
show ip community-list [NAME]Supportedn/an/aStandard and expanded, numbered and named lists with their entries.

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.

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.

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.

XR route-policies are translated into the same route-map model, statement by statement, with XR’s semantics:

  • pass marks the route accepted and continues.
  • drop ends evaluation and rejects. done ends it and accepts.
  • Any action also marks the route accepted.
  • A route that reaches end-policy neither passed nor modified is dropped.
  • Nested if, elseif, else, and and, or, not with parentheses all translate.
  • apply NAME(args) is expanded in place, with $parameter substitution. The callee may be defined above or below. Recursion and unknown callees are reported.
  • A neighbour bound to route-policy NAME(220) in gets that instance.
FeatureStatusNotes
destination inSupportedA prefix-set, or an inline set with ge, le, eq.
community matches-any, matches-everySupportedA community-set or an inline set.
as-path inSupportedAn as-path-set, or inline ios-regex / dfa-regex.
as-path neighbor-is, originates-from, passes-through, is-localSupported
med, local-preference comparisonsSupportedeq, is, ge, le.
set local-preference, set med, set originSupported
set next-hop <address>Supported
prepend as-path N [count]Supported
set community (list) / set community SET [additive]Supported
delete community all, in, not inSupported
set weight, set next-hop self, set med +NNo effectReported by line. The rest of the policy applies.
tag, rd, community is-empty, as-path length, as-path unique-length, origin is, next-hop inNot modelledThe whole policy is reported unread, line by line.
if apply X, a condition split across lines, set community with a pattern setNot modelledThe 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.

Canonical example
configure terminal
ip prefix-list CUSTOMER permit 10.10.0.0/16 le 24
route-map CUSTOMER-IN permit 10
match ip address prefix-list CUSTOMER
set local-preference 200
router bgp 65000
neighbor 192.0.2.2 route-map CUSTOMER-IN in
end

Vendor styles

IOS-style
ip prefix-list CUSTOMER permit 10.10.0.0/16 le 24
route-map CUSTOMER-IN permit 10
match ip address prefix-list CUSTOMER
set local-preference 200
Junos-style
set policy-options prefix-list CUSTOMER 10.10.0.0/16
set policy-options policy-statement CUSTOMER-IN term 10 from prefix-list CUSTOMER
set policy-options policy-statement CUSTOMER-IN term 10 then local-preference 200
set policy-options policy-statement CUSTOMER-IN term 10 then accept
VyOS-style
set policy prefix-list CUSTOMER rule 10 action permit
set policy prefix-list CUSTOMER rule 10 prefix 10.10.0.0/16
set policy route-map CUSTOMER-IN rule 10 action permit
set policy route-map CUSTOMER-IN rule 10 set local-preference 200

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.