- Table of Contents
-
- 06-Layer 3—IP Routing Configuration Guide
- 00-Preface
- 01-Basic IP routing configuration
- 02-Static routing configuration
- 03-RIP configuration
- 04-OSPF configuration
- 05-IS-IS configuration
- 06-Basic BGP configuration
- 07-Advanced BGP configuration
- 08-Policy-based routing configuration
- 09-IPv6 static routing configuration
- 10-RIPng configuration
- 11-OSPFv3 configuration
- 12-IPv6 policy-based routing configuration
- 13-Routing policy configuration
- 14-DCN configuration
- Related Documents
-
Title | Size | Download |
---|---|---|
12-IPv6 policy-based routing configuration | 154.63 KB |
Contents
IPv6 packet forwarding process
Restrictions and guidelines: IPv6 PBR configuration
Setting match criteria for an IPv6 node
Configuring actions for an IPv6 node
Specifying a policy for IPv6 PBR
Specifying an IPv6 policy for IPv6 local PBR
Specifying an IPv6 policy for IPv6 interface PBR
Enabling the IPv6 PBR logging feature
Verifying and maintaining IPv6 PBR
Verifying IPv6 PBR policy configuration
Displaying IPv6 PBR configuration and statistics
IPv6 PBR configuration examples
Configuring IPv6 PBR
About IPv6 PBR
IPv6 policy-based routing (PBR) uses user-defined policies to route IPv6 packets. A policy can specify parameters for packets that match specific criteria such as ACLs. The parameters include the next hop, output interface, default next hop, SRv6 TE policy, SR-MPLS TE policy, default SRv6 TE policy, default SR-MPLS TE policy, and default output interface.
IPv6 packet forwarding process
When the device receives an IPv6 packet, the device searches the IPv6 PBR policy for a matching node to forward that packet.
· If a matching node is found and its match mode is permit, the device performs the following operations:
a. Uses the next hops, SRv6 TE policies, SR-MPLS TE policies, or output interfaces specified on the node to forward the packet.
b. Searches the routing table for a route (except the default route) to forward the packet if one of the following conditions exists:
- No next hops, SRv6 TE policies, SR-MPLS TE policies, or output interfaces are specified on the node.
- Forwarding failed based on the next hops, SRv6 TE policies, SR-MPLS TE policies, or output interfaces.
c. Uses the default next hops, default SRv6 TE policies, default SR-MPLS TE policies, or default output interfaces specified on the node to forward the packet if one of the following conditions exists:
- No matching route was found in the routing table.
- The routing table-based forwarding failed.
d. Uses the default route to forward the packet if one of the following conditions exists:
- No default next hops, default SRv6 TE policies, default SR-MPLS TE policies, or default output interfaces are specified on the node.
- The forwarding failed based on the default next hops, default SRv6 TE policies, default SR-MPLS TE policies, or default output interfaces.
· The device performs routing table lookup to forward the packet in either of the following conditions:
¡ No matching node is found.
¡ A matching node is found, but its match mode is deny.
IPv6 PBR types
IPv6 PBR includes the following types:
· Local PBR—Guides the forwarding of locally generated packets, such as the ICMP packets generated by using the ping command.
· Interface PBR—Guides the forwarding of packets received on an interface only.
Policy
An IPv6 policy includes match criteria and actions to be taken on the matching packets. A policy can have one or multiple nodes as follows:
· Each node is identified by a node number. A smaller node number has a higher priority.
· A node contains if-match and apply clauses. An if-match clause specifies a match criterion, and an apply clause specifies an action.
· A node has a match mode of permit or deny.
An IPv6 policy compares packets with nodes in priority order. If a packet matches the criteria on a node, it is processed by the action on the node. Otherwise, it goes to the next node for a match. If the packet does not match the criteria on any node, the device performs a routing table lookup for the packet.
Relationship between if-match clauses
Only the if-match acl clause is supported. On a node, you can specify only one if-match acl clause.
Relationship between apply clauses
You can specify multiple apply clauses for a node, but some of them might not be executed. For more information about the relationship between the apply clauses, see "Configuring actions for an IPv6 node."
Relationship between the match mode and clauses on the node
Match mode |
||
In permit mode |
In deny mode |
|
Yes |
· If the node contains apply clauses, IPv6 PBR executes the apply clauses on the node. ¡ If IPv6 PBR-based forwarding succeeds, IPv6 PBR does not compare the packet with the next node. ¡ If IPv6 PBR-based forwarding fails, IPv6 PBR does not compare the packet with the next node. · If the node does not contain apply clauses, the device performs a routing table lookup for the packet. |
The device performs a routing table lookup for the packet. |
No |
IPv6 PBR compares the packet with the next node. |
IPv6 PBR compares the packet with the next node. |
|
NOTE: A node that has no if-match clauses matches any packet. |
IPv6 PBR and Track
IPv6 PBR can work with the Track feature to dynamically adapt the availability status of an apply clause to the link status of a tracked object. The tracked object can be a next hop, output interface, default next hop, or default output interface.
· When the track entry associated with an object changes to Negative, the apply clause is invalid.
· When the track entry changes to Positive or NotReady, the apply clause is valid.
For more information about Track-IPv6 PBR collaboration, see High Availability Configuration Guide.
Restrictions and guidelines: IPv6 PBR configuration
If a valid default route is configured on the device, and an IPv6 PBR policy is applied to an interface, the following commands in the PBR policy cannot take effect:
· apply default-next-hop
· apply default-output-interface
· apply default-sr-policy
· apply default-srv6-policy
If a packet destined for the local device matches an IPv6 PBR policy, IPv6 PBR will execute the apply clauses in the policy, including the clause for forwarding. When you configure an IPv6 PBR policy, be careful to avoid this situation.
Upon rebooting a device, if you configure a new IPv6 PBR match criterion on it, packets matching the existing IPv6 PBR match criterion will be discarded when the following conditions exist:
· The interfaces configured with both IPv6 PBR match criteria are the same type on the device. In addition, the new IPv6 PBR match criterion contains larger match scope than the existing IPv6 PBR match criterion.
· The new IPv6 PBR match criterion is configured for a different type of interface than the existing IPv6 PBR match criterion on the device.
The packet loss issue will be resolved after the new IPv6 PBR match criterion is successfully applied. As a best practice, specify an appropriate match scope when you configure an IPv6 PBR match criterion for the first time to avoid future modifications.
When you apply an IPv6 PBR policy to an interface, configuration deployment might fail if the following conditions exist:
· An ACL match rule is configured on a policy node.
· The prefix length for the source IPv6 address specified in the ACL rule is greater than 96 bits.
· The apply access-vpn vpn-instance command is executed on the policy node.
IPv6 PBR tasks at a glance
To configure IPv6 PBR, perform the following tasks:
b. Setting match criteria for an IPv6 node
c. Configuring actions for an IPv6 node
2. Specifying a policy for IPv6 PBR
Choose the following tasks as needed:
¡ Specifying an IPv6 policy for IPv6 local PBR
¡ Specifying an IPv6 policy for IPv6 interface PBR
3. (Optional.) Enabling the IPv6 PBR logging feature
Configuring an IPv6 policy
Creating an IPv6 node
1. Enter system view.
system-view
2. Create an IPv6 policy or policy node and enter its view.
ipv6 policy-based-route policy-name [ deny | permit ] node node-number
3. (Optional.) Configure a description for the IPv6 policy node.
description text
By default, no description is configured for an IPv6 policy node.
Setting match criteria for an IPv6 node
1. Enter system view.
system-view
2. Enter IPv6 policy node view.
ipv6 policy-based-route policy-name [ deny | permit ] node node-number
3. Set match criteria.
¡ Set an ACL match criterion.
if-match acl { ipv6-acl-number | name ipv6-acl-name }
By default, no ACL match criterion is set.
The ACL match criterion cannot match Layer 2 information.
When using the ACL to match packets, IPv6 PBR ignores the action (permit or deny) and time range settings in the ACL.
Configuring actions for an IPv6 node
About this task
The apply clauses allow you to specify actions to take on matching packets on a node.
The following apply clauses are traffic path steering clauses, which determine the packet forwarding paths in a descending order:
· apply access-vpn
· apply next-hop
· apply output-interface
· apply srv6-policy
· apply sr-policy
· apply default-next-hop
· apply default-output-interface
· apply default-srv6-policy
· apply default-sr-policy
IPv6 PBR supports the apply clauses in Table 1.
Table 1 Apply clauses supported in IPv6 PBR
Clause |
Meaning |
Remarks |
apply precedence |
Sets an IP precedence. |
This clause is always executed. |
apply access-vpn |
Specifies the forwarding tables that can be used for the matching packets. |
Use this clause only in special scenarios that require sending packets received from one network to another network, for example, from a VPN to the public network, or from one VPN to another VPN. The device forwards the matching packets by using the first available forwarding table selected in the order in which they are specified. |
apply remark-vpn |
Enables VPN remark action. |
VPN remark action marks the matching packets as belonging to the VPN instance to which they are forwarded based on the apply access-vpn vpn-instance command. All subsequent service modules of IPv6 PBR handle the packets as belonging to the re-marked VPN instance. If the VPN remark action is not enabled, the forwarded matching packets are marked as belonging to the VPN instance or the public network from which they were received. VPN remark action applies only to packets that have been successfully forwarded based on the apply access-vpn vpn-instance command. |
apply next-hop, apply output-interface, apply srv6-policy, and apply sr-policy |
Sets next hops, SR-MPLS TE policies, SRv6 TE policies, and output interfaces. |
If multiple clauses are configured, only the clause with the highest priority is executed. |
apply default-next-hop, apply default-output-interface, apply default-srv6-policy, and apply default-sr-policy |
Sets default next hops, default SR-MPLS TE policies, default SRv6 TE policies, and default output interfaces. |
If multiple clauses are configured, only the clause with the highest priority is executed. The clauses take effect only in the following cases: · No next hops, SR-MPLS TE policies, default SRv6 TE policies, or output interfaces are set or the next hops, SR-MPLS TE policies, default SRv6 TE policies, and output interfaces are invalid. · The IPv6 packet does not match any route in the routing table. |
apply statistics |
Counts successful matches and matching bytes on the IPv6 policy node. |
To include the number of successful matches and matching bytes on an IPv6 policy node in the statistics displayed by a display command, execute this command. This clause is always executed for matching packets. |
Restrictions and guidelines for action configuration
IPv6 PBR periodically performs a lookup in the FIB table to determine the availability of a next hop or default next hop specified in an IPv6 PBR policy. If a route change occurs to the next hop, IPv6 PBR might not update the route immediately. This results in a temporary communication interruption.
The apply access-vpn command cannot be configured with other actions for the same IPv6 policy node. You can configure the apply access-vpn command and other actions for different nodes in the same policy. After configuration, packets might not match the nodes based on ascending order of the node numbers.
Setting an IP preference
1. Enter system view.
system-view
2. Enter IPv6 policy node view.
ipv6 policy-based-route policy-name [ deny | permit ] node node-number
3. Set an IP precedence.
apply precedence { type | value }
By default, no IP precedence is specified.
Configuring actions for a node
1. Enter system view.
system-view
2. Enter IPv6 policy node view.
ipv6 policy-based-route policy-name [ deny | permit ] node node-number
3. Configure actions for a node.
¡ Specify the forwarding tables that can be used for the matching packets.
apply access-vpn { public | vpn-instance vpn-instance-name }
By default, the device forwards matching packets by using the forwarding table for the network from which the packets are received.
You can specify the forwarding table for the public network and only one VPN instance.
¡ Enable VPN remark action to mark the matching packets as belonging to the VPN instance to which they are forwarded based on the apply access-vpn vpn-instance command.
apply remark-vpn
By default, VPN remark action is not configured.
¡ Set next hops for permitted IPv6 packets.
apply next-hop [ vpn-instance vpn-instance-name ] { ipv6-address [ direct ] [ track track-entry-number ] } &<1-2>
By default, no next hops are specified.
You can specify multiple next hops for backup in one command line or by executing this command multiple times. You can specify a maximum of two next hops for a node.
If multiple next hops on the same subnet are specified for backup, the device first uses the subnet route for the next hops to forward packets when the primary next hop fails. If the subnet route is not available, the device selects a backup next hop.
¡ Set output interfaces.
apply output-interface { interface-type interface-number [ track track-entry-number ] }
By default, no output interfaces are specified.
The output interfaces specified in this command cannot be automatically created tunnel interfaces.
¡ Set SRv6 TE policies.
apply srv6-policy { endpoint color [ { sid | vpnsid } sid ] }&<1-2>
By default, no SRv6 TE policies are specified.
You can specify a maximum of two SRv6 TE policies in one command line or by executing this command multiple times. The first available SRv6 TE policy selected according to configuration order will be used to forward matching packets.
¡ Set SR-MPLS TE policies.
apply sr-policy { endpoint color }&<1-2>
By default, no SR-MPLS TE policies are specified.
¡ Set default next hops.
apply default-next-hop [ vpn-instance vpn-instance-name | inbound-vpn ] { ipv6-address [ direct ] [ track track-entry-number ] } &<1-2>
By default, no default next hops are specified.
You can specify multiple default next hops for backup in one command line or by executing this command multiple times. You can specify a maximum of two default next hops for a node.
¡ Set default output interfaces.
apply default-output-interface { interface-type interface-number [ track track-entry-number ] }
By default, no default output interfaces are specified.
The default output interfaces specified in this command cannot be automatically created tunnel interfaces.
¡ Set default SRv6 TE policies.
apply default-srv6-policy { endpoint color [ { sid | vpnsid } sid ] }&<1-2>
By default, no default SRv6 TE policies are specified.
You can specify a maximum of two default SRv6 TE policies in one command line or by executing this command multiple times. The first available default SRv6 TE policy selected according to configuration order will be used to forward matching packets.
¡ Set default SR-MPLS TE policies.
apply default-sr-policy { endpoint color }&<1-2>
By default, no default SR-MPLS TE policies are specified.
Collecting statistics
1. Enter system view.
system-view
2. Enter IPv6 policy node view.
ipv6 policy-based-route policy-name [ deny | permit ] node node-number
3. Count successful matches and matching bytes on the IPv6 policy node.
apply statistics
By default, match counting is disabled on an IPv6 policy node.
After configuring this command, you cannot specify the share-mode keyword when specifying an IPv6 policy for IPv6 interface PBR.
Specifying a policy for IPv6 PBR
Specifying an IPv6 policy for IPv6 local PBR
About this task
Perform this task to specify an IPv6 policy for IPv6 local PBR to guide the forwarding of locally generated packets.
Restrictions and guidelines
You can specify only one policy for IPv6 local PBR and must make sure the specified policy already exists. Before you apply a new policy, you must first remove the current policy.
IPv6 local PBR might affect local services, such as ping and Telnet. When you use IPv6 local PBR, make sure you fully understand its impact on local services of the device.
Procedure
1. Enter system view.
system-view
2. Specify an IPv6 policy for IPv6 local PBR.
ipv6 local policy-based-route policy-name
By default, IPv6 local PBR is not enabled.
Specifying an IPv6 policy for IPv6 interface PBR
About this task
Perform this task to apply an IPv6 policy to an interface to guide the forwarding of packets received on the interface only.
To apply an IPv6 policy to multiple VLAN interfaces at the same time, you can use the ipv6 policy-based-route apply command. Using this command simplifies configuration and saves device resources.
Restrictions and guidelines
You can apply only one policy to an interface and must make sure the specified policy already exists. Before you apply a new policy, you must first remove the current policy from the interface.
You can apply a policy to multiple interfaces.
Procedure
1. Enter system view.
system-view
2. Enter interface view.
interface interface-type interface-number
3. Specify an IPv6 policy for IPv6 interface PBR.
ipv6 policy-based-route policy-name [ share-mode ]
By default, no IPv6 policy is applied to the interface.
If you configure the apply statistics clause for the IPv6 PBR policy, you cannot specify the share-mode keyword in this command.
Enabling the IPv6 PBR logging feature
About this task
The IPv6 PBR logging feature helps the administrator locate and fix faults. The feature logs IPv6 PBR events and sends the logs to the information center. The information center processes the logs according to output rules. For more information about the information center, see System Management Configuration Guide.
Procedure
1. Enter system view.
system-view
2. Enable the IPv6 PBR logging feature.
ipv6 policy-based-route-log enable
By default, the IPv6 PBR logging feature is disabled.
Verifying and maintaining IPv6 PBR
Verifying IPv6 PBR policy configuration
To display IPv6 PBR policy information, execute the following command in any view:
display ipv6 policy-based-route [ policy policy-name ]
Displaying IPv6 PBR configuration and statistics
Perform display tasks in any view.
· Display IPv6 PBR configuration.
display ipv6 policy-based-route setup
· Display IPv6 local PBR configuration and statistics.
display ipv6 policy-based-route local [ slot slot-number ]
· Display IPv6 interface PBR configuration and statistics.
display ipv6 policy-based-route interface interface-type interface-number [ slot slot-number ]
Clearing IPv6 PBR statistics
To clear IPv6 PBR statistics, execute the following command in user view:
reset ipv6 policy-based-route statistics [ policy policy-name ]
IPv6 PBR configuration examples
Example: Configuring packet type-based IPv6 local PBR
Network configuration
As shown in Figure 1, Router B and Router C are connected through Router A. Router B and Router C do not have a route to reach each other.
Configure IPv6 PBR on Router A to forward all TCP packets to the next hop 1::2 (Router B).
Procedure
IMPORTANT: By default, interfaces on the device are disabled (in ADM or Administratively Down state). To have an interface operate, you must use the undo shutdown command to enable that interface. |
1. Configure Router A:
# Configure the IPv6 addresses of HundredGigE 1/0/1 and HundredGigE 1/0/2.
<RouterA> system-view
[RouterA] interface hundredgige 1/0/1
[RouterA-HundredGigE1/0/1] ipv6 address 1::1 64
[RouterA-HundredGigE1/0/1] quit
[RouterA] interface hundredgige 1/0/2
[RouterA-HundredGigE1/0/2] ipv6 address 2::1 64
[RouterA-HundredGigE1/0/2] quit
# Configure ACL 3001 to match TCP packets.
[RouterA] acl ipv6 advanced 3001
[RouterA-acl-ipv6-adv-3001] rule permit tcp
[RouterA-acl-ipv6-adv-3001] quit
# Configure Node 5 for policy aaa to forward TCP packets to next hop 1::2.
[RouterA] ipv6 policy-based-route aaa permit node 5
[RouterA-pbr6-aaa-5] if-match acl 3001
[RouterA-pbr6-aaa-5] apply next-hop 1::2
[RouterA-pbr6-aaa-5] quit
# Configure IPv6 local PBR by applying policy aaa to Router A.
[RouterA] ipv6 local policy-based-route aaa
2. On Router B, configure the IPv6 address of HundredGigE 1/0/1.
<RouterB> system-view
[RouterB] interface hundredgige 1/0/1
[RouterB-HundredGigE1/0/1] ipv6 address 1::2 64
3. On Router C, configure the IPv6 address of HundredGigE 1/0/2.
<RouterC> system-view
[RouterC] interface hundredgige 1/0/2
[RouterC-HundredGigE1/0/2] ipv6 address 2::2 64
Verifying the configuration
1. Perform telnet operations to verify that IPv6 local PBR on Router A operates as configured to forward the matching TCP packets to the next hop 1::2 (Router B), as follows:
# Verify that you can telnet to Router B from Router A successfully. (Details not shown.)
# Verify that you cannot telnet to Router C from Router A. (Details not shown.)
2. Verify that Router A forwards packets other than TCP packets through HundredGigE 1/0/2. For example, verify that you can ping Router C from Router A. (Details not shown.)
Example: Configuring packet type-based IPv6 interface PBR
Network configuration
As shown in Figure 2, Router B and Router C do not have a route to reach each other.
Configure IPv6 PBR on Router A to forward all TCP packets received on HundredGigE 1/0/1 to the next hop 1::2 (Router B).
Procedure
IMPORTANT: By default, interfaces on the device are disabled (in ADM or Administratively Down state). To have an interface operate, you must use the undo shutdown command to enable that interface. |
1. Configure IPv6 addresses and unicast routing protocol settings to make sure Router B and Router C can reach Host A. (Details not shown.)
2. Configure Router A:
# Configure ACL 3001 to match TCP packets.
[RouterA] acl ipv6 advanced 3001
[RouterA-acl-ipv6-adv-3001] rule permit tcp
[RouterA-acl-ipv6-adv-3001] quit
# Configure Node 5 for policy aaa to forward TCP packets to next hop 1::2.
[RouterA] ipv6 policy-based-route aaa permit node 5
[RouterA-pbr6-aaa-5] if-match acl 3001
[RouterA-pbr6-aaa-5] apply next-hop 1::2
[RouterA-pbr6-aaa-5] quit
# Configure IPv6 interface PBR by applying policy aaa to HundredGigE 1/0/1.
[RouterA] interface hundredgige 1/0/1
[RouterA-HundredGigE1/0/1] undo ipv6 nd ra halt
[RouterA-HundredGigE1/0/1] ipv6 policy-based-route aaa
[RouterA-HundredGigE1/0/1] quit
Verifying the configuration
1. Enable IPv6 and configure the IPv6 address 10::3 for Host A.
C:\>ipv6 install
Installing...
Succeeded.
C:\>ipv6 adu 4/10::3
2. Perform telnet operations to verify that IPv6 interface PBR on Router A operates as configured to forward the matching TCP packets to the next hop 1::2 (Router B), as follows:
# Verify that you can telnet to Router B from Host A successfully. (Details not shown.)
# Verify that you cannot telnet to Router C from Host A. (Details not shown.)
3. Verify that Router A forwards packets other than TCP packets through HundredGigE 1/0/3. For example, verify that you can ping Router C from Host A. (Details not shown.)