• 产品与解决方案
  • 行业解决方案
  • 服务
  • 支持
  • 合作伙伴
  • 新华三人才研学中心
  • 关于我们

H3C S12500R系列交换路由器 典型配置举例-Release 36xx系列-6W100

目录

25-MPLS L3VPN典型配置举例

本章节下载 25-MPLS L3VPN典型配置举例  (446.03 KB)

docurl=/cn/Service/Document_Software/Document_Center/Switches/Catalog/S12500/S12500R/Configure/Typical_Configuration_Example/H3C_S12500R_CE_36xx/202104/1400503_30005_0.htm

25-MPLS L3VPN典型配置举例

H3C S12500R产品MPLS L3VPN典型配置举例

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Copyright © 2021 新华三技术有限公司 版权所有,保留一切权利。

非经本公司书面许可,任何单位和个人不得擅自摘抄、复制本文档内容的部分或全部,并不得以任何形式传播。

除新华三技术有限公司的商标外,本手册中出现的其它公司的商标、产品标识及商品名称,由各自权利人拥有。

本文档中的信息可能变动,恕不另行通知。



1  简介

本文介绍了通过MPLS L3VPN技术提供VPN服务的典型配置举例。

2  配置前提

本文档中的配置均是在实验室环境下进行的配置和验证,配置前设备的所有参数均采用出厂时的缺省配置。如果您已经对设备进行了配置,为了保证配置效果,请确认现有配置和以下举例中的配置不冲突。

本文档假设您已了解MPLS L3VPN特性。

3  MPLS L3VPN典型配置举例

3.1  组网需求

图1所示,Customer A和Customer B分别有位于两地的分支机构,现要求通过MPLS L3VPN技术,实现用户分支机构间路由信息的正常交互,且用户数据可以通过VPN方式在各站点间安全传输,不会发送至私网IP地址相同的其它用户站点中。

图1 MPLS L3VPN基本组网图

 

3.2  配置思路

·     为了使报文能够通过MPLS网络传输,需要在MPLS骨干网络中配置IGP路由协议,并利用LDP分发公网标签,作为VPN报文的外层标签。

·     为区分不同用户的路由信息,需要在PE上分别创建两个VPN实例,并为VPN实例配置RD和RT,在各实例内通过BGP分别引入不同用户的私网路由。

·     在PE设备之间配置MP-BGP协议并建立对等体,用于传输VPN的私网路由信息并分发内层标签,即私网标签。

3.3  使用版本

本举例是在R3606版本上进行配置和验证的。

3.4  配置注意事项

由于在配置接口与VPN实例绑定后,接口上的IP地址等配置会清除,因此先配置接口与VPN实例的绑定关系,再进行其他配置。

3.5  配置步骤

1. 在MPLS骨干网上配置IGP协议(本例为OSPF协议),实现骨干网PE和P的互通

(1)     配置PE 1

# 配置骨干网接口以及环回口地址。

<PE1> system-view

[PE1] interface loopback 0

[PE1-LoopBack0] ip address 1.1.1.9 32

[PE1-LoopBack0] quit

[PE1] interface hundredgige 1/0/2

[PE1-HundredGigE1/0/2] ip address 10.1.1.1 24

[PE1-HundredGigE1/0/2] quit

# 配置OSPF协议发布骨干网侧路由。

[PE1] ospf

[PE1-ospf-1] area 0

[PE1-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255

[PE1-ospf-1-area-0.0.0.0] network 1.1.1.9 0.0.0.0

[PE1-ospf-1-area-0.0.0.0] quit

[PE1-ospf-1] quit

(2)     配置P

# 配置骨干网接口以及环回口地址。

<P> system-view

[P] interface loopback 0

[P-LoopBack0] ip address 2.2.2.9 32

[P-LoopBack0] quit

[P] interface hundredgige 1/0/2

[P-HundredGigE1/0/2] ip address 10.1.1.2 24

[P-HundredGigE1/0/2] quit

[P] interface hundredgige 1/0/3

[P-HundredGigE1/0/3] ip address 10.1.4.1 24

[P-HundredGigE1/0/3] quit

# 配置OSPF协议发布骨干网侧路由。

[P] ospf

[P-ospf-1] area 0

[P-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255

[P-ospf-1-area-0.0.0.0] network 10.1.4.0 0.0.0.255

[P-ospf-1-area-0.0.0.0] network 2.2.2.9 0.0.0.0

[P-ospf-1-area-0.0.0.0] quit

[P-ospf-1] quit

(3)      配置PE 2

# 配置骨干网接口以及环回口地址。

<PE2> system-view

[PE2] interface loopback 0

[PE2-LoopBack0] ip address 3.3.3.9 32

[PE2-LoopBack0] quit

[PE2] interface hundredgige 1/0/1

[PE2-HundredGigE1/0/1] ip address 10.1.4.2 24

[PE2-HundredGigE1/0/1] quit

# 配置OSPF协议发布骨干网侧路由。

[PE2] ospf

[PE2-ospf-1] area 0

[PE2-ospf-1-area-0.0.0.0] network 10.1.4.0 0.0.0.255

[PE2-ospf-1-area-0.0.0.0] network 3.3.3.9 0.0.0.0

[PE2-ospf-1-area-0.0.0.0] quit

[PE2-ospf-1] quit

配置完成后,PE 1、P、PE 2之间应能建立OSPF邻居,执行display ospf peer命令可以看到邻居达到Full状态。执行display ip routing-table命令可以看到PE之间学习到对方的Loopback路由。

以PE 1为例:

[PE1] display ospf peer verbose

 

          OSPF Process 1 with Router ID 1.1.1.9

                  Neighbors

 

 Area 0.0.0.0 interface 10.1.1.1(HundredGigE1/0/2)'s neighbors

 Router ID: 2.2.2.9          Address: 10.1.1.2        GR State: Normal

   State: Full  Mode: Nbr is Master  Priority: 1

   DR: 10.1.1.2  BDR: 10.1.1.1  MTU: 0

   Options is 0x02 (-|-|-|-|-|-|E|-)

   Dead timer due in 38  sec

   Neighbor is up for 17:30:25

   Authentication Sequence: [ 0 ]

   Neighbor state change count: 6

   BFD status: Disabled

[PE1] display ip routing-table protocol ospf

 

Summary Count : 5

 

OSPF Routing table Status : <Active>

Summary Count : 3

 

Destination/Mask    Proto  Pre  Cost         NextHop         Interface

2.2.2.9/32          OSPF   10   1            10.1.1.2        HGE1/0/2

3.3.3.9/32          OSPF   10   2            10.1.1.2        HGE1/0/2

10.1.4.0/24         OSPF   10   2            10.1.1.2        HGE1/0/2

 

OSPF Routing table Status : <Inactive>

Summary Count : 2

 

Destination/Mask    Proto  Pre  Cost         NextHop         Interface

1.1.1.9/32          OSPF   10   0            1.1.1.9         Loop0

10.1.1.0/24         OSPF   10   1            10.1.1.1        HGE1/0/2

2. 在MPLS骨干网上配置MPLS基本能力和MPLS LDP,建立LDP LSP

(1)     配置PE 1

[PE1] mpls lsr-id 1.1.1.9

[PE1] mpls ldp

[PE1-ldp] quit

[PE1] interface hundredgige 1/0/2

[PE1-HundredGigE1/0/2] mpls enable

[PE1-HundredGigE1/0/2] mpls ldp enable

[PE1-HundredGigE1/0/2] quit

(2)     配置P

[P] mpls lsr-id 2.2.2.9

[P] mpls ldp

[P-ldp] quit

[P] interface hundredgige 1/0/2

[P-HundredGigE1/0/2] mpls enable

[P-HundredGigE1/0/2] mpls ldp enable

[P-HundredGigE1/0/2] quit

[P] interface hundredgige 1/0/3

[P-HundredGigE1/0/3] mpls enable

[P-HundredGigE1/0/3] mpls ldp enable

[P-HundredGigE1/0/3] quit

(3)     配置PE 2

[PE2] mpls lsr-id 3.3.3.9

[PE2] mpls ldp

[PE2-ldp] quit

[PE2] interface hundredgige 1/0/1

[PE2-HundredGigE1/0/1] mpls enable

[PE2-HundredGigE1/0/1] mpls ldp enable

[PE2-HundredGigE1/0/1] quit

上述配置完成后,PE 1、P、PE 2之间应能建立LDP会话,执行display mpls ldp peer命令可以看到LDP会话的状态为Operational。执行display mpls ldp lsp命令,可以看到LDP LSP的建立情况。

以PE 1为例:

[PE1] display mpls ldp peer

Total number of peers: 1

Peer LDP ID             State         Role     GR   MD5  KA Sent/Rcvd

2.2.2.9:0               Operational   Passive  Off  Off  5/5

[PE1] display mpls ldp lsp

Status Flags: * - stale, L - liberal, B - backup

FECs: 4            Ingress: 1          Transit: 1      Egress: 3

 

FEC                In/Out Label        Nexthop         OutInterface/LSINDEX

1.1.1.9/32         3/-

                   -/1151(L)

2.2.2.9/32         -/3                 10.1.1.2        HGE1/0/2

                   1151/3              10.1.1.2        HGE1/0/2

3.3.3.9/32         -/1150              10.1.1.2        HGE1/0/2

                   1150/1150           10.1.1.2        HGE1/0/2

3. 在PE设备上配置VPN实例,将CE接入PE

(1)     配置PE 1

# 在PE 1上为Customer A创建VPN实例,名为“customerA”。

[PE1] ip vpn-instance customerA

# 为该实例配置RD为100:1,用于形成VPNv4路由,以便区分不同用户相同网段的路由。

[PE1-vpn-instance-customerA] route-distinguisher 100:1

# 为该VPN实例配置VPN Target属性,其中接收路由的属性为111:1,发布路由的属性为222:1。(此处为表示接收和发送属性的含义,取值有所不同,为便于管理,用户可以将接收和发送的属性配置为相同的值)

[PE1-vpn-instance-customerA] vpn-target 111:1 import-extcommunity

[PE1-vpn-instance-customerA] vpn-target 222:1 export-extcommunity

[PE1-vpn-instance-customerA] quit

# 按同样方式为Customer B创建VPN实例,名为“customerB”,并为其配置RD为200:1,接收和发送的VPN Target属性分别为333:1和444:1。

[PE1] ip vpn-instance customerB

[PE1-vpn-instance-customerB] route-distinguisher 200:1

[PE1-vpn-instance-customerB] vpn-target 333:1 import-extcommunity

[PE1-vpn-instance-customerB] vpn-target 444:1 export-extcommunity

[PE1-vpn-instance-customerB] quit

# 配置HundredGigE1/0/1与VPN实例customerA进行绑定。

[PE1] interface hundredgige 1/0/1

[PE1-HundredGigE1/0/1] ip binding vpn-instance customerA

[PE1-HundredGigE1/0/1] ip address 100.1.1.2 24

[PE1-HundredGigE1/0/1] quit

# 配置HundredGigE1/0/3与VPN实例customerB进行绑定。

[PE1] interface hundredgige 1/0/3

[PE1-HundredGigE1/0/3] ip binding vpn-instance customerB

[PE1-HundredGigE1/0/3] ip address 200.1.1.2 24

[PE1-HundredGigE1/0/3] quit

(2)     配置PE 2

# 在PE 2上为Customer A创建VPN实例,名为“customerA”。

[PE2] ip vpn-instance customerA

# 为该VPN实例配置RD,为便于识别,建议与PE 1上为该实例配置的RD保持一致。

[PE2-vpn-instance-customerA] route-distinguisher 100:1

# 为该VPN实例配置VPN Target,需要注意的是接收和发送的属性要分别与PE 1上配置的发送和接收的属性保持一致。

[PE2-vpn-instance-customerA] vpn-target 222:1 import-extcommunity

[PE2-vpn-instance-customerA] vpn-target 111:1 export-extcommunity

[PE2-vpn-instance-customerA] quit

# 按同样方式配置VPN实例“customerB”,并配置相应的RD和VPN Target。

[PE2] ip vpn-instance customerB

[PE2-vpn-instance-customerB] route-distinguisher 200:1

[PE2-vpn-instance-customerB] vpn-target 444:1 import-extcommunity

[PE2-vpn-instance-customerB] vpn-target 333:1 export-extcommunity

[PE2-vpn-instance-customerB] quit

# 分别将HundredGigE1/0/2和HundredGigE1/0/3与customerA和customerB实例进行绑定。

[PE2] interface hundredgige 1/0/2

[PE2-HundredGigE1/0/2] ip binding vpn-instance customerA

[PE2-HundredGigE1/0/2] ip address 101.1.1.1 24

[PE2-HundredGigE1/0/2] quit

[PE2] interface hundredgige 1/0/3

[PE2-HundredGigE1/0/3] ip binding vpn-instance customerB

[PE2-HundredGigE1/0/3] ip address 202.1.1.2 24

[PE2-HundredGigE1/0/3] quit

(3)     配置CE

图1配置各CE的接口IP地址,配置过程略。

配置完成后,在PE设备上执行display ip vpn-instance命令可以看到VPN实例的配置情况。各PE能ping通自己接入的CE。

以PE 1和CE 1为例:

[PE1] display ip vpn-instance

  Total VPN-Instances configured : 2

  Total IPv4 VPN-Instances configured : 1

  Total IPv6 VPN-Instances configured : 1

  Total IPv4 VPN-Instances EVPN configured : 0

  Total IPv6 VPN-Instances EVPN configured : 0

  VPN-Instance Name     RD              Address family      Create time

  customerA             100:1           IPv4/IPv6/EVPN      2020/03/22 13:20:08

  customerB             200:1           IPv4/IPv6/EVPN      2020/03/22 13:20:20

[PE1] ping -vpn-instance customerA 100.1.1.1

Ping 100.1.1.1 (100.1.1.1): 56 data bytes, press CTRL_C to break

56 bytes from 100.1.1.1: icmp_seq=0 ttl=255 time=1.000 ms

56 bytes from 100.1.1.1: icmp_seq=1 ttl=255 time=2.000 ms

56 bytes from 100.1.1.1: icmp_seq=2 ttl=255 time=0.000 ms

56 bytes from 100.1.1.1: icmp_seq=3 ttl=255 time=1.000 ms

56 bytes from 100.1.1.1: icmp_seq=4 ttl=255 time=0.000 ms

 

--- Ping statistics for 100.1.1.1 in VPN instance customerA ---

5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss

round-trip min/avg/max/std-dev = 0.000/0.800/2.000/0.748 ms

4. 在PE与CE之间建立EBGP对等体,引入VPN路由

(1)     配置PE 1

# 在PE 1上创建BGP进程100。

[PE1] bgp 100

# 将CE 1指定为对等体,并将PE 1的直连路由引入到BGP-VPN实例路由表中。

[PE1-bgp-default] ip vpn-instance customerA

[PE1-bgp-default-customerA] peer 100.1.1.1 as-number 65410

[PE1-bgp-default-customerA] address-family ipv4 unicast

[PE1-bgp-default-ipv4-customerA] peer 100.1.1.1 enable

[PE1-bgp-default-ipv4-customerA] import-route direct

[PE1-bgp-default-ipv4-customerA] quit

[PE1-bgp-default-customerA] quit

# 将CE 2指定为对等体,并将PE 1的直连路由引入到BGP-VPN实例路由表中。

[PE1-bgp-default] ip vpn-instance customerB

[PE1-bgp-default-customerB] peer 200.1.1.1 as-number 65410

[PE1-bgp-default-customerB] address-family ipv4 unicast

[PE1-bgp-default-ipv4-customerB] peer 200.1.1.1 enable

[PE1-bgp-default-ipv4-customerB] import-route direct

[PE1-bgp-default-ipv4-customerB] quit

[PE1-bgp-default-customerB] quit

[PE1-bgp-default] quit

(2)     配置PE 2

# 在PE 2上创建BGP进程100。

[PE2] bgp 100

# 将CE 3指定为对等体,并将PE 2的直连路由引入到BGP-VPN实例路由表中。

[PE2-bgp-default] ip vpn-instance customerA

[PE2-bgp-default-customerA] peer 101.1.1.2 as-number 65430

[PE2-bgp-default-customerA] address-family ipv4 unicast

[PE2-bgp-default-ipv4-customerA] peer 101.1.1.2 enable

[PE2-bgp-default-ipv4-customerA] import-route direct

[PE2-bgp-default-ipv4-customerA] quit

[PE2-bgp-default-customerA] quit

# 将CE 4指定为对等体,并将PE 2的直连路由引入到BGP-VPN实例路由表中。

[PE2-bgp-default] ip vpn-instance customerB

[PE2-bgp-default-customerB] peer 202.1.1.1 as-number 65430

[PE2-bgp-default-customerB] address-family ipv4 unicast

[PE2-bgp-default-ipv4-customerB] peer 202.1.1.1 enable

[PE2-bgp-default-ipv4-customerB] import-route direct

[PE2-bgp-default-ipv4-customerB] quit

[PE2-bgp-default-customerB] quit

[PE2-bgp-default] quit

(3)     配置CE1

# CE 1上创建BGP进程65410,并指定PE 1为对等体,对等体自治系统号为100。

<CE1> system-view

[CE1] bgp 65410

[CE1-bgp-default] peer 100.1.1.2 as-number 100

# 使能CE1与对等体100.1.1.2交换IPv4单播路由信息的能力。

[CE1-bgp-default] address-family ipv4 unicast

[CE1-bgp-default-ipv4] peer 100.1.1.2 enable

# 将CE 1上连接站点的直连接口路由引入EBGP。

[CE1-bgp-default-ipv4] import-route direct

[CE1-bgp-default-ipv4] quit

[CE1-bgp-default] quit

(4)     配置CE2

# CE 2上创建BGP进程65410,并指定PE 1为对等体,对等体自治系统号为100。

<CE2> system-view

[CE2] bgp 65410

[CE2-bgp-default] peer 200.1.1.2 as-number 100

# 使能CE2与对等体200.1.1.2交换IPv4单播路由信息的能力。

[CE2-bgp-default] address-family ipv4 unicast

[CE2-bgp-default-ipv4] peer 200.1.1.2 enable

# 将CE 2上连接站点的直连接口路由引入EBGP。

[CE2-bgp-default-ipv4] import-route direct

[CE2-bgp-default-ipv4] quit

[CE2-bgp-default] quit

(5)     配置CE3

# CE 3上创建BGP进程65430,并指定PE 2为对等体,对等体自治系统号为100。

<CE3> system-view

[CE3] bgp 65430

[CE3-bgp-default] peer 101.1.1.1 as-number 100

# 使能CE3与对等体101.1.1.1交换IPv4单播路由信息的能力。

[CE3-bgp-default] address-family ipv4 unicast

[CE3-bgp-default-ipv4] peer 101.1.1.1 enable

# 将CE 3上连接站点的直连接口路由引入EBGP。

[CE3-bgp-default-ipv4] import-route direct

[CE3-bgp-default-ipv4] quit

[CE3-bgp-default] quit

(6)     配置CE4

# CE4上创建BGP进程65430,并指定PE 2为对等体,对等体自治系统号为100。

<CE4> system-view

[CE4] bgp 65430

[CE4-bgp-default] peer 202.1.1.2 as-number 100

# 使能CE4与对等体202.1.1.2交换IPv4单播路由信息的能力。

[CE4-bgp-default] address-family ipv4 unicast

[CE4-bgp-default-ipv4] peer 202.1.1.2 enable

# 将CE 4上连接站点的直连接口路由引入EBGP。

[CE4-bgp-default-ipv4] import-route direct

[CE4-bgp-default-ipv4] quit

[CE4-bgp-default] quit

配置完成后,在PE设备上执行display bgp peer ipv4 vpn-instance命令,可以看到PE与CE之间的BGP对等体关系已建立,并达到Established状态。

以PE 1与CE 1的对等体关系为例:

[PE1] display bgp peer ipv4 vpn-instance customerA

 

 BGP local router ID: 1.1.1.9

 Local AS number: 100

 Total number of peers: 1                  Peers in established state: 1

 

 * - Dynamically created peer

  Peer                    AS  MsgRcvd  MsgSent OutQ PrefRcv Up/Down  State

 

  100.1.1.1            65410        4        4    0       2 13:35:25 Established

5. 在PE之间建立MP-IBGP对等体

(1)     配置PE 1

# 在PE 1上配置PE 2为BGP对等体,并指定连接时使用的接口为Loopback0接口。

[PE1] bgp 100

[PE1-bgp-default] peer 3.3.3.9 as-number 100

[PE1-bgp-default] peer 3.3.3.9 connect-interface loopback 0

# 进入BGP-VPNv4地址族视图,指定PE 2为对等体。

[PE1-bgp-default] address-family vpnv4

[PE1-bgp-default-vpnv4] peer 3.3.3.9 enable

[PE1-bgp-default-vpnv4] quit

[PE1-bgp-default] quit

(2)     配置PE 2

# 在PE 2上配置PE 1为BGP对等体,并指定连接时使用的接口为Loopback0接口。

[PE2] bgp 100

[PE2-bgp-default] peer 1.1.1.9 as-number 100

[PE2-bgp-default] peer 1.1.1.9 connect-interface loopback 0

# 进入BGP-VPNv4地址族视图,指定PE 1为对等体。

[PE2-bgp-default] address-family vpnv4

[PE2-bgp-default-vpnv4] peer 1.1.1.9 enable

[PE2-bgp-default-vpnv4] quit

[PE2-bgp-default] quit

配置完成后,在PE设备上执行display bgp peer vpnv4命令,可以看到PE之间的BGP对等体关系已建立,并达到Established状态。

[PE1] display bgp peer vpnv4

 

 BGP local router ID: 1.1.1.9

 Local AS number: 100

 Total number of peers: 1                  Peers in established state: 1

 

  * - Dynamically created peer

  Peer                    AS  MsgRcvd  MsgSent OutQ PrefRcv Up/Down  State

 

  3.3.3.9                100        8        8    0       0 00:00:08 Established

3.6  验证配置

在PE设备上执行display ip routing-table vpn-instance命令,可以看到去往对端CE的路由。

以PE 1上的customerA为例:

[PE1] display ip routing-table vpn-instance customerA

 

Destinations : 13        Routes : 13

 

Destination/Mask    Proto  Pre  Cost         NextHop         Interface

0.0.0.0/32          Direct 0    0            127.0.0.1       InLoop0

100.1.1.0/24        Direct 0    0            100.1.1.2       HGE1/0/1

100.1.1.0/32        Direct 0    0            100.1.1.2       HGE1/0/1

100.1.1.2/32        Direct 0    0            127.0.0.1       InLoop0

100.1.1.255/32      Direct 0    0            100.1.1.2       HGE1/0/1

101.1.1.0/24        BGP    255  0            3.3.3.9         HGE1/0/2

127.0.0.0/8         Direct 0    0            127.0.0.1       InLoop0

127.0.0.0/32        Direct 0    0            127.0.0.1       InLoop0

127.0.0.1/32        Direct 0    0            127.0.0.1       InLoop0

127.255.255.255/32  Direct 0    0            127.0.0.1       InLoop0

224.0.0.0/4         Direct 0    0            0.0.0.0         NULL0

224.0.0.0/24        Direct 0    0            0.0.0.0         NULL0

255.255.255.255/32  Direct 0    0            127.0.0.1       InLoop0

同一VPN的CE能够相互Ping通,不同VPN的CE不能相互Ping通。

例如:CE1能够Ping通CE 3(101.1.1.2),但不能Ping通CE 4(202.1.1.1)。

3.7  配置文件

·     PE 1

#

ip vpn-instance customerA

 route-distinguisher 100:1

 vpn-target 111:1 import-extcommunity

 vpn-target 222:1 export-extcommunity

#

ip vpn-instance customerB

 route-distinguisher 200:1

 vpn-target 333:1 import-extcommunity

 vpn-target 444:1 export-extcommunity

#

ospf 1

 area 0.0.0.0

  network 1.1.1.9 0.0.0.0

  network 10.1.1.0 0.0.0.255

#

 mpls lsr-id 1.1.1.9

#

mpls ldp

#

interface LoopBack0

 ip address 1.1.1.9 255.255.255.255

#

interface HundredGigE1/0/1

 port link-mode route

 ip binding vpn-instance customerA

 ip address 100.1.1.2 255.255.255.0

#

interface HundredGigE1/0/2

 port link-mode route

 ip address 10.1.1.1 255.255.255.0

 mpls enable

 mpls ldp enable

#

interface HundredGigE1/0/3

 port link-mode route

 ip binding vpn-instance customerB

 ip address 200.1.1.2 255.255.255.0

#

bgp 100

 peer 3.3.3.9 as-number 100

 peer 3.3.3.9 connect-interface LoopBack0

 #

 address-family vpnv4

  peer 3.3.3.9 enable

 #

 ip vpn-instance customerA

  peer 100.1.1.1 as-number 65410

  #

  address-family ipv4 unicast

   import-route direct

   peer 100.1.1.1 enable

 #

 ip vpn-instance customerB

  peer 200.1.1.1 as-number 65410

  #

  address-family ipv4 unicast

   import-route direct

   peer 200.1.1.1 enable

#

·     P

#

ospf 1

 area 0.0.0.0

  network 2.2.2.9 0.0.0.0

  network 10.1.1.0 0.0.0.255

  network 10.1.4.0 0.0.0.255

#

 mpls lsr-id 2.2.2.9

#

mpls ldp

#

interface LoopBack0

 ip address 2.2.2.9 255.255.255.255

#

interface HundredGigE1/0/2

 port link-mode route

 ip address 10.1.1.2 255.255.255.0

 mpls enable

 mpls ldp enable

#

interface HundredGigE1/0/3

 port link-mode route

 ip address 10.1.4.1 255.255.255.0

 mpls enable

 mpls ldp enable

#

·     PE 2

#

ip vpn-instance customerA

 route-distinguisher 100:1

 vpn-target 111:1 export-extcommunity

 vpn-target 222:1 import-extcommunity

#

ip vpn-instance customerB

 route-distinguisher 200:1

 vpn-target 333:1 export-extcommunity

 vpn-target 444:1 import-extcommunity

#

ospf 1

 area 0.0.0.0

  network 10.1.4.0 0.0.0.255

  network 3.3.3.9 0.0.0.0

#

 mpls lsr-id 3.3.3.9

#

mpls ldp

#

interface LoopBack0

 ip address 3.3.3.9 255.255.255.255

#

interface HundredGigE1/0/1

 port link-mode route

 ip address 10.1.4.2 255.255.255.0

 mpls enable

 mpls ldp enable

#

interface HundredGigE1/0/2

 port link-mode route

 ip binding vpn-instance customerA

 ip address 101.1.1.1 255.255.255.0

#

interface HundredGigE1/0/3

 port link-mode route

 ip binding vpn-instance customerB

 ip address 202.1.1.2 255.255.255.0

#

bgp 100

 peer 1.1.1.9 as-number 100

 peer 1.1.1.9 connect-interface LoopBack0

 #

 address-family vpnv4

  peer 1.1.1.9 enable

 #

 ip vpn-instance customerA

  peer 101.1.1.2 as-number 65430

  #

  address-family ipv4 unicast

   import-route direct

   peer 101.1.1.2 enable

 #

 ip vpn-instance customerB

  peer 202.1.1.1 as-number 65430

  #

  address-family ipv4 unicast

   import-route direct

   peer 202.1.1.1 enable

#

·     CE 1

#

interface HundredGigE1/0/1

 port link-mode route

 ip address 100.1.1.1 255.255.255.0

#

bgp 65410

 peer 100.1.1.2 as-number 100

 #

 address-family ipv4 unicast

  import-route direct

  peer 100.1.1.2 enable

#

·     CE 2

#

interface HundredGigE1/0/1

 port link-mode route

 ip address 200.1.1.1 255.255.255.0

#

bgp 65410

 peer 200.1.1.2 as-number 100

 #

 address-family ipv4 unicast

  import-route direct

  peer 200.1.1.2 enable

#

·     CE 3

#

interface HundredGigE1/0/1

 port link-mode route

 ip address 101.1.1.2 255.255.255.0

#

bgp 65430

 peer 101.1.1.1 as-number 100

 #

 address-family ipv4 unicast

  import-route direct

  peer 101.1.1.1 enable

#

·     CE 4

#

interface HundredGigE1/0/1

 port link-mode route

 ip address 202.1.1.1 255.255.255.0

#

bgp 65430

 peer 202.1.1.2 as-number 100

 #

 address-family ipv4 unicast

  import-route direct

  peer 202.1.1.2 enable

#

4  HoVPN典型配置举例

在MPLS L3VPN网络中,PE设备起到了最为关键的作用,不仅需要负责VPN用户的接入,同时也负责VPN路由的管理和维护,以及私网报文的转发工作。这就对PE设备的性能有了非常高的要求,从而导致网络的扩展性受到限制。

HoVPN(Hierarchy of VPN,分层VPN)将PE设备的功能分布到多台设备,多台设备承担不同的角色,并形成层次结构,共同完成一个PE的功能。HoVPN对不同角色的设备的性能要求也不相同,从而使网络具备了良好的可扩展性。

在HoVPN组网下,直接连结用户的设备称为UPE(Underlayer PE or User-end PE,下层PE或用户侧PE);连结UPE并位于网络内部的设备称为SPE(Superstratum PE or Service Provider-end PE,上层PE或运营商侧PE)。UPE与SPE构成分层式PE,共同完成传统上一个PE的功能。

SPE与UPE的分工是:

·     UPE主要完成用户接入功能。UPE维护其直接相连的VPN Site的路由,但不维护VPN中其它远程Site的路由或仅维护它们的聚合路由;UPE为其直接相连的Site的路由分配内层标签,并通过MP-BGP随VPN路由发布此标签给SPE。

·     SPE主要完成VPN路由的管理和发布。SPE维护其通过UPE连接的VPN所有路由,包括本地和远程Site的路由,SPE将路由信息发布给UPE,并携带标签。SPE发布的路由信息可以是VPN实例的缺省路由(或聚合路由),也可以是通过路由策略的路由信息。通过后者可以实现对同一VPN下不同站点之间互访的控制。

图2所示,UPE与连接用户的CE设备相连,并与运营商内部的SPE设备相连,图中为路由和标签交换过程,其中,Lx和Lz为UPE与SPE之间的公网的标签,Ly为运营商骨干网的公网的标签。

图2 HoVPN组网路由和标签交换图

 

4.1  组网需求

图3所示,SPE设备处于AS 100中,UPE设备处于AS 200中,SPE为运营商骨干网设备,UPE为连接用户端CE的设备。UPE 1和UPE 2分别连接属于VPN 1的CE 1和CE 2。CE 1连接两个接口,分别为:HundredGigE1/0/1(172.16.1.0/24)和HundredGigE1/0/3(172.16.2.0/24);CE 2下连一个接口:HundredGigE1/0/1(172.16.3.0/24)。

现要求在用户网络中部署HoVPN服务,并通过配置路由策略,限制不同CE下连接口之间的互相访问权限,使得CE 1的HundredGigE1/0/1和CE 2的HundredGigE1/0/1可以相互访问,CE 1的HundredGigE1/0/3和CE 2的HundredGigE1/0/1不能相互访问。

图3 HoVPN典型配置举例组网图

 

4.2  配置思路

此案例配置主要分为两部分:

·     在网络中配置HoVPN服务。

·     在SPE设备上配置路由策略,使得SPE2仅发布CE1的私网路由172.16.1.0/24给UPE2。

4.3  使用版本

本举例是在R3606版本上进行配置和验证的。

4.4  配置注意事项

·     只有在SPE设备上配置了路由策略,并允许向UPE设备发布路由时,SPE设备才会向UPE设备发布路由,即,在HoVPN组网中,路由策略为必选配置。

·     配置SPE与UPE之间建立EBGP对等体并发布标签时,仅使能与对等体交换标签的能力并不能进行标签的发布,还需配置路由策略才可为对等体发布标签。

·     由于在配置接口与VPN实例绑定后,接口上的IP地址等配置会清除,因此先配置接口与VPN实例的绑定关系,再进行其他配置。

4.5  配置步骤

1. 在SPE设备上使能MPLS和MPLS LDP功能,并配置OSPF作为IGP协议

(1)     配置SPE 1

# 配置MPLS基本能力和MPLS LDP能力,建立LDP LSP。

<SPE1> system-view

[SPE1] interface loopback 0

[SPE1-LoopBack0] ip address 2.2.2.9 32

[SPE1-LoopBack0] quit

[SPE1] mpls lsr-id 2.2.2.9

[SPE1] mpls ldp

[SPE1-ldp] quit

[SPE1] interface hundredgige 1/0/1

[SPE1-HundredGigE1/0/1] ip address 172.1.1.2 24

[SPE1-HundredGigE1/0/1] mpls enable

[SPE1-HundredGigE1/0/1] quit

[SPE1] interface hundredgige 1/0/2

[SPE1-HundredGigE1/0/2] ip address 180.1.1.1 24

[SPE1-HundredGigE1/0/2] mpls enable

[SPE1-HundredGigE1/0/2] mpls ldp enable

[SPE1-HundredGigE1/0/2] quit

# 配置OSPF作为IGP协议。

[SPE1] ospf

[SPE1-ospf-1] area 0

[SPE1-ospf-1-area-0.0.0.0] network 2.2.2.9 0.0.0.0

[SPE1-ospf-1-area-0.0.0.0] network 180.1.1.0 0.0.0.255

[SPE1-ospf-1-area-0.0.0.0] quit

[SPE1-ospf-1] quit

(2)     配置SPE 2

# 配置MPLS基本能力和MPLS LDP能力,建立LDP LSP。

<SPE2> system-view

[SPE2] interface loopback 0

[SPE2-LoopBack0] ip address 3.3.3.9 32

[SPE2-LoopBack0] quit

[SPE2] mpls lsr-id 3.3.3.9

[SPE2] mpls ldp

[SPE2-ldp] quit

[SPE2] interface hundredgige 1/0/2

[SPE2-HundredGigE1/0/2] ip address 180.1.1.2 24

[SPE2-HundredGigE1/0/2] mpls enable

[SPE2-HundredGigE1/0/2] mpls ldp enable

[SPE2-HundredGigE1/0/2] quit

[SPE2] interface hundredgige 1/0/1

[SPE2-HundredGigE1/0/1] ip address 172.2.1.2 24

[SPE2-HundredGigE1/0/1] mpls enable

[SPE2-HundredGigE1/0/1] quit

# 配置OSPF作为IGP协议。

[SPE2] ospf

[SPE2-ospf-1] area 0

[SPE2-ospf-1-area-0.0.0.0] network 3.3.3.9 0.0.0.0

[SPE2-ospf-1-area-0.0.0.0] network 180.1.1.0 0.0.0.255

[SPE2-ospf-1-area-0.0.0.0] quit

[SPE2-ospf-1] quit

配置完成后,在SPE设备上执行display mpls ldp peer命令可以看到LDP会话建立成功,LDP会话状态为Operational;执行display ospf peer命令可以看到OSPF邻居关系已建立,状态为FULL。

2. 配置SPE之间建立MP-IBGP对等体,交换VPNv4路由

# 配置SPE 1与SPE 2建立MP-IBGP对等体,交换VPNv4路由。

[SPE1] bgp 100

[SPE1-bgp-default] peer 3.3.3.9 as-number 100

[SPE1-bgp-default] peer 3.3.3.9 connect-interface loopback 0

[SPE1-bgp-default] address-family vpnv4

[SPE1-bgp-default-vpnv4] peer 3.3.3.9 enable

[SPE1-bgp-default-vpnv4] quit

[SPE1-bgp-default] quit

# 配置SPE 2与SPE 1建立MP-IBGP对等体,交换VPNv4路由。

[SPE2] bgp 100

[SPE2-bgp-default] peer 2.2.2.9 as-number 100

[SPE2-bgp-default] peer 2.2.2.9 connect-interface loopback 0

[SPE2-bgp-default] address-family vpnv4

[SPE2-bgp-default-vpnv4] peer 2.2.2.9 enable

[SPE2-bgp-default-vpnv4] quit

[SPE2-bgp-default] quit

配置完成后,在SPE 1和SPE 2上执行display bgp peer vpnv4命令可以看到BGP对等体关系已建立,并达到Established状态。

3. 在UPE设备上使能MPLS功能

(1)     配置UPE 1

# 配置MPLS基本能力。

<UPE1> system-view

[UPE1] interface loopback 0

[UPE1-LoopBack0] ip address 1.1.1.9 32

[UPE1-LoopBack0] quit

[UPE1] mpls lsr-id 1.1.1.9

[UPE1] interface hundredgige 1/0/1

[UPE1-HundredGigE1/0/1] ip address 172.1.1.1 24

[UPE1-HundredGigE1/0/1] mpls enable

[UPE1-HundredGigE1/0/1] quit

(2)     配置UPE 2

# 配置MPLS基本能力。

<UPE2> system-view

[UPE2] interface loopback 0

[UPE2-Loopback0] ip address 4.4.4.9 32

[UPE2-Loopback0] quit

[UPE2] mpls lsr-id 4.4.4.9

[UPE2] interface hundredgige 1/0/1

[UPE2-HundredGigE1/0/1] ip address 172.2.1.1 24

[UPE2-HundredGigE1/0/1] mpls enable

[UPE2-HundredGigE1/0/1] quit

4. 配置SPE与UPE建立EBGP对等体,并交换带标签的路由,建立BGP LSP

(1)     配置SPE 1

[SPE1] bgp 100

[SPE1-bgp-default] peer 172.1.1.1 as-number 200

[SPE1-bgp-default] address-family ipv4

[SPE1-bgp-default-ipv4] peer 172.1.1.1 enable

[SPE1-bgp-default-ipv4] peer 172.1.1.1 label-route-capability

[SPE1-bgp-default-ipv4] peer 172.1.1.1 route-policy policy1 export

[SPE1-bgp-default-ipv4] network 2.2.2.9 255.255.255.255

[SPE1-bgp-default-ipv4] quit

[SPE1-bgp-default] quit

# 配置路由策略,为路由分配标签。

[SPE1] route-policy policy1 permit node 0

[SPE1-route-policy-policy1-0] apply mpls-label

[SPE1-route-policy-policy1-0] quit

(2)     配置UPE 1

[UPE1] bgp 200

[UPE1-bgp-default] peer 172.1.1.2 as-number 100

[UPE1-bgp-default] address-family ipv4

[UPE1-bgp-default-ipv4] peer 172.1.1.2 enable

[UPE1-bgp-default-ipv4] peer 172.1.1.2 label-route-capability

[UPE1-bgp-default-ipv4] peer 172.1.1.2 route-policy policy1 export

[UPE1-bgp-default-ipv4] network 1.1.1.9 255.255.255.255

[UPE1-bgp-default-ipv4] quit

[UPE1-bgp-default] quit

# 配置路由策略,为路由分配标签。

[UPE1] route-policy policy1 permit node 0

[UPE1-route-policy-policy1-0] apply mpls-label

[UPE1-route-policy-policy1-0] quit

(3)     配置SPE 2

[SPE2] bgp 100

[SPE2-bgp-default] peer 172.2.1.1 as-number 200

[SPE2-bgp-default] address-family ipv4

[SPE2-bgp-default-ipv4] peer 172.2.1.1 enable

[SPE2-bgp-default-ipv4] peer 172.2.1.1 label-route-capability

[SPE2-bgp-default-ipv4] peer 172.2.1.1 route-policy policy1 export

[SPE2-bgp-default-ipv4] network 3.3.3.9 255.255.255.255

[SPE2-bgp-default-ipv4] quit

[SPE2-bgp-default] quit

[SPE2] route-policy policy1 permit node 0

[SPE2-route-policy-policy1-0] apply mpls-label

[SPE2-route-policy-policy1-0] quit

(4)     配置UPE 2

[UPE2] bgp 200

[UPE2-bgp-default] peer 172.2.1.2 as-number 100

[UPE2-bgp-default] address-family ipv4

[UPE2-bgp-default-ipv4] peer 172.2.1.2 enable

[UPE2-bgp-default-ipv4] peer 172.2.1.2 label-route-capability

[UPE2-bgp-default-ipv4] peer 172.2.1.2 route-policy policy1 export

[UPE2-bgp-default-ipv4] network 4.4.4.9 255.255.255.255

[UPE2-bgp-default-ipv4] quit

[UPE2-bgp-default] quit

# 配置路由策略,为路由分配标签。

[UPE2] route-policy policy1 permit node 0

[UPE2-route-policy-policy1-0] apply mpls-label

[UPE2-route-policy-policy1-0] quit

配置完成后,在各设备上执行display mpls lsp命令可以看到已在SPE与UPE之间建立BGP LSP。

5. 配置SPE与UPE建立MP-EBGP对等体,使能HoVPN服务

(1)     配置UPE 1

# 配置UPE 1与SPE 1建立MP-EBGP对等体。

[UPE1] bgp 200

[UPE1-bgp-default] peer 2.2.2.9 as-number 100

[UPE1-bgp-default] peer 2.2.2.9 connect-interface loopback 0

[UPE1-bgp-default] address-family vpnv4

[UPE1-bgp-default-vpnv4] peer 2.2.2.9 enable

# 配置UPE 1接受AS_PATH属性中已包含本地AS号的路由,以接收位于相同AS的UPE 2的路由。

[UPE1-bgp-default-vpnv4] peer 2.2.2.9 allow-as-loop

[UPE1-bgp-default-vpnv4] quit

(2)     配置SPE 1

# 配置VPN实例vpn1。

[SPE1] ip vpn-instance vpn1

[SPE1-vpn-instance-vpn1] route-distinguisher 100:1

[SPE1-vpn-instance-vpn1] vpn-target 100:1 both

[SPE1-vpn-instance-vpn1] quit

# 配置SPE 1与UPE 1建立MP-EBGP对等体,指定UPE 1,并引入VPN路由。

[SPE1] bgp 100

[SPE1-bgp-default] peer 1.1.1.9 as-number 200

[SPE1-bgp-default] peer 1.1.1.9 connect-interface loopback 0

[SPE1-bgp-default] address-family vpnv4

[SPE1-bgp-default-vpnv4] peer 1.1.1.9 enable

[SPE1-bgp-default-vpnv4] peer 1.1.1.9 upe

[SPE1-bgp-default-vpnv4] quit

[SPE1-bgp-default] ip vpn-instance vpn1

[SPE1-bgp-default-vpn1] quit

[SPE1-bgp-default] quit

(3)     配置UPE 2

# 配置UPE 2与SPE 2建立MP-EBGP对等体。

[UPE2] bgp 200

[UPE2-bgp-default] peer 3.3.3.9 as-number 100

[UPE2-bgp-default] peer 3.3.3.9 connect-interface loopback 0

[UPE2-bgp-default] address-family vpnv4

[UPE2-bgp-default-vpnv4] peer 3.3.3.9 enable

# 配置UPE 2接受AS_PATH属性中已包含本地AS号的路由,以接收位于相同AS的UPE1的路由。

[UPE2-bgp-default-vpnv4] peer 3.3.3.9 allow-as-loop

[UPE2-bgp-default-vpnv4] quit

(4)     配置SPE 2

# 配置VPN实例vpn1。

[SPE2] ip vpn-instance vpn1

[SPE2-vpn-instance-vpn1] route-distinguisher 100:1

[SPE2-vpn-instance-vpn1] vpn-target 100:1 both

[SPE2-vpn-instance-vpn1] quit

# 配置SPE 2与UPE 2建立MP-EBGP对等体,指定UPE 2,并引入VPN路由。

[SPE2] bgp 100

[SPE2-bgp-default] peer 4.4.4.9 as-number 200

[SPE2-bgp-default] peer 4.4.4.9 connect-interface loopback 0

[SPE2-bgp-default] address-family vpnv4

[SPE2-bgp-default-vpnv4] peer 4.4.4.9 enable

[SPE2-bgp-default-vpnv4] peer 4.4.4.9 upe

[SPE2-bgp-default-vpnv4] quit

[SPE2-bgp-default] ip vpn-instance vpn1

[SPE2-bgp-default-vpn1] quit

[SPE2-bgp-default] quit

配置完成后,在SPE和UPE设备上执行display bgp peer vpnv4命令可以看到相互之间的BGP对等体关系已建立,并达到Established状态。

6. 配置UPE接入CE

(1)     配置UPE 1

# 配置VPN实例vpn1,将CE 1接入UPE 1。

[UPE1] ip vpn-instance vpn1

[UPE1-vpn-instance-vpn1] route-distinguisher 100:1

[UPE1-vpn-instance-vpn1] vpn-target 100:1 both

[UPE1-vpn-instance-vpn1] quit

[UPE1] interface hundredgige 1/0/2

[UPE1-HundredGigE1/0/2] ip binding vpn-instance vpn1

[UPE1-HundredGigE1/0/2] ip address 10.1.1.2 24

[UPE1-HundredGigE1/0/2] quit

# 配置UPE 1与CE 1建立EBGP对等体,并引入VPN路由。

[UPE1] bgp 200

[UPE1-bgp-default] ip vpn-instance vpn1

[UPE1-bgp-default-vpn1] peer 10.1.1.1 as-number 65410

[UPE1-bgp-default-vpn1] address-family ipv4 unicast

[UPE1-bgp-default-ipv4-vpn1] peer 10.1.1.1 enable

[UPE1-bgp-default-ipv4-vpn1] import-route direct

[UPE1-bgp-default-ipv4-vpn1] quit

[UPE1-bgp-default-vpn1] quit

(2)     配置CE 1

配置CE 1与UPE 1建立EBGP对等体,并引入直连路由。

<CE1> system-view

[CE1] interface hundredgige 1/0/2

[CE1-HundredGigE1/0/2] ip address 10.1.1.1 255.255.255.0

[CE1-HundredGigE1/0/2] quit

[CE1] bgp 65410

[CE1-bgp-default] peer 10.1.1.2 as-number 200

[CE1-bgp-default] address-family ipv4 unicast

[CE1-bgp-default-ipv4] peer 10.1.1.2 enable

[CE1-bgp-default-ipv4] import-route direct

[CE1-bgp-default-ipv4] quit

[CE1-bgp-default] quit

(3)     配置UPE 2

# 配置VPN实例vpn1,将CE 2接入UPE 2。

[UPE2] ip vpn-instance vpn1

[UPE2-vpn-instance-vpn1] route-distinguisher 100:1

[UPE2-vpn-instance-vpn1] vpn-target 100:1 both

[UPE2-vpn-instance-vpn1] quit

[UPE2] interface hundredgige 1/0/2

[UPE2-HundredGigE1/0/2] ip binding vpn-instance vpn1

[UPE2-HundredGigE1/0/2] ip address 10.2.1.2 24

[UPE2-HundredGigE1/0/2] quit

# 配置UPE 2与CE 2建立EBGP对等体,并引入VPN路由。

[UPE2] bgp 200

[UPE2-bgp-default] ip vpn-instance vpn1

[UPE2-bgp-default-vpn1] peer 10.2.1.1 as-number 65420

[UPE2-bgp-default-vpn1] address-family ipv4 unicast

[UPE2-bgp-default-ipv4-vpn1] peer 10.2.1.1 enable

[UPE2-bgp-default-ipv4-vpn1] import-route direct

[UPE2-bgp-default-ipv4-vpn1] quit

[UPE2-bgp-default-vpn1] quit

(4)     配置CE 2

配置CE 2与UPE 2建立EBGP对等体,并引入直连路由。

<CE2> system-view

[CE2] interface hundredgige 1/0/2

[CE2-HundredGigE1/0/2] ip address 10.2.1.1 255.255.255.0

[CE2-HundredGigE1/0/2] quit

[CE2] bgp 65420

[CE2-bgp-default] peer 10.2.1.2 as-number 200

[CE2-bgp-default] address-family ipv4 unicast

[CE2-bgp-default-ipv4] peer 10.2.1.2 enable

[CE2-bgp-default-ipv4] import-route direct

[CE2-bgp-default-ipv4] quit

[CE2-bgp-default] quit

配置完成后,在UPE和CE设备上执行display bgp peer ipv4命令可以看到相互之间的BGP对等体关系已建立,并达到Established状态。

7. 在SPE设备上配置路由策略,控制VPN之间路由的传播

(1)     配置SPE 1

# 配置SPE 1向UPE 1发送通过策略的路由信息,允许CE 2的路由发送给UPE 1。

[SPE1] ip prefix-list list1 index 10 permit 172.16.3.0 24

[SPE1] route-policy policy2 permit node 0

[SPE1-route-policy-policy2-0] if-match ip address prefix-list list1

[SPE1-route-policy-policy2-0] quit

[SPE1] bgp 100

[SPE1-bgp-default] address-family vpnv4

[SPE1-bgp-default-vpnv4] peer 1.1.1.9 upe route-policy policy2 export

(2)     配置SPE 2

# 配置SPE 2向UPE 2发送通过策略的路由信息,允许CE 1的私网路由172.16.1.0/24发送给UPE 2。

[SPE2] ip prefix-list list1 index 10 permit 172.16.1.0 24

[SPE2] route-policy policy2 permit node 0

[SPE2-route-policy-policy2-0] if-match ip address prefix-list list1

[SPE2-route-policy-policy2-0] quit

[SPE2] bgp 100

[SPE2-bgp-default] address-family vpnv4

[SPE2-bgp-default-vpnv4] peer 4.4.4.9 upe route-policy policy2 export

4.6  验证配置

配置完成后,可以看到CE 1已经学习到CE 2下连网段172.16.3.0/24,如下:

[CE1] display ip routing-table

 

Destinations : 25        Routes : 25

 

Destination/Mask    Proto  Pre  Cost         NextHop         Interface

172.16.1.0/24       Direct 0    0            172.16.1.1      HGE1/0/1

172.16.1.0/32       Direct 0    0            172.16.1.1      HGE1/0/1

172.16.1.1/32       Direct 0    0            127.0.0.1       InLoop0

172.16.1.255/32     Direct 0    0            172.16.1.1      HGE1/0/1

172.16.2.0/24       Direct 0    0            172.16.2.1      HGE1/0/3

172.16.2.0/32       Direct 0    0            172.16.2.1      HGE1/0/3

172.16.2.1/32       Direct 0    0            127.0.0.1       InLoop0

172.16.2.255/32     Direct 0    0            172.16.2.1      HGE1/0/3

172.16.3.0/24       BGP    255  0            10.1.1.2        HGE1/0/2

CE 2已经学习到CE 1的下连网段172.16.1.0/24,但并未学习到CE 1的下连网段172.16.2.0/24.如下:

[CE2] display ip routing-table

 

Destinations : 21        Routes : 21

 

Destination/Mask    Proto  Pre  Cost         NextHop         Interface

172.16.1.0/24       BGP    255  0            10.2.1.2        HGE1/0/2

172.16.3.0/24       Direct 0    0            172.16.3.1      HGE1/0/1

172.16.3.0/32       Direct 0    0            172.16.3.1      HGE1/0/1

172.16.3.1/32       Direct 0    0            127.0.0.1       InLoop0

172.16.3.255/32     Direct 0    0            172.16.3.1      HGE1/0/1

CE1的HundredGigE1/0/1(172.16.1.0/24)可与CE2的HundredGigE1/0/1(172.16.3.0/24)互通;CE1的HundredGigE1/0/3(172.16.2.0/24)不能与CE2的HundredGigE1/0/1(172.16.3.0/24)互通。

4.7  配置文件

·     CE 1

#

interface HundredGigE1/0/1

 port link-mode route

 ip address 172.16.1.1 255.255.255.0

#

interface HundredGigE1/0/2

 port link-mode route

 ip address 10.1.1.1 255.255.255.0

#

interface HundredGigE1/0/3

 port link-mode route

 ip address 172.16.2.1 255.255.255.0

#

bgp 65410

 peer 10.1.1.2 as-number 200

 #

 address-family ipv4 unicast

  import-route direct

  peer 10.1.1.2 enable

#

·     CE 2

#

interface HundredGigE1/0/1

 port link-mode route

 ip address 172.16.3.1 255.255.255.0

#

interface HundredGigE1/0/2

 port link-mode route

 ip address 10.2.1.1 255.255.255.0

#

bgp 65420

 peer 10.2.1.2 as-number 200

 #

 address-family ipv4 unicast

  import-route direct

  peer 10.2.1.2 enable

#

·     UPE 1

#

ip vpn-instance vpn1

 route-distinguisher 100:1

 vpn-target 100:1 import-extcommunity

 vpn-target 100:1 export-extcommunity

#

 mpls lsr-id 1.1.1.9

#

interface LoopBack0

 ip address 1.1.1.9 255.255.255.255

#

interface HundredGigE1/0/1

 port link-mode route

 ip address 172.1.1.1 255.255.255.0

 mpls enable

#

interface HundredGigE1/0/2

 port link-mode route

 ip binding vpn-instance vpn1

 ip address 10.1.1.2 255.255.255.0

#

bgp 200

 peer 2.2.2.9 as-number 100

 peer 2.2.2.9 connect-interface LoopBack0

 peer 172.1.1.2 as-number 100

 #

 address-family ipv4 unicast

  import-route direct

  network 1.1.1.9 255.255.255.255

  network 172.1.1.0 255.255.255.0

  peer 172.1.1.2 enable

  peer 172.1.1.2 route-policy hope export

  peer 172.1.1.2 label-route-capability

 #

 address-family vpnv4

  peer 2.2.2.9 enable

  peer 2.2.2.9 allow-as-loop 1

 #

 ip vpn-instance vpn1

  peer 10.1.1.1 as-number 65410

  #

  address-family ipv4 unicast

   import-route direct

   peer 10.1.1.1 enable

#

route-policy hope permit node 0

 apply mpls-label

#

·     SPE 1

#

ip vpn-instance vpn1

 route-distinguisher 100:1

 vpn-target 100:1 import-extcommunity

 vpn-target 100:1 export-extcommunity

#

ospf 1

 area 0.0.0.0

  network 2.2.2.9 0.0.0.0

  network 180.1.1.0 0.0.0.255

#

 mpls lsr-id 2.2.2.9

#

mpls ldp

#

interface LoopBack0

 ip address 2.2.2.9 255.255.255.255

#

interface HundredGigE1/0/1

 port link-mode route

 ip address 172.1.1.2 255.255.255.0

 mpls enable

#

interface HundredGigE1/0/2

 port link-mode route

 ip address 180.1.1.1 255.255.255.0

 mpls enable

 mpls ldp enable

#

bgp 100

 peer 1.1.1.9 as-number 200

 peer 1.1.1.9 connect-interface LoopBack0

 peer 3.3.3.9 as-number 100

 peer 3.3.3.9 connect-interface LoopBack0

 peer 172.1.1.1 as-number 200

 #

 address-family ipv4 unicast

  network 2.2.2.9 255.255.255.255

  peer 172.1.1.1 enable

  peer 172.1.1.1 route-policy policy1 export

  peer 172.1.1.1 label-route-capability

 #

 address-family vpnv4

  peer 1.1.1.9 enable

  peer 1.1.1.9 upe

  peer 1.1.1.9 upe route-policy policy2 export

  peer 3.3.3.9 enable

 #

 ip vpn-instance vpn1

#

route-policy policy1 permit node 0

 apply mpls-label

#

route-policy policy2 permit node 0

 if-match ip address prefix-list list1

#

 ip prefix-list list1 index 10 permit 172.16.3.0 24

#

·     UPE 2

#

ip vpn-instance vpn1

 route-distinguisher 100:1

 vpn-target 100:1 import-extcommunity

 vpn-target 100:1 export-extcommunity

#

 mpls lsr-id 4.4.4.9

#

interface LoopBack0

 ip address 4.4.4.9 255.255.255.255

#

interface HundredGigE1/0/1

 port link-mode route

 ip address 172.2.1.1 255.255.255.0

 mpls enable

#

interface HundredGigE1/0/2

 port link-mode route

 ip binding vpn-instance vpn1

 ip address 10.2.1.2 255.255.255.0

#

bgp 200

 peer 3.3.3.9 as-number 100

 peer 3.3.3.9 connect-interface LoopBack0

 peer 172.2.1.2 as-number 100

 #

 address-family ipv4 unicast

  network 4.4.4.9 255.255.255.255

  peer 172.2.1.2 enable

  peer 172.2.1.2 route-policy hope export

  peer 172.2.1.2 label-route-capability

 #

 address-family vpnv4

  peer 3.3.3.9 enable

  peer 3.3.3.9 allow-as-loop 1

 #

 ip vpn-instance vpn1

  peer 10.2.1.1 as-number 65420

  #

  address-family ipv4 unicast

   import-route direct

   peer 10.2.1.1 enable

#

route-policy hope permit node 0

 apply mpls-label

#

·     SPE 2

#

ip vpn-instance vpn1

 route-distinguisher 100:1

 vpn-target 100:1 import-extcommunity

 vpn-target 100:1 export-extcommunity

#

ospf 1

 area 0.0.0.0

  network 3.3.3.9 0.0.0.0

  network 180.1.1.0 0.0.0.255

#

 mpls lsr-id 3.3.3.9

#

mpls ldp

#

interface LoopBack0

 ip address 3.3.3.9 255.255.255.255

#

interface HundredGigE1/0/1

 port link-mode route

 ip address 172.2.1.2 255.255.255.0

 mpls enable

#

interface HundredGigE1/0/2

 port link-mode route

 ip address 180.1.1.2 255.255.255.0

 mpls enable

 mpls ldp enable

#

bgp 100

 router-id 3.3.3.9

 peer 2.2.2.9 as-number 100

 peer 2.2.2.9 connect-interface LoopBack0

 peer 4.4.4.9 as-number 200

 peer 4.4.4.9 connect-interface LoopBack0

 peer 172.2.1.1 as-number 200

 #

 address-family ipv4 unicast

  network 3.3.3.9 255.255.255.255

  peer 172.2.1.1 enable

  peer 172.2.1.1 route-policy policy1 export

  peer 172.2.1.1 label-route-capability

 #

 address-family vpnv4

  peer 2.2.2.9 enable

  peer 4.4.4.9 enable

  peer 4.4.4.9 upe

  peer 4.4.4.9 upe route-policy policy2 export

 #

 ip vpn-instance vpn1

#

route-policy policy1 permit node 0

 apply mpls-label

#

route-policy policy2 permit node 0

 if-match ip address prefix-list list1

#

 ip prefix-list list1 index 10 permit 172.16.1.0 24

#

5  相关资料

·     H3C S12500R系列交换路由器 MPLS配置指导-R3606

·     H3C S12500R系列交换路由器 MPLS命令参考-R3606

不同款型规格的资料略有差异, 详细信息请向具体销售和400咨询。H3C保留在没有任何通知或提示的情况下对资料内容进行修改的权利!

新华三官网
联系我们