05-Layer 3—IP Routing Configuration Guide

HomeSupportSwitchesS5150 SeriesConfigure & DeployConfiguration GuidesH3C S5150-EI Switch Series Configuration Guides-Release 510x-6W10205-Layer 3—IP Routing Configuration Guide
10-Routing policy configuration
Title Size Download
10-Routing policy configuration 96.67 KB

Configuring routing policies

Overview

Routing policies control routing paths by filtering and modifying routing information. This chapter describes both IPv4 and IPv6 routing policies.

Routing policies can filter advertised, received, and redistributed routes, and modify attributes for specific routes.

To configure a routing policy:

1.     Configure filters based on route attributes, such as destination address and the advertising router's address.

2.     Create a routing policy and apply filters to the routing policy.

Filters

Routing policies can use the following filters to match routes.

ACL

ACLs include IPv4 ACLs and IPv6 ACLs. An ACL can match the destination or next hop of routes.

For more information about ACLs, see ACL and QoS Configuration Guide.

IP prefix list

IP prefix lists include IPv4 prefix lists and IPv6 prefix lists.

An IP prefix list matches the destination address of routes. You can use the gateway option to receive routes only from specific routers. For more information about the gateway option, see "Configuring RIP" and "Configuring OSPF."

An IP prefix list can contain multiple items that specify prefix ranges. Each destination IP address prefix of a route is compared with these items in ascending order of their index numbers. A prefix matches the IP prefix list if it matches one item in the list.

Routing policy

A routing policy can contain multiple nodes, which are in a logical OR relationship. A node with a smaller number is matched first. A route matches the routing policy if it matches one node (except the node configured with the continue clause) in the routing policy.

Each node has a match mode of permit or deny.

·     permit—Specifies the permit match mode for a routing policy node. If a route meets all the if-match clauses of the node, it is handled by the apply clauses of the node. The route is not compared with the next node unless the continue clause is configured. If a route does not meet all the if-match clauses of the node, it is compared with the next node.

·     deny—Specifies the deny match mode for a routing policy node. The apply and continue clauses of a deny node are never executed. If a route meets all the if-match clauses of the node, it is denied without being compared with the next node. If a route does not meet all the if-match clauses of the node, it is compared with the next node.

A node can contain a set of if-match, apply, and continue clauses.

·     if-match clauses—Specify the match criteria that match the attributes of routes. The if-match clauses are in a logical AND relationship. A route must meet all the if-match clauses to match the node.

·     apply clauses—Specify the actions to be taken on permitted routes, such as modifying a route attribute.

·     continue clause—Specifies the next node. A route that matches the current node (permit node) must match the specified next node in the same routing policy. The continue clause combines the if-match and apply clauses of the two nodes to improve flexibility of the routing policy.

Follow these guidelines when you configure if-match, apply, and continue clauses:

·     If you only want to filter routes, do not configure apply clauses.

·     If you do not configure any if-match clauses for a permit node, the node will permit all routes.

·     Configure a permit node containing no if-match or apply clauses following multiple deny nodes to allow unmatched routes to pass.

Configuring filters

Configuration prerequisites

Determine the IP prefix list name, matching address range, and community list number.

Configuring an IP prefix list

Configuring an IPv4 prefix list

If all the items are set to deny mode, no routes can pass the IPv4 prefix list. To permit unmatched IPv4 routes, you must configure the permit 0.0.0.0 0 less-equal 32 item following multiple deny items.

To configure an IPv4 prefix list:

 

Step

Command

Remarks

1.     Enter system view.

system-view

N/A

2.     Configure an IPv4 prefix list.

ip prefix-list prefix-list-name [ index index-number ] { deny | permit } ip-address mask-length [ greater-equal min-mask-length ] [ less-equal max-mask-length ]

By default, no IPv4 prefix lists exist.

 

Configuring an IPv6 prefix list

If all items are set to deny mode, no routes can pass the IPv6 prefix list. To permit unmatched IPv6 routes, you must configure the permit :: 0 less-equal 128 item following multiple deny items.

To configure an IPv6 prefix list:

 

Step

Command

Remarks

1.     Enter system view.

system-view

N/A

2.     Configure an IPv6 prefix list.

ipv6 prefix-list prefix-list-name [ index index-number ] { deny | permit } ipv6-address { prefix-length | inverse inverse-prefix-length [ greater-equal min-prefix-length ] [ less-equal max-prefix-length ] }

By default, no IPv6 prefix lists exist.

 

Configuring a routing policy

Configuration prerequisites

Configure filters and routing protocols, and determine the routing policy name, node numbers, match criteria, and the attributes to be modified.

Creating a routing policy

For a routing policy that has more than one node, configure a minimum of one permit node. A route that does not match any node cannot pass the routing policy. If all the nodes are in deny mode, no routes can pass the routing policy.

To create a routing policy:

 

Step

Command

Remarks

1.     Enter system view.

system-view

N/A

2.     Create a routing policy and a node, and enter routing policy node view.

route-policy route-policy-name { deny | permit } node node-number

By default, no routing policies exist.

 

Configuring if-match clauses

You can either specify no if-match clauses or multiple if-match clauses for a routing policy node. If no if-match clause is specified for a permit node, all routes can pass the node. If no if-match clause is specified for a deny node, no routes can pass the node.

The if-match clauses of a routing policy node have a logical AND relationship. A route must meet all if-match clauses before it can be executed by the apply clauses of the node. If an if-match command exceeds the maximum length, multiple if-match clauses of the same type are generated. These clauses have a logical OR relationship. A route only needs to meet one of them.

To configure if-match clauses:

 

Step

Command

Remarks

1.     Enter system view.

system-view

N/A

2.     Enter routing policy node view.

route-policy route-policy-name { deny | permit } node node-number

N/A

3.     Match routes whose destination, next hop, or source address matches an ACL or prefix list.

·     Match IPv4 routes whose destination, next hop, or source address matches an ACL or IPv4 prefix list:
if-match ip { address | next-hop | route-source } { acl ipv4-acl-number | prefix-list prefix-list-name }

·     Match IPv6 routes whose destination, next hop, or source address matches an ACL or IPv6 prefix list:
if-match ipv6 { address | next-hop | route-source } { acl ipv6-acl-number | prefix-list prefix-list-name }

By default, no ACL or prefix list match criterion is configured.

If the ACL used by an if-match clause does not exist, the clause is always matched. If no rules of the specified ACL are matched or the match rules are inactive, the clause is not matched.

All IPv6 routes match a node if the if-match clauses of the node use only IPv4 ACLs.

All IPv4 routes match a node if the if-match clauses of the node use only IPv6 ACLs.

4.     Match routes having the specified cost.

if-match cost cost-value

By default, no cost match criterion is configured.

5.     Match routes having the specified output interface.

if-match interface { interface-type interface-number }&<1-16>

By default, no output interface match criterion is configured.

6.     Match routes having the specified route type.

if-match route-type { external-type1 | external-type1or2 | external-type2 | internal | nssa-external-type1 | nssa-external-type1or2 | nssa-external-type2 } *

By default, no route type match criterion is configured.

7.     Match IGP routes having the specified tag value.

if-match tag tag-value

By default, no tag match criterion is configured.

 

Configuring apply clauses

Except for the apply commands used for setting the next hop for IPv4 and IPv6 routes, all apply commands are the same for IPv4 and IPv6 routing.

To configure apply clauses:

 

Step

Command

Remarks

1.     Enter system view.

system-view

N/A

2.     Enter routing policy node view.

route-policy route-policy-name { deny | permit } node node-number

N/A

3.     Set a cost for routes.

apply cost [ + | - ] cost-value

By default, no cost is set for routes.

4.     Set a cost type for routes.

apply cost-type { type-1 | type-2 }

By default, no cost type is set for routes.

5.     Set the next hop for routes.

·     Set the next hop for IPv4 routes:
apply ip-address next-hop ip-address [ public ]

·     Set the next hop for IPv6 routes:
apply ipv6 next-hop ipv6-address

By default, no next hop is set for IPv4 or IPv6 routes.

The apply ip-address next-hop and apply ipv6 next-hop commands do not apply to redistributed IPv4 and IPv6 routes.

6.     Set a preference.

apply preference preference

By default, no preference is set.

7.     Set a prefix priority.

apply prefix-priority { critical | high | medium }

By default, no prefix priority is set, which means the prefix priority is low.

8.     Set a tag value for IGP routes.

apply tag tag-value

By default, no tag value is set for IGP routes.

 

Configuring the continue clause

Follow these guidelines when you configure the continue clause to combine multiple nodes:

·     If you configure an apply clause that sets different attribute values on all the nodes, the apply clause of the node configured most recently takes effect.

·     If you configure the following apply clauses on all the nodes, the apply clause of each node takes effect:

¡     apply as-path without the replace keyword.

¡     apply cost with the + or keyword.

¡     apply community with the additive keyword.

¡     apply extcommunity with the additive keyword.

·     The apply comm-list delete clause configured on the current node cannot delete the community attributes set by the apply community clauses of the preceding nodes.

To configure the continue clause:

 

Step

Command

Remarks

1.     Enter system view.

system-view

N/A

2.     Enter routing policy node view.

route-policy route-policy-name { deny | permit } node node-number

N/A

3.     Specify the next node to be matched.

continue [ node-number ]

By default, no continue clause is configured.

The specified next node must have a larger number than the current node.

 

Displaying and maintaining the routing policy

Execute display commands in any view and reset commands in user view.

 

Task

Command

Display IPv4 prefix list statistics.

display ip prefix-list [ name prefix-list-name ]

Display IPv6 prefix list statistics.

display ipv6 prefix-list [ name prefix-list-name ]

Display routing policy information.

display route-policy [ name route-policy-name ]

Clear IPv4 prefix list statistics.

reset ip prefix-list [ prefix-list-name ]

Clear IPv6 prefix list statistics.

reset ipv6 prefix-list [ prefix-list-name ]

 

Routing policy configuration example for IPv6 route redistribution

Network requirements

As shown in Figure 1:

·     Run RIPng on Switch A and Switch B.

·     Configure three static routes on Switch A.

·     On Switch A, apply a routing policy to redistribute static routes 20::/32 and 40::/32 and deny route 30::/32.

Figure 1 Network diagram

 

Configuration procedure

1.     Configure Switch A:

# Configure IPv6 addresses for VLAN-interface 100 and VLAN-interface 200.

<SwitchA> system-view

[SwitchA] interface vlan-interface 100

[SwitchA-Vlan-interface100] ipv6 address 10::1 32

[SwitchA-Vlan-interface100] quit

[SwitchA] interface vlan-interface 200

[SwitchA-Vlan-interface200] ipv6 address 11::1 32

[SwitchA-Vlan-interface200] quit

# Enable RIPng on VLAN-interface 100.

[SwitchA] interface vlan-interface 100

[SwitchA-Vlan-interface100] ripng 1 enable

[SwitchA-Vlan-interface100] quit

# Configure three static routes with next hop 11::2, and make sure the static routes are active.

[SwitchA] ipv6 route-static 20:: 32 11::2

[SwitchA] ipv6 route-static 30:: 32 11::2

[SwitchA] ipv6 route-static 40:: 32 11::2

# Configure a routing policy.

[SwitchA] ipv6 prefix-list a index 10 permit 30:: 32

[SwitchA] route-policy static2ripng deny node 0

[SwitchA-route-policy-static2ripng-0] if-match ipv6 address prefix-list a

[SwitchA-route-policy-static2ripng-0] quit

[SwitchA] route-policy static2ripng permit node 10

[SwitchA-route-policy-static2ripng-10] quit

# Enable RIPng and apply the routing policy to static route redistribution.

[SwitchA] ripng

[SwitchA-ripng-1] import-route static route-policy static2ripng

2.     Configure Switch B:

# Configure the IPv6 address for VLAN-interface 100.

<SwitchB> system-view

[SwitchB] interface vlan-interface 100

[SwitchB-Vlan-interface100] ipv6 address 10::2 32

# Enable RIPng.

[SwitchB] ripng

[SwitchB-ripng-1] quit

# Enable RIPng on VLAN-interface 100.

[SwitchB] interface vlan-interface 100

[SwitchB-Vlan-interface100] ripng 1 enable

[SwitchB-Vlan-interface100] quit

Verifying the configuration

# Display the RIPng routing table on Switch B.

[SwitchB] display ripng 1 route

   Route Flags: A - Aging, S - Suppressed, G - Garbage-collect

 ----------------------------------------------------------------

 

 Peer FE80::7D58:0:CA03:1 on Vlan-interface 100

 Destination 20::/32,

     via FE80::7D58:0:CA03:1, cost 1, tag 0, A, 8 secs

 Destination 40::/32,

     via FE80::7D58:0:CA03:1, cost 1, tag 0, A, 3 secs

 Local route

 Destination 10::/32,

     via ::, cost 0, tag 0, DOF

  • 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
新华三官网