📄 rfc2280.txt
字号:
The second form of <peering> specification has the following syntax: <as-expression> [at <router-expression>] where <as-expression> is an expression over AS numbers and sets using operators AND, OR, and NOT, and <router-expression> is an expression over router IP addresses and DNS names using operators AND, OR, and NOT. The DNS name can only be used if there is an inet-rtr object for that name that binds the name to IP addresses. This form identifies all the peerings between any local router in <router-expression> toAlaettinoglu, et. al. Standards Track [Page 18]RFC 2280 RPSL January 1998 any of their peer routers in the ASes in <as-expression>. If <router-expression> is not specified, it defaults to all routers of the local AS. In the following example 9.9.9.1 imports 128.9.0.0/16 from 9.9.9.2 and 9.9.9.3. (4) as-set: AS-FOO members: AS2, AS3 aut-num: AS1 import: from AS-FOO at 9.9.9.1 accept { 128.9.0.0/16 } In the following example 9.9.9.1 imports 128.9.0.0/16 from 9.9.9.2 and 9.9.9.3, and 7.7.7.1 imports 128.9.0.0/16 from 7.7.7.2 and 7.7.7.3. (5) aut-num: AS1 import: from AS-FOO accept { 128.9.0.0/16 } In the following example AS1 imports 128.9.0.0/16 from AS3 at router 9.9.9.1 (6) aut-num: AS1 import: from AS-FOO and not AS2 at not 7.7.7.1 accept { 128.9.0.0/16 } This is because "AS-FOO and not AS2" equals AS3 and "not 7.7.7.1" equals 9.9.9.1.6.1.2 Action Specification Policy actions in RPSL either set or modify route attributes, such as assigning a preference to a route, adding a BGP community to the BGP community path attribute, or setting the MULTI-EXIT-DISCRIMINATOR attribute. Policy actions can also instruct routers to perform special operations, such as route flap damping. The routing policy attributes whose values can be modified in policy actions are specified in the RPSL dictionary. Please refer to Section 7 for a list of these attributes. Each action in RPSL is terminated by the character ';'. It is possible to form composite policy actions by listing them one after the other. In a composite policy action, the actions are executed left to right. For example,Alaettinoglu, et. al. Standards Track [Page 19]RFC 2280 RPSL January 1998aut-num: AS1import: from AS2 action pref = 10; med = 0; community.append(10250, {3561,10}); accept { 128.9.0.0/16 } sets pref to 10, med to 0, and then appends 10250 and {3561,10} to the community path attribute.6.1.3 Filter Specification A policy filter is a logical expression which when applied to a set of routes returns a subset of these routes. We say that the policy filter matches the subset returned. The policy filter can match routes using any path attribute, such as the destination address prefix (or NLRI), AS-path, or community attributes. The policy filters can be composite by using the operators AND, OR, and NOT. The following policy filters can be used to select a subset of routes: ANY The filter-keyword ANY matches all routes. Address-Prefix Set This is an explicit list of address prefixes enclosed in braces '{' and '}'. The policy filter matches the set of routes whose destination address-prefix is in the set. For example: { 0.0.0.0/0 } { 128.9.0.0/16, 128.8.0.0/16, 128.7.128.0/17, 5.0.0.0/8 } { } An address prefix can be optionally followed by a range operator (i.e. '^-', '^+', '^n', or '^n-m'). For example, the set { 5.0.0.0/8^+, 128.9.0.0/16^-, 30.0.0.0/8^16, 30.0.0.0/8^24-32 } contains all the more specifics of 5.0.0.0/8 including 5.0.0.0/8, all the more specifics of 128.9.0.0/16 excluding 128.9.0.0/16, all the more specifics of 30.0.0.0/8 which are of length 16 such as 30.9.0.0/16, and all the more specifics of 30.0.0.0/8 which are of length 24 to 32 such as 30.9.9.96/28. Route Set Name A route set name matches the set of routes that are members of the set. A route set name may be a name of a route-set object, an AS number, or a name of an as-set object (AS numbers and as-set names implicitly define route sets; please see Section 5.3). For example:Alaettinoglu, et. al. Standards Track [Page 20]RFC 2280 RPSL January 1998 aut-num: AS1 import: from AS2 action pref = 1; accept AS2 import: from AS2 action pref = 1; accept AS-FOO import: from AS2 action pref = 1; accept RS-FOO The keyword PeerAS can be used instead of the AS number of the peer AS. PeerAS is particularly useful when the peering is specified using an AS expression. For example: as-set: AS-FOO members: AS2, AS3 aut-num: AS1 import: from AS-FOO action pref = 1; accept PeerAS is same as: aut-num: AS1 import: from AS2 action pref = 1; accept AS2 import: from AS3 action pref = 1; accept AS3 A route set name can also be followed by one of the operators '^-', '^+', '^n' or '^n-m'. These operators are distributive over the route sets. For example, { 5.0.0.0/8, 6.0.0.0/8 }^+ equals { 5.0.0.0/8^+, 6.0.0.0/8^+ }, and AS1^- equals all the exclusive more specifics of routes originated by AS1. AS Path Regular Expressions An AS-path regular expression can be used as a policy filter by enclosing the expression in `<' and `>'. An AS-path policy filter matches the set of routes which traverses a sequence of ASes matched by the AS-path regular expression. A router can check this using the AS_PATH attribute in the Border Gateway Protocol [18], or the RD_PATH attribute in the Inter-Domain Routing Protocol[17]. AS-path Regular Expressions are POSIX compliant regular expressions over the alphabet of AS numbers. The regular expression constructs are as follows: ASN where ASN is an AS number. ASN matches the AS-path that is of length 1 and contains the corresponding AS number (e.g. AS-path regular expression AS1 matches the AS-path "1"). The keyword PeerAS can be used instead of the AS number of the peer AS.Alaettinoglu, et. al. Standards Track [Page 21]RFC 2280 RPSL January 1998 AS-set where AS-set is an AS set name. AS-set matches the AS-paths that is matched by one of the ASes in the AS-set. . matches the AS-paths matched by any AS number. [...] is an AS number set. It matches the AS-paths matched by the AS numbers listed between the brackets. The AS numbers in the set are separated by white space characters. If a `-' is used between two AS numbers in this set, all AS numbers between the two AS numbers are included in the set. If an as-set name is listed, all AS numbers in the as-set are included. [^...] is a complemented AS number set. It matches any AS-path which is not matched by the AS numbers in the set. ^ Matches the empty string at the beginning of an AS-path. $ Matches the empty string at the end of an AS-path. We next list the regular expression operators in the decreasing order of evaluation. These operators are left associative, i.e. performed left to right. Unary postfix operators * + ? {m} {m,n} {m,} For a regular expression A, A* matches zero or more occurrences of A; A+ matches one or more occurrences of A; A? matches zero or one occurrence of A; A{m} matches m occurrence of A; A{m,n} matches m to n occurrence of A; A{m,} matches m or more occurrence of A. For example, [AS1 AS2]{2} matches AS1 AS1, AS1 AS2, AS2 AS1, and AS2 AS2. Unary postfix operators ~* ~+ ~{m} ~{m,n} ~{m,} These operators have similar functionality as the corresponding operators listed above, but all occurrences of the regular expression has to match the same pattern. For example, [AS1 AS2]~{2} matches AS1 AS1 and AS2 AS2, but it does not match AS1 AS2 and AS2 AS1. Binary catenation operator This is an implicit operator and exists between two regular expressions A and B when no other explicit operator is specified. The resulting expression A B matches an AS-path if A matches some prefix of the AS- path and B matches the rest of the AS-path.Alaettinoglu, et. al. Standards Track [Page 22]RFC 2280 RPSL January 1998 Binary alternative (or) operator | For a regular expressions A and B, A | B matches any AS-path that is matched by A or B. Parenthesis can be used to override the default order of evaluation. White spaces can be used to increase readability. The following are examples of AS-path filters: <AS3> <^AS1> <AS2$> <^AS1 AS2 AS3$> <^AS1 .* AS2$>. The first example matches any route whose AS-path contains AS3, the second matches routes whose AS-path starts with AS1, the third matches routes whose AS-path ends with AS2, the fourth matches routes whose AS-path is exactly "1 2 3", and the fifth matches routes whose AS-path starts with AS1 and ends in AS2 with any number of AS numbers in between. Composite Policy Filters The following operators (in decreasing order of evaluation) can be used to form composite policy filters: NOT Given a policy filter x, NOT x matches the set of routes that are not matched by x. That is it is the negation of policy filter x. AND Given two policy filters x and y, x AND y matches the intersection of the routes that are matched by x and that are matched by y. OR Given two policy filters x and y, x OR y matches the union of the routes that are matched by x and that are matched by y. Note that an OR operator can be implicit, that is `x y' is equivalent to `x OR y'. E.g. NOT {128.9.0.0/16, 128.8.0.0/16} AS226 AS227 OR AS228 AS226 AND NOT {128.9.0.0/16} AS226 AND {0.0.0.0/0^0-18}Alaettinoglu, et. al. Standards Track [Page 23]RFC 2280 RPSL January 1998 The first example matches any route except 128.9.0.0/16 and 128.8.0.0/16. The second example matches the routes of AS226, AS227 and AS228. The third example matches the routes of AS226 except 128.9.0.0/16. The fourth example matches the routes of AS226 whose length are not longer than 18. Routing Policy Attributes Policy filters can also use the values of other attributes for comparison. The attributes whose values can be used in policy filters are specified in the RPSL dictionary. Please refer to Section 7 for details. An example using the the BGP community attribute is shown below: aut-num: AS1 export: to AS2 announce AS1 AND NOT community.contains(NO_EXPORT) Filters using the routing policy attributes defined in the dictionary are evaluated before evaluating the operators AND, OR and NOT.6.1.4 Example Policy Expressions aut-num: AS1 import: from AS2 action pref = 1; from AS3 action pref = 2; accept AS4 The above example states that AS4's routes are accepted from AS2 with preference 1, and from AS3 with preference 2 (routes with lower integer preference values are preferred over routes with higher integer preference values).
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -