- Table of Contents
-
- 07-Layer 3 - IP Routing Command Reference
- 00-Preface
- 01-Basic IP Routing Commands
- 02-Static Routing Commands
- 03-RIP Commands
- 04-OSPF Commands
- 05-IS-IS Commands
- 06-BGP Commands
- 07-Policy-Based Routing Commands
- 08-Guard Route Commands
- 09-IPv6 Static Routing Commands
- 10-RIPng Commands
- 11-OSPFv3 Commands
- 12-IPv6 IS-IS Commands
- 13-IPv6 BGP Commands
- 14-IPv6 Policy-Based Routing Commands
- 15-Routing Policy Commands
- Related Documents
-
Title | Size | Download |
---|---|---|
15-Routing Policy Commands | 204.59 KB |
Contents
Routing policy configuration commands
Common routing policy configuration commands
IPv4 routing policy configuration commands
IPv6 routing policy configuration commands
|
NOTE: The common configuration commands of routing policy are applicable to both IPv4 and IPv6. |
Common routing policy configuration commands
apply as-path
Syntax
apply as-path as-number&<1-10> [ replace ]
undo apply as-path
View
Routing policy view
Default level
2: System level
Parameters
as-number: Autonomous system number, in the range of 1 to 4294967295.
&<1-10>: Indicates you can enter up to 10 AS numbers.
replace: Replaces the original AS numbers.
Description
Use the apply as-path command to apply the specified AS numbers to BGP routes.
Use the undo apply as-path command to remove the clause configuration.
No AS_PATH attribute is set by default.
With the replace keyword included, the apply as-path command replaces the original AS_PATH attribute with the specified AS numbers. Without the replace keyword, this command adds the specified AS numbers before the original AS_PATH attribute.
Examples
# Configure node 10 in permit mode of routing policy policy1: add AS number 200 before the original AS_PATH attribute of BGP routing information matching AS-PATH list 1.
<Sysname> system-view
[Sysname] route-policy policy1 permit node 10
[Sysname-route-policy] if-match as-path 1
[Sysname-route-policy] apply as-path 200
apply comm-list delete
Syntax
apply comm-list { comm-list-number | comm-list-name } delete
undo apply comm-list
View
Routing policy view
Default level
2: System level
Parameters
comm-list-number: Community list number. A basic community list number ranges from 1 to 99. An advanced community list number ranges from 100 to 199.
comm-list-name: Community list name, a string of 1 to 31 characters, which can contain letters, numbers, and signs.
Description
Use the apply comm-list delete command to remove the community attributes specified by the community list from BGP routing information.
Use the undo apply comm-list command to remove the clause configuration.
No community attributes are removed from BGP routing information by default.
Examples
# Configure node 10 in permit mode of routing policy policy1: remove the community attributes specified in community list 1 from the BGP routing information matching AS-PATH list 1.
<Sysname> system-view
[Sysname] route-policy policy1 permit node 10
[Sysname-route-policy] if-match as-path 1
[Sysname-route-policy] apply comm-list 1 delete
apply community
Syntax
apply community { none | additive | { community-number&<1-16> | aa:nn&<1-16> | internet | no-advertise | no-export | no-export-subconfed } * [ additive ] }
undo apply community
View
Routing policy view
Default level
2: System level
Parameters
none: Removes the community attributes of BGP routes.
community-number: Community sequence number, in the range of 1 to 4294967295.
aa:nn: Community number; both aa and nn are in the range of 0 to 65535.
&<1-16>: Indicates the argument before it can be entered up to 16 times.
internet: Sets the internet community attribute for BGP routes. Routes with this attribute can be advertised to all BGP peers.
no-advertise: Sets the no-advertise community attribute for BGP routes. Routes with this attribute cannot be advertised to any peers.
no-export: Sets the no-export community attribute for BGP routes. Routes with this attribute cannot be advertised out the autonomous system or confederation, but can be advertised to other sub ASs in the confederation.
no-export-subconfed: Sets the no-export-subconfed community attribute for BGP routes. Routes with this attribute cannot be advertised out the sub autonomous system.
additive: Adds the specified community attribute to the original community attribute of BGP routes.
Description
Use the apply community command to set the specified community attribute for BGP routes.
Use the undo apply community command to remove the apply clause.
No community attribute is set for BGP routes by default.
Related commands: ip community-list and if-match community.
Examples
# Configure node 16 in permit mode of routing policy setcommunity: Set the no-export community attribute for BGP routes matching AS-PATH list 8.
<Sysname> system-view
[Sysname] route-policy setcommunity permit node 16
[Sysname-route-policy] if-match as-path 8
[Sysname-route-policy] apply community no-export
apply cost
Syntax
apply cost [ + | - ] value
undo apply cost
View
Routing policy view
Default level
2: System level
Parameters
+: Increases a cost value.
-: Decreases a cost value.
value: Cost in the range of 0 to 4294967295.
Description
Use the apply cost command to set a cost for routing information.
Use the undo apply cost command to remove the clause configuration.
No cost is set for routing information by default.
Examples
# Configure node 10 in permit mode of routing policy policy1: set a cost of 120 for routing information whose outgoing interface is VLAN-interface 11.
<Sysname> system-view
[Sysname] route-policy policy1 permit node 10
[Sysname-route-policy] if-match interface Vlan-interface 11
[Sysname-route-policy] apply cost 120
apply cost-type
Syntax
apply cost-type { external | internal | type-1 | type-2 }
undo apply cost-type
View
Routing policy view
Default level
2: System level
Parameters
external: Sets the cost type to IS-IS external route.
internal: Sets the cost type to IS-IS internal route, or sets the MED value for a matching BGP route as the IGP metric to the route’s next hop.
type-1: Sets the cost type to Type-1 external route of OSPF.
type-2: Sets the cost type to Type-2 external route of OSPF.
Description
Use the apply cost-type command to set a cost type for routing information.
Use the undo apply cost-type command to remove the clause configuration.
No cost type is set for routing information by default.
Used for IS-IS, the apply cost-type internal command sets the cost type of a matching IS-IS route as IS-IS internal route.
Use for BGP, the apply cost-type internal command sets the MED of a matching BGP route learned from an IBGP peer as the IGP metric to the route’s next hop before BGP advertises the route to an EBGP peer.
Examples
# Create node 10 in permit mode of routing policy policy1: If a route has a tag of 8, set the cost type for the route to IS-IS internal route.
<Sysname> system-view
[Sysname] route-policy policy1 permit node 10
[Sysname-route-policy] if-match tag 8
[Sysname-route-policy] apply cost-type internal
apply extcommunity
Syntax
apply extcommunity { { rt route-target }&<1-16> [ additive ] | soo site-of-origin additive }
undo apply extcommunity
View
Routing policy view
Default level
2: System level
Parameters
rt route-target: Sets the route target extended community attribute, which is a string of 3 to 21 characters.
soo site-of-origin: Sets the Site of Origin (SOO) extended community attribute, which is a string of 3 to 21 characters.
A route-target or site-of-origin has one of the following three forms:
· 16-bit AS number: 32-bit self-defined number, for example, 101:3.
· 32-bit IP address: 16-bit self-defined number, for example, 192.168.122.15:1.
· 32-bit AS number: 16-bit self-defined number, for example, 70000:3. The AS number should be no less than 65536.
&<1-16>: Indicates the argument before it can be entered up to 16 times.
additive: Adds the specified attribute to the original RT community attribute.
Description
Use the apply extcommunity command to apply the specified RT extended community attribute to BGP routes.
Use the undo apply extcommunity command to remove the clause configuration.
No RT extended community attribute is set for BGP routing information by default.
Examples
# Configure node 10 in permit mode of routing policy policy1: If a BGP route matches AS-PATH list 1, add the RT extended community attribute 100:2 to the route.
<Sysname> system-view
[Sysname] route-policy policy1 permit node 10
[Sysname-route-policy] if-match as-path 1
[Sysname-route-policy] apply extcommunity rt 100:2 additive
# Configure node 10 in permit mode of routing policy policy2: If a BGP route matches AS-PATH list 2, add the SOO extended community attribute 100:3 to the route.
<Sysname> system-view
[Sysname] route-policy policy2 permit node 10
[Sysname-route-policy] if-match as-path 2
[Sysname-route-policy] apply extcommunity soo 100:3 additive
apply isis
Syntax
apply isis { level-1 | level-1-2 | level-2 }
undo apply isis
View
Routing policy view
Default level
2: System level
Parameters
level-1: Redistributes routes into IS-IS level-1.
level-1-2: Redistributes routes into both IS-IS level-1 and level-2.
level-2: Redistributes routes into IS-IS level-2.
Description
Use the apply isis command to redistribute routes into a specified ISIS level.
Use the undo apply isis command to remove the clause configuration.
No IS-IS level is set by default.
Examples
# Configure node 10 in permit mode of routing policy policy1: If a route has a tag of 8, redistribute the route to IS-IS level-2.
<Sysname> system-view
[Sysname] route-policy policy1 permit node 10
[Sysname-route-policy] if-match tag 8
[Sysname-route-policy] apply isis level-2
apply local-preference
Syntax
apply local-preference preference
undo apply local-preference
View
Routing policy view
Default level
2: System level
Parameters
preference: BGP local preference, in the range of 0 to 4294967295.
Description
Use the apply local-preference command to set the specified local preference for BGP routes.
Use the undo apply local-preference command to remove the clause configuration.
No local preference is set for BGP routing information by default.
Examples
# Configure node 10 in permit mode of routing policy policy1: If a route matches AS-PATH list 1, set a local preference of 130 for the route.
<Sysname> system-view
[Sysname] route-policy policy1 permit node 10
[Sysname-route-policy] if-match as-path 1
[Sysname-route-policy] apply local-preference 130
apply mpls-label
Syntax
apply mpls-label
undo apply mpls-label
View
Routing policy view
Default level
2: System level
Parameters
None
Description
Use the apply mpls-label command to set MPLS labels for routing information.
Use the undo apply mpls-label command to remove the clause configuration.
No MPLS label is set for routing information by default.
If MPLS labels failed to apply, the routing information cannot be advertised.
Examples
# Configure node 10 in permit mode of routing policy policy1: If routing information matches AS-PATH list 1, set MPLS labels for it.
<Sysname> system-view
[Sysname] route-policy policy1 permit node 10
[Sysname-route-policy] if-match as-path 1
[Sysname-route-policy] apply mpls-label
apply origin
Syntax
apply origin { egp as-number | igp | incomplete }
undo apply origin
View
Routing policy view
Default level
2: System level
Parameters
egp: Sets the origin attribute of BGP routing information to EGP.
as-number: Autonomous system number for EGP routes, in the range of 1 to 4294967295.
igp: Sets the origin attribute of BGP routing information to IGP.
incomplete: Sets the origin attribute of BGP routing information to unknown.
Description
Use the apply origin command to set the specified origin attribute for BGP routes.
Use the undo apply origin command to remove the clause configuration.
No origin attribute is set for BGP routing information by default.
Examples
# Configure node 10 in permit mode of routing policy policy1: If BGP routing information matches AS-PATH list 1, set the origin attribute of the routing information to IGP.
<Sysname> system-view
[Sysname] route-policy policy1 permit node 10
[Sysname-route-policy] if-match as-path 1
[Sysname-route-policy] apply origin igp
apply preference
Syntax
apply preference preference
undo apply preference
View
Routing policy view
Default level
2: System level
Parameters
preference: Routing protocol preference, in the range of 1 to 255.
Description
Use the apply preference command to set a preference for a routing protocol.
Use the undo apply preference command to remove the clause configuration.
No preference is set for a routing protocol by default.
If you have set preferences for routing protocols with the preference command, using the apply preference command will set a new preference for the matching routing protocol. Non-matching routing protocols still use the preferences set by the preference command.
Examples
# Configure node 10 in permit mode of routing policy policy1: Set the preference for OSPF external routes to 90.
<Sysname> system-view
[Sysname] route-policy policy1 permit node 10
[Sysname-route-policy] if-match route-type external-type1or2
[Sysname-route-policy] apply preference 90
apply preferred-value
Syntax
apply preferred-value preferred-value
undo apply preferred-value
View
Routing policy view
Default level
2: System level
Parameters
preferred-value: Preferred value, in the range of 0 to 65535.
Description
Use the apply preferred-value command to set a preferred value for BGP routes.
Use the undo apply preferred-value command to remove the clause configuration.
No preferred value is set for BGP routes by default.
Examples
# Configure node 10 in permit mode of routing policy policy1: Set a preferred value of 66 for BGP routing information matching AS-PATH list 1.
<Sysname> system-view
[Sysname] route-policy policy1 permit node 10
[Sysname-route-policy] if-match as-path 1
[Sysname-route-policy] apply preferred-value 66
apply tag
Syntax
apply tag value
undo apply tag
View
Routing policy view
Default level
2: System level
Parameters
value: Tag value, in the range of 0 to 4294967295.
Description
Use the apply tag command to set a specified tag value for RIP, OSPF or IS-IS routing information.
Use the undo apply tag command to remove the clause configuration.
No routing tag is set for RIP, OSPF or IS-IS routing information by default.
Examples
# Configure node 10 in permit mode of routing policy policy1: set a tag of 100 for OSPF external routes.
<Sysname> system-view
[Sysname] route-policy policy1 permit node 10
[Sysname-route-policy] if-match route-type external-type1
[Sysname-route-policy] apply tag 100
continue
Syntax
continue [ node-number ]
undo continue
View
Routing policy view
Default level
2: System level
Parameters
node-number: Policy node number, in the range of 0 to 65535.
Description
Use the continue command to specify the next node of the routing policy to be matched.
Use the undo continue command to remove the configuration.
By default, no next policy node is specified.
The node number specified must be larger that the current node number.
Example
# Create routing policy policy1 with node 10, and specify the match mode as permit. Specify the number of the next policy node to be matched as 20.
<Sysname> system-view
[Sysname] route-policy policy1 permit node 10
[Sysname-route-policy] continue 20
display ip as-path
Syntax
display ip as-path [ as-path-number ] [ | { begin | exclude | include } regular-expression ]
View
Any view
Default level
1: Monitor level
Parameters
as-path-number: AS-PATH list number, in the range of 1 to 256.
|: Filters command output by specifying a regular expression. For more information about regular expressions, see Fundamentals Configuration Guide.
begin: Displays the first line that matches the specified regular expression and all lines that follow.
exclude: Displays all lines that do not match the specified regular expression.
include: Displays all lines that match the specified regular expression.
regular-expression: Specifies a regular expression, a case-sensitive string of 1 to 256 characters.
Description
Use the display ip as-path command to display BGP AS-PATH list information.
Information about all BGP AS-PATH lists will be displayed if no as-path-number is specified.
Related commands: ip as-path, if-match as-path, and apply as-path.
Examples
# Display the information of BGP AS-PATH list 1.
<Sysname> display ip as-path 1
ListID Mode Expression
1 permit 2
Table 1 Output description
Field |
Description |
ListID |
AS-PATH list ID |
Mode |
Match mode—permit, deny |
Expression |
Regular expression |
display ip community-list
Syntax
display ip community-list [ basic-community-list-number | adv-community-list-number | comm-list-name ] [ | { begin | exclude | include } regular-expression ]
View
Any view
Default level
1: Monitor level
Parameters
basic-community-list-number: Basic community list number, in the range of 1 to 99.
adv-community-list-number: Advanced community list number, in the range of 100 to 199.
comm-list-name: Community list name, a string of 1 to 31 characters, which can contain letters, numbers, and signs.
|: Filters command output by specifying a regular expression. For more information about regular expressions, see Fundamentals Configuration Guide.
begin: Displays the first line that matches the specified regular expression and all lines that follow.
exclude: Displays all lines that do not match the specified regular expression.
include: Displays all lines that match the specified regular expression.
regular-expression: Specifies a regular expression, a case-sensitive string of 1 to 256 characters.
Description
Use the display ip community-list command to display BGP community list information.
All BGP community list information will be displayed if no basic-community-list-number or adv-community-list-number is specified.
Related commands: ip community-list, if-match community, and apply community.
Examples
# Display the information of the BGP community list 1.
<Sysname> display ip community-list 1
Community List Number 1
permit 1:1 1:2 2:2
display ip extcommunity-list
Syntax
display ip extcommunity-list [ ext-comm-list-number ] [ | { begin | exclude | include } regular-expression ]
View
Any view
Default level
1: Monitor level
Parameters
ext-comm-list-number: Extended community list number, in the range of 1 to 199.
|: Filters command output by specifying a regular expression. For more information about regular expressions, see Fundamentals Configuration Guide.
begin: Displays the first line that matches the specified regular expression and all lines that follow.
exclude: Displays all lines that do not match the specified regular expression.
include: Displays all lines that match the specified regular expression.
regular-expression: Specifies a regular expression, a case-sensitive string of 1 to 256 characters.
Description
Use the display ip extcommunity-list command to display BGP extended community list information.
All BGP extended community list information will be displayed if no ext-comm-list-number is specified.
Related commands: ip extcommunity-list, if-match extcommunity, and apply extcommunity.
Examples
# Display the information of BGP extended community list 1.
<Sysname> display ip extcommunity-list 1
Extended Community List Number 1
permit rt : 9:6
display route-policy
Syntax
display route-policy [ route-policy-name ] [ | { begin | exclude | include } regular-expression ]
View
Default level
1: Monitor level
Parameters
route-policy-name: Routing policy name, a case-sensitive string of 1 to 63 characters.
|: Filters command output by specifying a regular expression. For more information about regular expressions, see Fundamentals Configuration Guide.
begin: Displays the first line that matches the specified regular expression and all lines that follow.
exclude: Displays all lines that do not match the specified regular expression.
include: Displays all lines that match the specified regular expression.
regular-expression: Specifies a regular expression, a case-sensitive string of 1 to 256 characters.
Description
Use the display route-policy command to display routing policy information.
All routing policy information will be displayed if no route-policy-name is specified.
Related commands: route-policy.
Examples
# Display the information of routing policy 1.
<Sysname> display route-policy policy1
Route-policy : policy1
permit : 10
if-match ip-prefix abc
apply cost 120
Field |
Description |
Route-policy |
Routing policy name. |
Permit |
Match mode of routing policy node 10. |
if-match ip-prefix abc |
Match criterion. |
apply cost 120 |
If the match criterion is satisfied, set a cost of 120 for routing information. |
if-match as-path
Syntax
if-match as-path as-path-number&<1-16>
undo if-match as-path [ as-path-number&<1-16> ]
View
Routing policy view
Default level
2: System level
Parameters
as-path-number: AS path list number, in the range of 1 to 256.
&<1-16>: Indicates the argument before it can be entered up to 16 times.
Description
Use the if-match as-path command to specify AS-PATH list(s) for matching against the AS path attribute of BGP routing information.
Use the undo if-match as-path command to remove the match criterion.
The match criterion is not configured by default.
Related commands: ip as-path-acl.
Examples
# Define AS-PATH list 2, allowing BGP routing information containing AS number 200 or 300 to pass. Configure node 10 in permit mode of routing policy test: specify AS-PATH list 2 for matching.
<Sysname> system-view
[Sysname] ip as-path 2 permit _*200.*300
[Sysname] route-policy test permit node 10
[Sysname-route-policy] if-match as-path 2
if-match community
Syntax
if-match community { { basic-community-list-number | comm-list-name } [ whole-match ] | adv-community-list-number }&<1-16>
undo if-match community [ { basic-community-list-number | comm-list-name } [ whole-match ] | adv-community-list-number ]&<1-16>
View
Routing policy view
Default level
2: System level
Parameters
basic-community-list-number: Basic community list number, in the range of 1 to 99.
adv-community-list-number: Advanced community list number, in the range of 100 to 199.
comm-list-name: Community list name, a string of 1 to 31 characters, which can contain letters, numbers, and signs.
whole-match: Exactly matches the specified community list(s).
&<1-16>: Indicates the argument before it can be entered up to 16 times.
Description
Use the if-match community command to specify community list(s) for matching against the community attribute of BGP routing information.
Use the undo if-match community command to remove the match criterion.
The match criterion is not configured by default.
Related commands: ip community-list.
Examples
# Define community list 1, allowing BGP routing information with community number 100 or 200 to pass. Then configure node 10 in permit mode of routing policy test: specify community-list 1 for matching.
[Sysname] ip community-list 1 permit 100 200
[Sysname] route-policy test permit node 10
[Sysname-route-policy] if-match community 1
if-match cost
Syntax
if-match cost value
undo if-match cost
View
Routing policy view
Default level
2: System level
Parameters
value: Cost in the range of 0 to 4294967295.
Description
Use the if-match cost command to match routing information having the specified cost.
Use the undo if-match cost command to remove the match criterion.
The match criterion is not configured by default.
Examples
# Configure node 10 in permit mode of routing policy policy1: define an if-match clause to permit routing information with a cost of 8.
<Sysname> system-view
[Sysname] route-policy policy1 permit node 10
[Sysname-route-policy] if-match cost 8
if-match extcommunity
Syntax
if-match extcommunity ext-comm-list-number&<1-16>
undo if-match extcommunity [ ext-comm-list-number&<1-16> ]
View
Routing policy view
Default level
2: System level
Parameters
ext-comm-list-number: Extended community list number, in the range of 1 to 199.
&<1-16>: Indicates the argument before it can be entered up to 16 times.
Description
Use the if-match extcommunity command to specify extended community list(s) for matching against the extended community attribute of BGP routing information.
Use the undo if-match extcommunity command to remove the match criterion.
The match criterion is not configured by default.
Examples
# Configure node 10 in permit mode of routing policy policy1 to match BGP routing information against extended community lists 100 and 150.
<Sysname> system-view
[Sysname] route-policy policy1 permit node 10
[Sysname-route-policy] if-match extcommunity 100 150
if-match interface
Syntax
if-match interface { interface-type interface-number }&<1-16>
undo if-match interface [ interface-type interface-number ]&<1-16>
View
Routing policy view
Default level
2: System level
Parameters
interface-type: Interface type
interface-number: Interface number
&<1-16>: Indicates the argument before it can be entered up to 16 times.
Description
Use the if-match interface command to specify interface(s) for matching against the outgoing interface of routing information.
Use the undo if-match interface command to remove the match criterion.
The match criterion is not configured by default.
BGP does not support criteria for matching against the outgoing interface of routing information.
Examples
# Configure node 10 in permit mode of routing policy policy1 to permit routing information with the outgoing interface as VLAN-interface 1.
[Sysname] route-policy policy1 permit node 10
[Sysname-route-policy] if-match interface vlan-interface 1
if-match mpls-label
Syntax
if-match mpls-label
undo if-match mpls-label
View
Routing policy view
Default level
2: System level
Parameters
None
Description
Use the if-match mpls-label command to specify the MPLS label match criterion.
Use the undo if-match mpls-label command to remove the match criterion.
The match criterion is not configured by default.
Examples
# Configure node 10 in permit mode of routing policy policy1 to match the MPLS labels of routing updates.
<Sysname> system-view
[Sysname] route-policy policy1 permit node 10
[Sysname-route-policy] if-match mpls-label
if-match route-type
Syntax
if-match route-type { external-type1 | external-type1or2 | external-type2 | internal | is-is-level-1 | is-is-level-2 | nssa-external-type1 | nssa-external-type1or2 | nssa-external-type2 } *
undo if-match route-type [ external-type1 | external-type1or2 | external-type2 | internal | is-is-level-1 | is-is-level-2 | nssa-external-type1 | nssa-external-type1or2 | nssa-external-type2 ] *
View
Routing policy view
Default level
2: System level
Parameters
external-type1: OSPF Type 1 external routes.
external-type1or2: OSPF Type 1 or 2 external routes.
external-type2: OSPF Type 2 external routes.
internal: Internal routes (OSPF intra-area and inter-area routes).
is-is-level-1: IS-IS Level-1 routes.
is-is-level-2: IS-IS Level-2 routes.
nssa-external-type1: OSPF NSSA Type 1 external routes.
nssa-external-type1or2: OSPF NSSA Type 1 or 2 external routes.
nssa-external-type2: OSPF NSSA Type 2 external routes.
Description
Use the if-match route-type command to configure a route type match criterion.
Use the undo if-match route-type command to remove the match criterion.
The match criterion is not configured by default.
Examples
# Configure node 10 in permit mode of routing policy policy1 to match OSPF internal routes.
<Sysname> system-view
[Sysname] route-policy policy1 permit node 10
[Sysname-route-policy] if-match route-type internal
if-match tag
Syntax
if-match tag value
undo if-match tag
View
Routing policy view
Default level
2: System level
Parameters
value: Specifies a tag from 0 to 4294967295.
Description
Use the if-match tag command to match routing information having the specified tag.
Use the undo if-match tag command to remove the match criterion.
The match criterion is not configured by default.
Examples
# Configure node 10 in permit mode of routing policy policy1 to permit RIP, OSPF and IS-IS routing information with a tag of 8.
<Sysname> system-view
[Sysname] route-policy policy1 permit node 10
[Sysname-route-policy] if-match tag 8
ip as-path
Syntax
ip as-path as-path-number { deny | permit } regular-expression
undo ip as-path as-path-number
View
System view
Default level
2: System level
Parameters
as-path-number: AS-PATH list number, in the range of 1 to 256.
deny: Specifies the match mode for the AS-PATH list as deny.
permit: Specifies the match mode for the AS-PATH list as permit.
regular-expression: AS-PATH regular expression, a string of 1 to 50 characters.
BGP routing updates contain the AS path attribute field that identifies the autonomous systems through which the routing information has passed. An AS-PATH regular expression, for example, ^200. *100$, matches the AS path attribute that starts with AS200 and ends with AS100. For the meanings of special characters used in regular expressions, see Fundamentals Configuration Guide.
Description
Use the ip as-path command to create an AS-PATH list.
Use the undo ip as-path command to remove an AS-PATH list.
No AS-PATH list is created by default.
Examples
# Configure AS-PATH list 1 to permit routing information whose AS_PATH attribute starts with 10.
<Sysname> system-view
[Sysname] ip as-path 1 permit ^10
ip community-list
Syntax
ip community-list { basic-comm-list-num | basic comm-list-name } { deny | permit } [ community-number-list ] [ internet | no-advertise | no-export | no-export-subconfed ] *
undo ip community-list { basic-comm-list-num | basic comm-list-name } [ deny | permit ] [ community-number-list ] [ internet | no-advertise | no-export | no-export-subconfed ] *
ip community-list { adv-comm-list-num | advanced comm-list-name } { deny | permit } regular-expression
undo ip community-list { adv-comm-list-num | advanced comm-list-name } [ deny | permit ] [ regular-expression ]
View
System view
Default level
2: System level
Parameters
basic-comm-list-num: Basic community list number, in the range of 1 to 99.
basic: Specifies a basic communist list name.
advanced: Specifies an advanced communist list name.
comm-list-name: Community list name, a string of 1 to 31 characters, which can contain letters, numbers, and signs.
adv-comm-list-num: Advanced community list number, in the range of 100 to 199.
regular-expression: Regular expression of advanced community attribute, a string of 1 to 50 characters. For more information about regular expressions, see Fundamentals Configuration Guide
deny: Specifies the match mode for the community list as deny.
permit: Specifies the match mode for the community list as permit.
community-number-list: Community number list, which is in the community number or aa:nn format; a community number is in the range of 1 to 4294967295; aa and nn are in the range of 0 to 65535. Up to 16 community numbers can be entered.
internet: Routes with this attribute can be advertised to all BGP peers. By default, all routes have this attribute.
no-advertise: Routes with this attribute cannot be advertised to other BGP peers.
no-export: Routes with this attribute cannot be advertised out the local AS, or the confederation but can be advertised to other ASs in the confederation.
no-export-subconfed: Routes with this attribute cannot be advertised out the local AS, or to other sub ASs in the confederation.
Description
Use the ip community-list to define a community list entry.
Use the undo ip community-list command to remove a community list or entry.
No community list is defined by default.
Examples
# Define basic community list 1 to permit routing information with the internet community attribute.
<Sysname> system-view
[Sysname] ip community-list 1 permit internet
# Define advanced community list 100 to permit routing information with the community attribute starting with 10.
<Sysname> system-view
[Sysname] ip community-list 100 permit ^10
ip extcommunity-list
Syntax
ip extcommunity-list ext-comm-list-number { deny | permit } { rt route-target | soo site-of-origin }&<1-16>
undo ip extcommunity-list ext-comm-list-number
View
System view
Default level
2: System level
Parameters
ext-comm-list-number: Extended community list number, in the range of 1 to 199.
deny: Specifies the match mode for the extended community list as deny.
permit: Specifies the match mode for the extended community list as permit.
rt route-target: Specifies the route target extended community attribute, which is a string of 3 to 21 characters.
soo site-of-origin: Sets the SOO extended community attribute, which is a string of 3 to 21 characters.
A route-target or site-of-origin has three forms:
· A 16-bit AS number: a 32-bit self-defined number, for example, 101:3;
· A 32-bit IP address: a 16-bit self-defined number, for example, 192.168.122.15:1.
· A 32-bit AS number: 16-bit self-defined number, for example, 70000:3. The AS number must be no less than 65536.
&<1-16>: Indicates the argument before it can be entered up to 16 times.
Description
Use the ip extcommunity-list to define an extended community list entry.
Use the undo ip extcommunity-list command to remove an extended community list.
No extended community list is defined by default.
Examples
# Define extended community list 1 to permit routing information with RT 200:200.
<Sysname> system-view
[Sysname] ip extcommunity-list 1 permit rt 200:200
# Define extended community list 2 to permit routing information with SOO 100:100.
<Sysname> system-view
[Sysname] ip extcommunity-list 2 permit soo 100:100
route-policy
Syntax
route-policy route-policy-name { deny | permit } node node-number
undo route-policy route-policy-name [ deny | permit ] [ node node-number ]
View
System view
Default level
2: System level
Parameters
route-policy-name: Routing policy name, a case-sensitive string of 1 to 63 characters.
deny: Specifies the match mode of the routing policy node as deny. If a route satisfies all the if-match clauses of the node, it cannot pass the node and will not go to the next node.
permit: Specifies the match mode of the routing policy node as permit. If a route satisfies all the if-match clauses of the node, it passes the node and then is executed with the apply clauses of the node. If not, it goes to the next node of the routing policy.
node node-number: Node number, in the range of 0 to 65535. A node with a smaller number is matched first.
Description
Use the route-policy command to create a routing policy and a node of it and enter routing policy view.
Use the undo route-policy command to remove a routing policy or a node of it.
No routing policy is created by default.
A routing policy is used for routing information filtering. It contains several nodes and each node comprises a set of if-match and apply clauses. The if-match clauses define the matching criteria of the node and the apply clauses define the actions to be taken on packets passing the node. The relation between the if-match clauses of a node is logic AND, namely, all the if-match clauses must be satisfied. The relation between different routing policy nodes is logic OR, namely, a packet passing a node passes the routing policy.
Examples
# Configure node 10 in permit mode of routing policy policy1 and enter routing policy view.
<Sysname> system-view
[Sysname] route-policy policy1 permit node 10
[Sysname-route-policy]
IPv4 routing policy configuration commands
apply fast-reroute
Syntax
apply fast-reroute { backup-interface interface-type interface-number [ backup-nexthop ip-address ] | backup-nexthop ip-address }
undo apply fast-reroute
View
Routing policy view
Default level
2: System level
Parameters
backup-interface interface-type interface-number: Specifies a backup outgoing interface by its type and number. If the specified backup outgoing interface is a non-P2P interface (such as VLAN interface), you need to specify a backup next hop at the same time.
backup-nexthop ip-address: Specifies the backup next hop address.
Description
Use the apply fast-reroute command to configure FRR.
Use the undo apply fast-reroute command to remove the configuration.
By default, FRR is not configured.
When a link or a router in the network fails, the packets on the path may be discarded, or a routing loop may occur. Then, the traffic will be interrupted until the routing protocol completes routing convergence based on the new network topology.
With FRR, a routing protocol can designate a backup next hop by using the referenced routing policy when a network failure is detected, and packets are directed to the backup next hop for forwarding, thus to reduce traffic recovery time greatly.
This command allows you to specify a backup next hop in a routing policy for routes matching specified criteria.
Examples
# Create a routing policy named policy1, and specify backup outgoing interface VLAN-interface 1 and backup next hop 193.1.1.8 in the routing policy for packets destined to 100.1.1.0/24.
<Sysname> system-view
[Sysname] ip ip-prefix abc index 10 permit 100.1.1.0 24
[Sysname] route-policy policy1 permit node 10
[Sysname-route-policy] if-match ip-prefix abc
[Sysname-route-policy] apply fast-reroute backup-interface vlan-interface 1 backup-nexthop 193.1.1.8
apply ip-address next-hop
Syntax
apply ip-address next-hop ip-address [ vpn-instance vpn-instance-name | public ]
undo apply ip-address next-hop
View
Routing policy view
Default level
2: System level
Parameters
ip-address: Specifies the IP address of the next hop.
vpn-instance-name: Specifies the VPN instance of the next hop.
public: Specifies that the next hop is on the public network.
Description
Use the apply ip-address next-hop command to set a next hop for IPv4 routes and specify the VPN instance of the next hop.
Use the undo apply ip-address next-hop command to remove the clause configuration.
By default, no next hop is set for IPv4 routes.
If you set the next hop without specifying the [ vpn-instance vpn-instance-name | public ] option, the VPN instance of the route to be processed by this clause applies to the next hop.
This command cannot set a next hop and its VPN instance for redistributed routes.
Examples
# Configure node 10 in permit mode of routing policy policy1 to set next hop 193.1.1.8 for routes matching AS-PATH list 1 and specify the VPN instance of the next hop.
<Sysname> system-view
[Sysname] route-policy policy1 permit node 10
[Sysname-route-policy] if-match as-path 1
[Sysname-route-policy] apply ip-address next-hop 193.1.1.8 vpn-instance vpn1
display ip ip-prefix
Syntax
display ip ip-prefix [ ip-prefix-name ] [ | { begin | exclude | include } regular-expression ]
View
Any view
Default level
1: Monitor level
Parameters
ip-prefix-name: IP prefix list name, a string of 1 to 19 characters.
|: Filters command output by specifying a regular expression. For more information about regular expressions, see Fundamentals Configuration Guide.
begin: Displays the first line that matches the specified regular expression and all lines that follow.
exclude: Displays all lines that do not match the specified regular expression.
include: Displays all lines that match the specified regular expression.
regular-expression: Specifies a regular expression, a case-sensitive string of 1 to 256 characters.
Description
Use the display ip ip-prefix command to display the statistics of an IPv4 prefix list. If no ip-prefix-name is specified, statistics for all IPv4 prefix lists will be displayed.
Related commands: ip ip-prefix.
Examples
# Display the statistics of IPv4 prefix list abc.
<Sysname> display ip ip-prefix abc
Prefix-list abc
Permitted 0
Denied 0
index: 10 permit 1.0.0.0/11 ge 22 le 32
Table 3 Output description.
Field |
Description |
Prefix-list |
Name of the IPv4 prefix list |
Permitted |
Number of routes satisfying the match criterion |
Denied |
Number of routes not satisfying the match criterion |
index |
Index of the IPv4 prefix list |
permit |
Match mode: permit or deny |
1.0.0.0/11 |
IP address and mask |
ge |
greater-equal, the lower limit |
le |
less-equal, the higher limit |
if-match acl
Syntax
if-match acl acl-number
undo if-match acl
View
Routing policy view
Default level
2: System level
Parameters
acl-number: ACL number from 2000 to 3999.
Description
Use the if-match acl command to configure an ACL match criterion.
Use the undo if-match acl command to remove the match criterion.
No ACL match criterion is configured by default.
Examples
# Configure node 10 of routing policy policy1 to permit routes matching ACL 2000.
<Sysname> system-view
[Sysname] route-policy policy1 permit node 10
[Sysname-route-policy] if-match acl 2000
if-match ip
Syntax
if-match ip { next-hop | route-source } { acl acl-number | ip-prefix ip-prefix-name }
undo if-match ip { next-hop | route-source } [ acl | ip-prefix ]
View
Routing policy view
Default level
2: System level
Parameters
next-hop: Matches the next hop of routing information to the filter.
route-source: Matches the source address of routing information to the filter.
acl acl-number: Matches an ACL with a number from 2000 to 2999.
ip-prefix ip-prefix-name: Matches an IP prefix list with a name being a string of 1 to 19 characters.
Description
Use the if-match ip command to configure a next hop or source address match criterion for IPv4 routes.
Use the undo if-match ip command to remove the match criterion.
The match criterion is not configured by default.
Examples
# Configure node 10 of routing policy policy1 to permit routing information whose next hop address matches IP prefix list p1.
<Sysname> system-view
[Sysname] route-policy policy1 permit node 10
[Sysname-route-policy] if-match ip next-hop ip-prefix p1
if-match ip-prefix
Syntax
if-match ip-prefix ip-prefix-name
undo if-match ip-prefix
View
Routing policy view
Default level
2: System level
Parameters
ip-prefix-name: Matches an IP prefix list with a name being a string of 1 to 19 characters.
Description
Use the if-match ip-prefix command to configure an IP prefix list based match criterion.
Use the undo if-match ip-prefix command to remove the match criterion.
No IP prefix list based match criterion is configured by default.
Examples
# Configure node 10 of routing policy policy2 to permit routes whose destination address matches IP prefix list p1.
<Sysname> system-view
[Sysname] route-policy policy2 permit node 10
[Sysname-route-policy] if-match ip-prefix p1
ip ip-prefix
Syntax
ip ip-prefix ip-prefix-name [ index index-number ] { deny | permit } ip-address mask-length [ greater-equal min-mask-length ] [ less-equal max-mask-length ]
undo ip ip-prefix ip-prefix-name [ index index-number ]
View
System view
Default level
2: System level
Parameters
ip-prefix-name: IPv4 prefix list name, a string of 1 to 19 characters.
index-number: Index number, in the range of 1 to 65535, for uniquely specifying an item of the IPv4 prefix list. An index with a smaller number is matched first.
deny: Specifies the match mode for the IPv4 prefix list as deny. If a route matches the IPv4 prefix list, the route neither passes the filter nor matches against the next item; if not, the route matches against the next item (suppose the IPv4 prefix list has multiple items configured).
permit: Specifies the match mode for the IPv4 prefix list as permit. If a route matches the IPv4 prefix list, it passes the IPv4 prefix list. If not, it matches against the next item (suppose the IPv4 prefix list has multiple items configured).
ip-address mask-length: Specifies an IPv4 prefix and mask length. The mask-length is in the range of 0 to 32.
min-mask-length, max-mask-length: Specifies the prefix range. greater-equal means “greater than or equal to” and less-equal means “less than or equal to”. The range relation is mask-length <= min-mask-length <= max-mask-length <= 32. If only the min-mask-length is specified, the prefix length range is [ min-mask-length, 32 ]. If only the max-mask-length is specified, the prefix length range is [ mask-length, max-mask-length ]. If both min-mask-length and max-mask-length are specified, the prefix length range is [ min-mask-length, max-mask-length ].
Description
Use the ip ip-prefix command to configure an IPv4 prefix list or an item of it.
Use the undo ip ip-prefix command to remove an IPv4 prefix list or an item of it.
No IPv4 prefix list is configured by default.
An IPv4 prefix list is used to filter IPv4 addresses. It may have multiple items, each of which specifies a range of IPv4 prefixes. The relation between the items is logic OR, namely, if an item is passed, the IPv4 prefix list is passed. If no item is passed, the IP prefix list cannot be passed.
The IP prefix range is determined by mask-length and [ min-mask-length, max-mask-length ]. If both mask-length and [ min-mask-length, max-mask-length ] are specified, the IP address must satisfy both of them.
If both ip-address and mask-length are specified as 0.0.0.0 0, only the default route will be matched.
To match all routes, use 0.0.0.0 0 less-equal 32.
Examples
# Define IP prefix list p1 to permit routes matching network 10.0.192.0/8 and with mask length 17 or 18.
<Sysname> system-view
[Sysname] ip ip-prefix p1 permit 10.0.192.0 8 greater-equal 17 less-equal 18
reset ip ip-prefix
Syntax
reset ip ip-prefix [ ip-prefix-name ]
View
User view
Default level
2: System level
Parameters
ip-prefix-name: IP prefix list name, a string of 1 to 19 characters.
Description
Use the reset ip ip-prefix command to clear the statistics of a specified IPv4 prefix list. If no ip-prefix-name is specified, the statistics of all IPv4 prefix lists will be cleared.
Examples
# Clear the statistics of IPv4 prefix list abc.
<Sysname> reset ip ip-prefix abc
IPv6 routing policy configuration commands
apply ipv6 next-hop
Syntax
apply ipv6 next-hop ipv6-address
undo apply ipv6 next-hop
View
Routing policy view
Default level
2: System level
Parameters
ipv6-address: Next hop IPv6 address.
Description
Use the apply ipv6 next-hop command to configure a next hop for IPv6 routes.
Use the undo apply ipv6 next-hop command to remove the clause configuration.
No next hop address is configured for IPv6 routing information by default.
This command cannot configure a next hop for redistributed routes.
Examples
# Configure node 10 of routing policy policy1 to configure next hop 3ff3:506::1 for IPv6 routing information matching AS-PATH list 1.
<Sysname> system-view
[Sysname] route-policy policy1 permit node 10
[Sysname-route-policy] if-match as-path 1
[Sysname-route-policy] apply ipv6 next-hop 3ffe:506::1
display ip ipv6-prefix
Syntax
display ip ipv6-prefix [ ipv6-prefix-name ] [ | { begin | exclude | include } regular-expression ]
View
Any view
Default level
1: Monitor level
Parameters
ipv6-prefix-name: IPv6 prefix list name, a string of 1 to 19 characters.
|: Filters command output by specifying a regular expression. For more information about regular expressions, see Fundamentals Configuration Guide.
begin: Displays the first line that matches the specified regular expression and all lines that follow.
exclude: Displays all lines that do not match the specified regular expression.
include: Displays all lines that match the specified regular expression.
regular-expression: Specifies a regular expression, a case-sensitive string of 1 to 256 characters.
Description
Use the display ip ipv6-prefix command to display the statistics of the specified IPv6 prefix list. If no IPv6 prefix list is specified, the statistics of all IPv6 prefix lists will be displayed.
Examples
# Display the statistics of all IPv6 prefix lists.
<Sysname> display ip ipv6-prefix
Prefix-list6 abc
Permitted 0
Denied 0
index: 10 permit ::/0
index: 20 permit ::/1 ge 1 le 128
Table 4 Output description
Field |
Description |
Prefix-list6 |
Name of the IPv6 prefix list |
Permitted |
Number of routes satisfying the match criterion |
Denied |
Number of routes not satisfying the match criterion |
Index |
Index number of the prefix list |
Permit |
Match mode of the item: permit, or deny |
::/1 |
IPv6 address and prefix length for matching |
ge |
greater-equal, the lower prefix length |
Le |
less-equal, the upper prefix length |
if-match ipv6
Syntax
if-match ipv6 { address | next-hop | route-source } { acl acl6-number | prefix-list ipv6-prefix-name }
undo if-match ipv6 { address | next-hop | route-source } [ acl | prefix-list ]
View
Routing policy view
Default level
2: System level
Parameters
address: Matches the destination address of IPv6 routing information.
next-hop: Matches the next hop of IPv6 routing information.
route-source: Matches the source address of IPv6 routing information.
acl acl6-number: Specifies the number of an IPv6 ACL for filtering, in the range of 2000 to 3999 for address, and 2000 to 2999 for next-hop and route-source.
prefix-list ipv6-prefix-name: Specifies the name of a IPv6 prefix list for filtering, a string of 1 to 19 characters.
Description
Use the if-match ipv6 command to configure a destination, next hop or source address based match criterion for IPv6 routes.
Use the undo if-match ipv6 command to remove the match criterion.
The match criterion is not configured by default.
Examples
# Configure node 10 of routing policy policy1 to permit routing information whose next hop address matches IPv6 prefix list p1.
<Sysname> system-view
[Sysname] route-policy policy1 permit node 10
[Sysname-route-policy] if-match ipv6 next-hop prefix-list p1
ip ipv6-prefix
Syntax
ip ipv6-prefix ipv6-prefix-name [ index index-number ] { deny | permit } ipv6-address prefix-length [ greater-equal min-prefix-length ] [ less-equal max-prefix-length ]
undo ip ipv6-prefix ipv6-prefix-name [ index index-number ]
View
System view
Default level
2: System level
Parameters
ipv6-prefix-name: IPv6 prefix list name, a string of 1 to 19 characters, for uniquely specifying an IPv6 prefix list.
index-number: Index number, in the range of 1 to 65535, for uniquely specifying an IPv6 prefix list item. An item with a smaller index-number will be matched first.
deny: Specifies the match mode for the IPv6 prefix list as deny. If a route matches the IPv6 prefix list, the route neither passes the filter nor matches against the next item; if not, the route matches against the next item (suppose the IPv6 prefix list has multiple items configured).
permit: Specifies the match mode for the IPv6 prefix list as permit. If a route matches the IPv6 prefix list, it passes the IPv6 prefix list. If not, it matches against the next item (suppose the IPv6 prefix list has multiple items configured).
ipv6-address prefix-length: Specifies an IPv6 prefix and prefix length. A prefix-length is in the range of 0 to 128. When specified as :: 0, the arguments match the default route.
greater-equal min-prefix-length: Greater than or equal to the minimum prefix length.
less-equal max-prefix-length: Less than or equal to the maximum prefix length.
The length relation is mask-length <= min-mask-length <= max-mask-length <= 128. If only the min-prefix-length is specified, the prefix length range is [ min-prefix-length, 128 ]. If only the max-prefix-length is specified, the prefix length range is [ prefix-length, max-prefix-length ]. If both the min-prefix-length and max-prefix-length are specified, the prefix length range is [ min-prefix-length, max-prefix-length ].
Description
Use the ip ipv6-prefix command to configure an IPv6 prefix list or an item of it.
Use the undo ip ipv6-prefix command to remove an IPv6 prefix list or an item.
No IPv6 prefix list is configured by default.
An IPv6 prefix list may have multiple items, and each of them specifies a range of IPv6 prefixes. The relation between items is logic OR, namely, if a route passes an item of it, the route will pass the IPv6 prefix list.
The IPv6 prefix range is determined by prefix-length and [ min-prefix-length, max-prefix-length ]. If both mask-length and [ min-mask-length, max-mask-length ] are specified, then the IPv6 addresses must satisfy both of them.
If ipv6-address prefix-length is specified as :: 0, only the default route matches.
To match all routes, configure :: 0 less-equal 128.
Examples
# Permit IPv6 addresses with a mask length between 32 bits and 64 bits.
<Sysname> system-view
[Sysname] ip ipv6-prefix abc permit :: 0 greater-equal 32 less-equal 64
# Deny IPv6 addresses with the prefix being 3FFE:D00::/32, and prefix length being greater than or equal to 32 bits.
<Sysname> system-view
[Sysname] ip ipv6-prefix abc deny 3FFE:D00:: 32 less-equal 128
reset ip ipv6-prefix
Syntax
reset ip ipv6-prefix [ ipv6-prefix-name ]
View
User view
Default level
2: System level
Parameters
ipv6-prefix-name: IPv6 prefix list name, a string of 1 to 19 characters.
Description
Use the reset ip ipv6-prefix command to clear the statistics of the specified IPv6 prefix list. If no name is specified, the statistics of all IPv6 prefix lists will be cleared.
Examples
# Clear the statistics of IPv6 prefix list abc.
<Sysname> reset ip ipv6-prefix abc