06-Layer 3 - IP Routing Configuration Examples

HomeSupportSwitchesH3C S12500 Switch SeriesConfigure & DeployConfiguration ExamplesH3C S12500 Configuration Examples-Release1825P01-6W10006-Layer 3 - IP Routing Configuration Examples
02-S12500_IPv6_Policy-Based_Routing_Configuration_Examples

Introduction

This document provides IPv6 policy-based routing (PBR) configuration examples.

PBR is a routing mechanism based on user-defined policies. PBR enables you to use a policy based on the source address, destination address, IP precedence, protocol type, and other fields to route packets flexibly.

Prerequisites

The configuration examples in this document were created and verified in a lab environment, and all the devices were started with the factory default configuration. When you are working on a live network, make sure you understand the potential impact of every command on your network.

This document assumes that you have basic knowledge of H3C IPv6 PBR.

Example: Configuring IPv6 PBR

Network requirements

As shown in Figure 1, all packets received on GigaabitEthernet 5/0/47 are forwarded based on the routing table to the next hop 2004::2 by default.

Configure the device to meet the following requirements:

·     Packets received on GigaabitEthernet 5/0/47 with source IP address 2001::1 are forwarded to the next hop 2003::2. If the next hop is not reachable, packets are forwarded through the routing table.

·     Packets received on GigaabitEthernet 5/0/47 with source IP address 2002::1 are forwarded to the primary next hop 2005::2 or backup next hop 2003::2. If neither the primary nor the backup next hop is reachable, packets are forwarded through the routing table.

Figure 1 Network diagram

 

Software version used

This configuration example was created and verified on S12500-CMW520-R1825P01.

Configuration restrictions and guidelines

When you configure IPv6 PBR, follow these restrictions and guidelines:

·     Enable IPv6 on the device to implement IPv6 packet forwarding. By default, IPv6 is disabled on a device.

·     When you configure the action of redirecting traffic to a next hop, do not specify an IPv6 address in an IPv4 ACL rule, or specify an IPv4 address in an IPv6 ACL rule.

·     PBR takes precedence over destination-based routing.

Configuration procedures

1.     Configure IPv6 addresses for interfaces, as shown in Figure 1. (Details not shown.)

2.     Configure IPv6 PBR:

# Create ACL 3005 to match packets with source address 2001::1/64.

<DEVICE> system-view

[DEVICE] acl ipv6 number 3005

[DEVICE-acl6-adv-3005] rule 0 permit ipv6 source 2001::1/64

[DEVICE-acl6-adv-3005] quit

# Create ACL 3006 rule to match packets with source address 2002::1/64.

[DEVICE] acl ipv6 number 3006

[DEVICE-acl6-adv-3006] rule 0 permit ipv6 source 2002::1/64

[DEVICE-acl6-adv-3006] quit

# Configure Node 0 for policy pbr1 to redirect traffic matching ACL 3005 to the next hop 2003::2.

[DEVICE] ipv6 policy-based-route pbr1 permit node 0

[DEVICE-pbr6-pbr1-0] if-match acl6 3005

[DEVICE-pbr6-pbr1-0] apply ipv6-address next-hop 2003::2

[DEVICE-pbr6-pbr1-0]quit

# Configure Node 1 for policy pbr1 to redirect traffic matching ACL 3006 to the primary next hop 2005::2 or backup next hop 2003::2. If neither the primary nor the backup next hop is reachable, packets will be forwarded through the routing table.

[DEVICE] ipv6 policy-based-route pbr1 permit node 1

[DEVICE-pbr6-pbr1-1] if-match acl6 3006

[DEVICE-pbr6-pbr1-1] apply ipv6-address next-hop 2005::2

[DEVICE-pbr6-pbr1-1] apply ipv6-address next-hop 2003::2

[DEVICE-pbr6-pbr1-1] quit

# Apply policy pbr1 to the inbound interface VLAN-interface 2.

[DEVICE] interface vlan-interface 2

[DEVICE-Vlan-interface2] ipv6 policy-based-route pbr1

[DEVICE-Vlan-interface2] quit

Verifying the configuration

# Verify packet forwarding on the device:

·     If both 2003::2 and 2005::2 are reachable, packets are forwarded in the following way:

?     Packets with source IP address 2001::1 are redirected to the next hop 2003::2.

?     Packets with source IP address 2002::1 are redirected to the next hop 2005::2.

·     If 2003::2 is reachable but 2005::2 is not reachable, packets are forwarded in the following way:

?     Packets with source IP address 2001::1 are redirected to the next hop 2003::2.

?     Packets with source IP address 2002::1 are redirected to the next hop 2003::2.

·     If 2005::2 is reachable but 2003::2 is not reachable, packets are forwarded in the following way:

?     Packets with source IP address 2001::1 are forwarded through the routing table to the next hop 2004::2.

?     Packets with source IP address 2002::1 are redirected to the next hop 2005::2.

·     If neither 2003::2 nor 2005::2 is reachable, packets are forwarded in the following way:

?     Packets with source IP address 2001::1 are forwarded through the routing table to the next hop 2004::2.

?     Packets with source IP address 2002::1 are forwarded through the routing table to the next hop 2004::2.

Configuration files

[DEVICE] display current-configuration

#

 ipv6

#

acl ipv6 number 3005

 rule 0 permit ipv6 source 2001::1/64

acl ipv6 number 3006

 rule 0 permit ipv6 source 2002::1/64

#

interface Vlan-interface2

 ipv6 address 2007::1/64

 ipv6 policy-based-route pbr1

#

interface Vlan-interface3

 ipv6 address 2003::1/64

#

interface Vlan-interface4

 ipv6 address 2004::1/64

#

interface Vlan-interface5

 ipv6 address 2005::1/64

#

interface GigabitEthernet5/0/3

 port link-mode bridge

 port access vlan 3

#

interface GigabitEthernet5/0/4

 port link-mode bridge

 port access vlan 4

#

interface GigabitEthernet5/0/47

 port link-mode bridge

 port access vlan 2

#

interface GigabitEthernet5/0/48

 port link-mode bridge

 port access vlan 5

#

ipv6 policy-based-route pbr1 permit node 0

 if-match acl6 3005

 apply ipv6-address next-hop 2003::2

ipv6 policy-based-route pbr1 permit node 1

 if-match acl6 3006

 apply ipv6-address next-hop 2005::2

 apply ipv6-address next-hop 2003::2

#

return

Related documentation

·     H3C S12500 Routing Switch Series Layer 3IP Routing Configuration Guide

·     H3C S12500 Routing Switch Series Layer 3IP Routing Command Reference

  • Cloud & AI
  • InterConnect
  • Intelligent Computing
  • Security
  • SMB Products
  • Intelligent Terminal Products
  • Product Support Services
  • Technical Service Solutions
All Services
  • Resource Center
  • Policy
  • Online Help
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
新华三官网