05-Network Connectivity

HomeSupportWirelessWX3800X Series Access ControllersConfigure & DeployConfiguration GuidesH3C WX3800X Series Access Controllers Configuration Guides(E1053P01)-5W10105-Network Connectivity
30-Policy-based routing configuration
Title Size Download
30-Policy-based routing configuration 104.97 KB

Configuring PBR

About PBR

Policy-based routing (PBR) uses user-defined policies to route packets. A policy can specify parameters for packets that match specific criteria such as ACLs or that have specific lengths. The parameters include the next hop, output interface, default next hop, and default output interface.

Packet forwarding process

When the device receives a packet, the device searches the 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 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 or output interfaces are specified on the node.

-     Forwarding failed based on the next hops or output interfaces.

c.     Uses the default next hops 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 or default output interfaces are specified on the node.

-     The forwarding failed based on the default next hops 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.

PBR types

PBR includes the following types:

·     Local PBR—Guides the forwarding of locally generated packets, such as ICMP packets generated by using the ping command.

·     Interface PBR—Guides the forwarding of packets received on an interface.

Policy

A 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.

A 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. If the packet does not match any criteria on the node, 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.

Relationship between if-match clauses

On a node, you can specify multiple types of if-match clauses but only one if-match clause for each type.

To match a node, a packet must match all types of the if-match clauses for the node but only one if-match clause for each type.

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 relationship between apply clauses, see "Configuring actions for a node."

Relationship between the match mode and clauses on the node

Does a packet match all the if-match clauses on the node?

Match mode

Permit

Deny

Yes.

·     If the node contains apply clauses, PBR executes the apply clauses on the node.

¡     If PBR-based forwarding succeeds, PBR does not compare the packet with the next node.

¡     If PBR-based forwarding fails and the apply continue clause is not configured, PBR does not compare the packet with the next node.

¡     If PBR-based forwarding fails and the apply continue clause is configured, PBR compares 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.

PBR compares the packet with the next node.

PBR compares the packet with the next node.

 

NOTE:

A node that has no if-match clauses matches any packet.

Restrictions and guidelines: PBR configuration

If a packet destined for the local device matches a PBR policy, PBR will execute the apply clauses in the policy, including the clause for forwarding. When you configure a PBR policy, be careful to avoid this situation.

PBR tasks at a glance

To configure PBR, perform the following tasks:

1.     Configuring a policy

a.     Creating a node

b.     Setting match criteria for a node

c.     Configuring actions for a node

2.     Specifying a policy for PBR

Choose the following tasks as needed:

¡     Specifying a policy for local PBR

¡     Specifying a policy for interface PBR

¡     Specifying a policy for global PBR

3.     (Optional.) Enabling SNMP notifications for PBR

Configuring a policy

Creating a node

1.     Enter system view.

system-view

2.     Create a node for a policy, and enter its view.

policy-based-route policy-name [ deny | permit ] node node-number

3.     (Optional.) Configure a description for the policy node.

description text

By default, no description is configured for a policy node.

Setting match criteria for a node

Procedure

1.     Enter system view.

system-view

2.     Enter policy node view.

policy-based-route policy-name [ deny | permit ] node node-number

3.     Set match criteria.

¡     Set an ACL match criterion.

if-match acl { acl-number | name 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, PBR ignores the action (permit or deny) and time range settings in the ACL.

¡     Set a packet length match criterion.

if-match packet-length min-len max-len

By default, no packet length match criterion is set.

¡     Set a local QoS ID match criterion.

if-match qos-local-id local-id-value

By default, no local QoS ID match criterion is set.

¡     Set service object group match criteria.

if-match object-group service object-group-name&<1-6>

By default, no service object group match criteria are set.

Configuring actions for a node

About this task

The apply clauses allow you to specify the actions to be taken on matching packets on a node.

The following apply clauses determine the packet forwarding paths in a descending order:

·     apply next-hop

·     apply output-interface

·     apply default-next-hop

·     apply default-output-interface

PBR supports the types of apply clauses shown in Table 1.

Table 1 Priorities and meanings of apply clauses

Clause

Meaning

Priority

apply precedence

Sets an IP precedence.

This clause is always executed.

apply ip-df df-value

Sets the Don't Fragment (DF) bit in the IP header.

This clause is always executed.

apply loadshare { default-next-hop | default-output-interface | next-hop | output-interface }

Enables load sharing among multiple next hops, output interfaces, default next hops, or default output interfaces.

Multiple next hop, output interface, default next hop, or default output interface options operate in either primary/backup or load sharing mode. The following description uses multiple next hops as an example:

·     Primary/backup mode—A next hop is selected from all next hops in configuration order for packet forwarding, with all remaining next hops as backups. When the selected next hop fails, the next available next hop takes over.

·     Load sharing mode—Matching traffic is distributed across the available next hops. If the traffic does not match any fast forwarding entries, per-packet load sharing is performed. If the traffic matches a fast forwarding entry, per-flow load sharing is performed.

By default, the primary/backup mode applies.

For the load sharing mode to take effect, make sure multiple next hops, output interfaces, default next hops, or default output interfaces are set in the policy.

apply next-hop and apply output-interface

Sets next hops and output interfaces.

If multiple clauses are configured, only the clause with the highest priority is executed.

apply default-next-hop and apply default-output-interface

Sets default next hops 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 hopsor output interface are set or the next hopsand output interfaces are invalid.

·     The packet does not match any route in the routing table.

apply continue

Compares packets with the next node upon failure on the current node.

The apply continue clause applies when either of the the following conditions exist:

·     None of the following clauses is configured for packet forwarding:

¡     apply access-vpn vpn-instance

¡     apply next-hop

¡     apply output-interface

¡     apply default-next-hop

¡     apply default-output-interface

·     A clause listed above is configured, but it has become invalid. Then, a routing table lookup also fails for the matching packet.

NOTE:

A clause might become invalid because the specified next hop is unreachable, packets cannot be forwarded in the specified VPN instance, or the specified output interface is down.

Restrictions and guidelines

For outbound PBR, you can specify only one next hop and the next hop must be directly connected.

If you specify a next hop or default next hop, PBR periodically performs a lookup in the FIB table to determine its availability. Temporary service interruption might occur if PBR does not update the route immediately after its availability status changes.

Configuring actions to modify packet fields

1.     Enter system view.

system-view

2.     Enter policy node view.

policy-based-route policy-name [ deny | permit ] node node-number

3.     Configure actions.

¡     Set an IP precedence.

apply precedence { type | value }

By default, no IP precedence is specified.

¡     Set the DF bit in the IP header.

apply ip-df df-value

By default, the DF bit in the IP header is not set.

Configuring actions to direct packet forwarding

1.     Enter system view.

system-view

2.     Enter policy node view.

policy-based-route policy-name [ deny | permit ] node node-number

3.     Configure actions.

¡     Set next hops.

apply next-hop  { ip-address [ direct ] [ weight weight-value ] }&<1-4>

By default, no next hops are specified.

On a node, you can specify a maximum of four next hops for backup or load sharing in one command line or by executing this command multiple times.

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.

¡     Enable load sharing among multiple next hops.

apply loadshare next-hop

By default, the next hops operate in primary/backup mode.

¡     Set output interfaces.

apply output-interface { interface-type interface-number }&<1-4>

By default, no output interfaces are specified.

On a node, you can specify a maximum of four output interfaces for backup or load sharing in one command line or by executing this command multiple times.

¡     Enable load sharing among multiple output interfaces.

apply loadshare output-interface

By default, the output interfaces operate in primary/backup mode.

¡     Set default next hops.

apply default-next-hop { ip-address [ direct ] }&<1-4>

By default, no default next hops are specified.

On a node, you can specify a maximum of four default next hops for backup or load sharing in one command line or by executing this command multiple times.

¡     Enable load sharing among multiple default next hops.

apply loadshare default-next-hop

By default, the default next hops operate in primary/backup mode.

¡     Set default output interfaces.

apply default-output-interface { interface-type interface-number }&<1-4>

By default, no default output interfaces are specified.

On a node, you can specify a maximum of four default output interfaces for backup or load sharing in one command line or by executing this command multiple times.

¡     Enable load sharing among multiple default output interfaces.

apply loadshare default-output-interface

By default, the default output interfaces operate in primary/backup mode.

Comparing packets with the next node upon match failure on the current node

1.     Enter system view.

system-view

2.     Enter policy node view.

policy-based-route policy-name [ deny | permit ] node node-number

3.     Compare packets with the next node upon match failure on the current node.

apply continue

By default, PBR does not compare packets with the next node upon match failure on the current node.

This command takes effect only when the match mode of the node is permit.

Specifying a policy for PBR

Specifying a policy for local PBR

About this task

Perform this task to specify a policy for local PBR to guide the forwarding of locally generated packets.

Restrictions and guidelines

You can specify only one policy for local PBR and must make sure the specified policy already exists. Before you apply a new policy, you must first remove the current policy.

Local PBR might affect local services such as ping and Telnet. When you use local PBR, make sure you fully understand its impact on local services of the device.

Procedure

1.     Enter system view.

system-view

2.     Specify a policy for local PBR.

ip local policy-based-route policy-name

By default, local PBR is not enabled.

Specifying a policy for interface PBR

About this task

Perform this task to apply a policy to an interface to guide the forwarding of packets received on the interface.

Restrictions and guidelines

You can apply only one policy to an interface and must make sure the specified policy already exists. Before you can apply a new interface PBR policy to an interface, 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 a policy for interface PBR.

ip policy-based-route policy-name

By default, no interface policy is applied to an interface.

Specifying a policy for global PBR

About this task

Perform this task to apply a policy to all interfaces on the device to guide the forwarding of packets received on the interfaces.

Restrictions and guidelines

You can apply only one policy for global PBR and the specified policy must already exist. Before you can apply a new policy, you must first remove the current policy.

Interface PBR takes precedence over global PBR on an interface. When they are both configured and packets fail to match the interface PBR policy, global PBR applies.

Procedure

1.     Enter system view.

system-view

2.     Specify a policy for global PBR.

ip global policy-based-route policy-name

By default, no policy is specified for global PBR.

Enabling SNMP notifications for PBR

About this task

Perform this task to enable SNMP notifications for PBR. PBR can generate notifications and send them to the SNMP module when the next hop becomes invalid. For the PBR notifications to be sent correctly, you must also configure SNMP on the device. For more information about configuring SNMP, see the network management and monitoring configuration guide for the device.

Procedure

1.     Enter system view.

system-view

2.     Enable SNMP notifications for PBR.

snmp-agent trap enable policy-based-route

By default, SNMP notifications are enabled for PBR.

Verifying and maintaining PBR

Verifying PBR policy configuration

To display PBR policy information, execute the following command in any view:

display ip policy-based-route [ policy policy-name ]

Displaying PBR configuration and statistics

Perform display tasks in any view.

·     Display PBR configuration.

display ip policy-based-route setup

·     Display local PBR configuration and statistics.

display ip policy-based-route local

·     Display global PBR configuration and statistics

display ip policy-based-route global

·     Display interface PBR configuration and statistics.

display ip policy-based-route interface interface-type interface-number

Clearing PBR statistics

To clear PBR statistics, execute the following command in user view:

reset ip policy-based-route statistics [ policy policy-name ]

 

  • Cloud & AI
  • InterConnect
  • Intelligent Computing
  • Intelligent Storage
  • Security
  • SMB Products
  • Intelligent Terminal Products
  • Product Support Services
  • Technical Service Solutions
All Services
  • Resource Center
  • Policy
  • Online Help
  • Technical Blogs
All Support
  • Become A Partner
  • Partner Policy & Program
  • Global Learning
  • Partner Sales Resources
  • Partner Business Management
  • Service Business
All Partners
  • Profile
  • News & Events
  • Online Exhibition Center
  • Contact Us
All About Us
新华三官网