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

H3C S5830V2[S5820V2]系列以太网交换机 典型配置举例-Release22xx系列-6W100

目录

34-MCE典型配置举例

本章节下载 34-MCE典型配置举例  (385.62 KB)

docurl=/cn/Service/Document_Software/Document_Center/Switches/Catalog/S5800/S5830V2/Configure/Typical_Configuration_Example/H3C_S5830V2[S5820V2]-Release22xx-6W100/201403/819600_30005_0.htm

34-MCE典型配置举例


1  MCE典型配置案例

1.1  简介

MCE功能通过为每个VPN创建和维护独立的路由转发表,来隔离私网内不同VPN的报文转发路径,而且通过与PE间的配合,也能够将每个VPN的路由正确发布至对端PE,保证了在MPLS L3VPN环境下VPN报文在公网内的正确传输。本文介绍了由MCE设备向PE设备发布VPN路由信息的典型配置案例。

1.2  MCE通过OSPF向PE发布VPN路由典型配置案例

1.2.1  适用产品和版本

表1 配置适用的产品与软件版本关系

产品

软件版本

S5830V2&S5820V2系列以太网交换机

Release 2210,Release 2208P01

 

1.2.2  组网需求

图1所示,某公司通过运营商提供的MPLS L3VPN服务实现总部与分支机构的VPN连接,运营商MPLS网络左侧为公司总部网络,包括财务和研发部门,财务部中使用静态路由,而研发部内部通过RIP维护路由信息。MPLS网络右侧为研发和财务的分支机构,两个分支机构分别通过CE1和CE2接入MPLS网络。

现要求通过在总部的出口设备上配置MCE功能,实现以下需求:

·     研发部和财务部的路由信息在出口设备上相互隔离

·     出口设备可以通过PE1设备与远端相同VPN内的站点之间实现各部门内部路由信息的单独维护更新

图1 MCE通过OSPF向PE发布VPN路由组网示意图

 

1.2.3  配置思路

要实现在一台设备上对于不同VPN的路由表项进行隔离和单独维护,需要按顺序完成以下配置:

(1)     通过创建VPN实例完成虚拟路由表的创建

(2)     在每个VPN实例中配置或学习VPN站点内的路由信息

(3)     将VPN站点的路由信息通过OSPF协议发布给PE设备,并接收PE设备从远端站点传来的VPN路由信息

(4)     将PE设备上的远端VPN路由信息引入到本地VPN站点

图2 使用VPN实例虚拟多个CE设备示意图

 

1.2.4  配置注意事项

·     执行ip binding vpn-instance命令将删除接口上已经配置的IP地址,因此需要先执行绑定操作,再配置IP地址。

·     一个OSPF进程只能属于一个VPN实例,但一个VPN实例可以使用多个OSPF进程为其传播私网路由。同一VPN实例内的OSPF进程应配置有相同的域ID,以保证路由发布的正确性。

·     VPN实例绑定的OSPF进程中不使用系统视图下配置的公网Router ID,因此用户需要在启动进程时手工配置Router ID。

1.2.5  配置步骤

1. VPN实例配置

# 在MCE设备上为VPN1创建VPN实例,名为“vpn1”,并配置该实例的RD值为10:1。

<MCE> system-view

[MCE] ip vpn-instance vpn1

[MCE-vpn-instance-vpn1] route-distinguisher 10:1

[MCE-vpn-instance-vpn1] quit

# 按同样方法为VPN2创建实例“vpn2”,RD值为20:1。

[MCE] ip vpn-instance vpn2

[MCE-vpn-instance-vpn2] route-distinguisher 20:1

[MCE-vpn-instance-vpn2] quit

# 创建VLAN10,将端口Ten-GigabitEthernet 1/0/10加入VLAN10,并创建Vlan-interface10接口。

[MCE] vlan 10

[MCE-vlan10] port ten-gigabitethernet 1/0/10

[MCE-vlan10] quit

[MCE] interface Vlan-interface 10

# 配置Vlan-interface10接口与VPN1实例进行绑定,并配置IP地址为10.214.10.3,掩码为24位。

[MCE-Vlan-interface10] ip binding vpn-instance vpn1

[MCE-Vlan-interface10] ip address 10.214.10.3 24

# 使用类似步骤配置VLAN20,将端口Ten-GigabitEthernet 1/0/20加入VLAN20,配置接口与VPN2实例绑定并配置IP地址。

[MCE-Vlan-interface10] quit

[MCE] vlan 20

[MCE-vlan20] port ten-gigabitethernet 1/0/20

[MCE-vlan20] quit

[MCE] interface Vlan-interface 20

[MCE-Vlan-interface20] ip binding vpn-instance vpn2

[MCE-Vlan-interface20] ip address 10.214.20.3 24

[MCE-Vlan-interface20] quit

# 创建VLAN30和VLAN40,将Ten-GigabitEthernet1/0/3端口以Trunk方式加入这两个VLAN。并创建相应的VLAN接口,配置IP地址,将VLAN30与VPN1绑定,VLAN40与VPN2绑定。

[MCE] vlan 30

[MCE-vlan30] quit

[MCE] vlan 40

[MCE-vlan40] quit

[MCE] interface ten-gigabitethernet 1/0/3

[MCE-Ten-GigabitEthernet1/0/3] port link-type trunk

[MCE-Ten-GigabitEthernet1/0/3] port trunk permit vlan 30 40

[MCE-Ten-GigabitEthernet1/0/3] quit

[MCE] interface Vlan-interface 30

[MCE-Vlan-interface30] ip binding vpn-instance vpn1

[MCE-Vlan-interface30] ip address 172.16.30.1 24

[MCE-Vlan-interface30] quit

[MCE] interface Vlan-interface 40

[MCE-Vlan-interface40] ip binding vpn-instance vpn2

[MCE-Vlan-interface40] ip address 172.16.40.1 24

[MCE-Vlan-interface40] quit

说明

·     在PE1设备上也需要创建相同的VPN实例及RD值,并将VPN实例分别与连接MCE的接口进行绑定,配置过程这里不再赘述。

·     为方便记忆和管理,建议用户在MCE上为VPN实例配置的RD与在PE1上为该VPN实例配置的RD值保持一致。

 

2. 在VPN实例中配置路由功能

(1)     配置VPN1中的路由

# VR1设备的配置。这里假设VR1设备连接VPN1的站点1的接口地址为192.168.1.1/24。向VLAN中增加端口和配置接口IP地址的配置这里省略。

# 在VR1上配置缺省路由,指定出方向报文的下一跳地址为MCE设备,即10.214.10.3。

<VR1> system-view

[VR1] ip route-static 0.0.0.0 0.0.0.0 10.214.10.3 

# 在MCE上指定静态路由,去往192.168.1.0网段的报文,下一跳地址为10.214.10.2,并将此路由与VPN1实例绑定。

[MCE] ip route-static vpn-instance vpn1 192.168.1.0 24 10.214.10.2

# 显示MCE上为VPN1实例维护的路由信息。

[MCE] display ip routing-table vpn-instance vpn1

 

Destinations : 7 Routes : 7

 

Destination/Mask    Proto  Pre  Cost         NextHop         Interface

10.214.10.0/24      Direct 0     0           10.214.10.3     Vlan10

10.214.10.3/32      Direct 0     0           127.0.0.1       InLoop0

127.0.0.0/8         Direct 0     0           127.0.0.1       InLoop0

127.0.0.1/32        Direct 0     0           127.0.0.1       InLoop0

172.16.30.0/24      Direct 0     0           172.16.30.1     Vlan30

172.16.30.1/32      Direct 0     0           127.0.0.1       InLoop0

192.168.0.0/16      Static 60    0           10.214.10.2     Vlan10

可以看到,VPN1的路由表中已经存在去往站点1的静态路由。

(2)     配置VPN2中的路由

# 在VR2上,配置与MCE连接的接口地址为10.214.20.2/24(配置过程略),配置RIP(假设进程号为20),将网段192.168.2.0和10.214.20.0发布。

<VR2> system-view

[VR2] rip 20

[VR2-rip-20] network 192.168.2.0

[VR2-rip-20] network 10.0.0.0

# VPN2的站点1内已经运行了RIP,可以在MCE上配置RIP路由协议,加入到站点1内的路由运算中,自动更新路由信息。配置RIP进程与VR2一致,并与VPN2实例进行绑定。

[MCE] rip 20 vpn-instance vpn2

# 将网段10.214.20.0发布,关闭路由自动聚合功能。

[MCE-rip-20] network 10.0.0.0

[MCE-rip-20] undo summary

[MCE-rip-20] quit

# 在MCE上查看VPN2实例的路由信息。

[MCE] display ip routing-table vpn-instance vpn2

 

Destinations : 7 Routes : 7

 

Destination/Mask    Proto  Pre  Cost         NextHop         Interface

10.214.20.0/24      Direct 0    0            10.214.20.3     Vlan20

10.214.20.3/32      Direct 0    0            127.0.0.1       InLoop0

127.0.0.0/8         Direct 0    0            127.0.0.1       InLoop0

127.0.0.1/32        Direct 0    0            127.0.0.1       InLoop0

172.16.40.0/30      Direct 0    0            172.16.40.1     Vlan40

172.16.40.1/32      Direct 0    0            127.0.0.1       InLoop0 

192.168.2.0/24      RIP    100  1            10.214.20.2     Vlan20 

可以看到,MCE已经通过RIP学习到了VPN2内的私网路由,并与VPN1内的192.168.1.0路由信息分别维护在两个路由表内,有效地进行了隔离。

3. 配置MCE与PE1设备间的路由信息同步

# 在PE1设备上创建VLAN30和VLAN40,并将Ten-GigabitEthernet1/0/18端口加入VLAN30和VLAN40。

<PE1> system-view

[PE1] vlan 30

[PE1-vlan30] quit

[PE1] vlan 40

[PE1-vlan40] quit

[PE1] interface ten-gigabitethernet 1/0/18

[PE1-Ten-GigabitEthernet1/0/18] port link-type trunk

[PE1-Ten-GigabitEthernet1/0/18] port trunk permit vlan 30 40

[PE1-Ten-GigabitEthernet1/0/18] undo port trunk permit vlan 1

[PE1-Ten-GigabitEthernet1/0/18] quit

# 在PE1设备上为VPN1和VPN2创建VPN实例,分别名为“vpn1”和“vpn2”,并配置该实例的RD值,与MCE设备上保持一致。

[PE1] ip vpn-instance vpn1

[PE1-vpn-instance-vpn1] route-distinguisher 10:1

[PE1-vpn-instance-vpn1] quit

[PE1] ip vpn-instance vpn2

[PE1-vpn-instance-vpn2] route-distinguisher 20:1

[PE1-vpn-instance-vpn2] quit

# 配置PE1的Vlan-interface30和Vlan-interface40的接口IP地址分别为172.16.30.2/24和172.16.40.2/24,并分别与vpn1和vpn2实例进行绑定。

[PE1] interface vlan-interface 30

[PE1-Vlan-interface30] ip binding vpn-instance vpn1

[PE1-Vlan-interface30] ip address 172.16.30.2 24

[PE1-Vlan-interface30] quit

[PE1] interface vlan-interface 40

[PE1-Vlan-interface40] ip binding vpn-instance vpn2

[PE1-Vlan-interface40] ip address 172.16.40.2 24

[PE1-Vlan-interface40] quit

# 配置MCE的Loopback0接口,用于指定MCE设备上用于传输VPN1路由信息的OSPF Router ID,地址为100.100.10.1,并与VPN1实例绑定。

[MCE] interface Loopback 0

[MCE-Loopback0] ip binding vpn-instance vpn1

[MCE-Loopback0] ip address 100.100.10.1 32

[MCE-Loopback0] quit

# 配置PE1的Loopback0接口,用于指定PE1设备上用于传输VPN1路由信息的OSPF Router ID,地址为100.100.11.1,并与VPN1实例绑定。

[PE1] interface Loopback 0

[PE1-Loopback0] ip binding-vpn-instance vpn1

[PE1-Loopback0] ip address 100.100.11.1 32

[PE1-Loopback0] quit

# 配置MCE启动OSPF进程10,Router ID指定为Loopback0接口的地址。将该进程绑定到VPN1实例,用于与PE1交互VPN1的路由信息。

[MCE] ospf 10 router-id 100.100.10.1 vpn-instance vpn1

#开启OSPF多实例功能。

[MCE-ospf-10] vpn-instance-capability simple

# 在Area0区域发布172.16.30.0网段,并引入VPN1的静态路由。

[MCE-ospf-10] area 0

[MCE-ospf-10-area-0.0.0.0] network 172.16.30.0 0.0.0.255

[MCE-ospf-10-area-0.0.0.0] quit

[MCE-ospf-10] import-route static

[MCE-ospf-10] quit

# 配置PE1启动OSPF进程10,Router ID指定为Loopback0接口的地址,将该进程绑定到VPN1实例,用于与MCE设备交互VPN1的路由信息。

[PE1] ospf 10 router-id 100.100.11.1 vpn-instance vpn1

# 配置该进程的域ID为10。

[PE1-ospf-10] domain-id 10

# 开启OSPF多实例功能。

[PE1-ospf-10] vpn-instance-capability simple

# 并在Area0区域发布172.16.30.0网段。

[PE1-ospf-10] area 0

[PE1-ospf-10-area-0.0.0.0] network 172.16.30.0 0.0.0.255

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

[PE1-ospf-10] quit

# 配置MCE的Loopback1接口,用于指定MCE设备上用于传输VPN2路由信息的OSPF Router ID,地址为100.100.20.1,并与VPN2实例绑定。

[MCE] interface Loopback 1

[MCE-Loopback1] ip binding vpn-instance vpn2

[MCE-Loopback1] ip address 100.100.20.1 32

[MCE-Loopback1] quit

# 配置PE1的Loopback1接口,用于指定PE1设备上用于传输VPN2路由信息的OSPF Router ID,地址为100.100.21.1,并与VPN2实例绑定。

[PE1] interface Loopback 1

[PE1-Loopback1] ip binding-vpn-instance vpn2

[PE1-Loopback1] ip address 100.100.21.1 32

[PE1-Loopback1] quit

# 配置MCE启动OSPF进程20,Router ID指定为Loopback1接口的地址。将该进程绑定到VPN2实例,用于与PE1交互VPN2的路由信息。

[MCE] ospf 20 router-id 100.100.20.1 vpn-instance vpn1

#开启OSPF多实例功能。

[MCE-ospf-20] vpn-instance-capability simple

# 在Area0区域发布172.16.40.0网段,并引入VPN2的RIP路由。

[MCE-ospf-20] area 0

[MCE-ospf-20-area-0.0.0.0] network 172.16.40.0 0.0.0.255

[MCE-ospf-20-area-0.0.0.0] quit

[MCE-ospf-20] import-route rip

# 配置PE1启动OSPF进程20,Router ID指定为Loopback1接口的地址,将该进程绑定到VPN2实例,用于与MCE设备交互VPN2的路由信息。

[PE1] ospf 20 router-id 100.100.21.1 vpn-instance vpn2

# 配置该进程的域ID为20。

[PE1-ospf-20] domain-id 20

# 开启OSPF多实例功能。

[PE1-ospf-20] vpn-instance-capability simple

# 并在Area0区域发布172.16.40.0网段。

[PE1-ospf-20] area 0

[PE1-ospf-20-area-0.0.0.0] network 172.16.40.0 0.0.0.255

[PE1-ospf-20-area-0.0.0.0] return

1.2.6  验证配置

# 显示PE1上VPN1实例的路由信息。

<PE1> display ip routing-table vpn-instance vpn1

 

Destinations : 6 Routes : 6

 

Destination/Mask    Proto  Pre  Cost         NextHop         Interface

100.100.11.1/32     Direct 0    0            127.0.0.1       InLoop0

127.0.0.0/8         Direct 0    0            127.0.0.1       InLoop0

127.0.0.1/32        Direct 0    0            127.0.0.1       InLoop0

172.16.30.0/24      Direct 0    0            172.16.30.2     Vlan30

172.16.30.2/32      Direct 0    0            127.0.0.1       InLoop0

192.168.1.0/24      O_ASE  150  1            172.16.30.1     Vlan30 

可以看到,VPN1内的静态路由已经引入到MCE与PE1间的OSPF路由表中。

# 显示PE1上VPN2实例的路由信息。

<PE1> display ip routing-table vpn-instance vpn2

 

Destinations : 6 Routes : 6

 

Destination/Mask    Proto  Pre  Cost         NextHop         Interface

100.100.21.1/32     Direct 0    0            127.0.0.1       InLoop0

127.0.0.0/8         Direct 0    0            127.0.0.1       InLoop0

127.0.0.1/32        Direct 0    0            127.0.0.1       InLoop0

172.16.40.0/24      Direct 0    0            172.16.40.2     Vlan40

172.16.40.2/32      Direct 0    0            127.0.0.1       InLoop0

192.168.10.0/24     O_ASE  150  1            172.16.40.1     Vlan40 

可以看到,VPN2内的RIP路由信息已经引入到MCE与PE1间的OSPF路由表中。

1.2.7  配置文件

·     MCE设备的配置文件

#

ip vpn-instance vpn1

 route-distinguisher 10:1

#

ip vpn-instance vpn2

 route-distinguisher 20:1 

#

vlan 10

#

vlan 20

#

vlan 30

#

vlan 40

#

interface LoopBack0

 ip binding vpn-instance vpn1

 ip address 100.100.10.1 255.255.255.255

#

interface LoopBack0

 ip binding vpn-instance vpn2

 ip address 100.100.20.1 255.255.255.255

#

interface Vlan-interface10

 ip binding vpn-instance vpn1

 ip address 10.214.10.3 255.255.255.0

#

interface Vlan-interface20

 ip binding vpn-instance vpn2

 ip address 10.214.20.3 255.255.255.0

#

interface Vlan-interface30

 ip binding vpn-instance vpn1

 ip address 172.16.30.1 255.255.255.0

#

interface Vlan-interface40

 ip binding vpn-instance vpn2

 ip address 172.16.40.1 255.255.255.0 

#

interface Ten-GigabitEthernet1/0/3

 port link-type trunk

 port trunk permit vlan 1 30 40

#

interface Ten-GigabitEthernet1/0/10

 port access vlan 10 

#

interface Ten-GigabitEthernet1/0/20

 port access vlan 20  

#

ospf 10 router-id 100.100.10.1 vpn-instance vpn1

 import-route static

 vpn-instance-capability simple

 area 0.0.0.0

  network 172.16.30.0 0.0.0.255    

#

ospf 20 router-id 100.100.20.1 vpn-instance vpn2

 import-route rip

 vpn-instance-capability simple

 area 0.0.0.0

  network 172.16.40.0 0.0.0.255    

#

rip 20 vpn-instance vpn2

 undo summary

 network 10.0.0.0

#

 ip route-static vpn-instance vpn1 192.168.1.0 255.255.255.0 10.214.10.2

·     PE1设备的配置文件

#

ip vpn-instance vpn1

 route-distinguisher 10:1

#

ip vpn-instance vpn2

 route-distinguisher 20:1

#

vlan 30

#

vlan 40

#

interface LoopBack0

 ip binding vpn-instance vpn1

 ip address 100.100.11.1 255.255.255.255

#

interface LoopBack1

 ip binding vpn-instance vpn2

 ip address 100.100.21.1 255.255.255.255

#

interface Vlan-interface30

 ip binding vpn-instance vpn1

 ip address 172.16.30.2 255.255.255.0

#

interface Vlan-interface40

 ip binding vpn-instance vpn2

 ip address 172.16.40.2 255.255.255.0

#

interface Ten-GigabitEthernet1/0/18

 port link-type trunk

 port trunk permit vlan 30 40

#

ospf 10 router-id 100.100.10.1 vpn-instance vpn1

 domain-id 0.0.0.10

 vpn-instance-capability simple

 area 0.0.0.0

  network 172.16.30.0 0.0.0.255

#

ospf 20 router-id 100.100.20.1 vpn-instance vpn2

 domain-id 0.0.0.20

 vpn-instance-capability simple

 area 0.0.0.0

  network 172.16.40.0 0.0.0.255

1.3  MCE通过BGP向PE发布VPN路由典型配置案例

1.3.1  适用产品和版本

表2 配置适用的产品与软件版本关系

产品

软件版本

S5830V2&S5820V2系列以太网交换机

Release 2210,Release 2208P01

 

1.3.2  组网需求

图3所示,某公司通过运营商提供的MPLS L3VPN服务实现总部与分支机构的VPN连接,运营商MPLS网络左侧为公司总部网络,包括财务和研发部门,财务部中使用OSPF路由协议,而研发部内部通过IBGP维护路由信息。MPLS网络右侧为研发和财务的分支机构,两个分支机构分别通过CE1和CE2接入MPLS网络。

现要求研发和财务部之间的路由信息和数据流量完全隔离,即两个部门使用不同的VPN连接进行通信。而在总部的出口设备(MCE)上,要求同时维护两个VPN的路由信息且相互独立,并通过PE设备与远端相同VPN内的站点之间进行路由信息的传输。

图3 MCE通过BGP向PE发布VPN路由组网示意图

 

1.3.3  配置思路

在MCE设备和PE设备上都需要创建VPN实例,并将需要传播该VPN数据的接口与相应的VPN实例绑定。MCE设备对各VPN内路由信息的处理顺序如图4所示,即:

(1)     通过创建VPN实例完成虚拟路由表的创建

(2)     在VPN实例中引入VPN站点的路由信息。需要注意的是,研发部内部使用的是IBGP协议,IGBP协议要求全连接或配置路由反射器。在MCE组网中,要求将MCE设备配置为IBGP的路由反射器。

(3)     将VPN站点的路由信息通过EBGP协议发布给PE设备,并接收PE设备从远端站点传来的VPN路由信息。

(4)     将PE设备上的远端VPN路由信息引入到本地VPN站点中。

图4 使用VPN实例虚拟多个CE设备示意图

 

1.3.4  配置注意事项

执行ip binding vpn-instance命令将删除接口上已经配置的IP地址,因此需要先执行绑定操作,再配置IP地址。

1.3.5  配置步骤

1. VPN实例配置

# 在MCE设备上为VPN1创建VPN实例,名为“vpn1”,并配置该实例的RD值为10:1。

<MCE> system-view

[MCE] ip vpn-instance vpn1

[MCE-vpn-instance-vpn1] route-distinguisher 10:1

[MCE-vpn-instance-vpn1] quit

# 按同样方法为VPN2创建实例“vpn2”,RD值为20:1。

[MCE] ip vpn-instance vpn2

[MCE-vpn-instance-vpn2] route-distinguisher 20:1

[MCE-vpn-instance-vpn2] quit

# 创建VLAN10,将端口Ten-GigabitEthernet 1/0/10加入VLAN10,并创建Vlan-interface10接口。

[MCE] vlan 10

[MCE-vlan10] port ten-gigabitethernet 1/0/10

[MCE-vlan10] quit

[MCE] interface Vlan-interface 10

# 配置Vlan-interface10接口与VPN1实例进行绑定,并配置IP地址为10.214.10.3,掩码为24位。

[MCE-Vlan-interface10] ip binding vpn-instance vpn1

[MCE-Vlan-interface10] ip address 10.214.10.3 24

# 使用类似步骤配置VLAN20,将端口Ten-GigabitEthernet 1/0/20加入VLAN20,配置接口与VPN2实例绑定并配置IP地址。

[MCE-Vlan-interface10] quit

[MCE] vlan 20

[MCE-vlan20] port ten-gigabitethernet 1/0/20

[MCE-vlan20] quit

[MCE] interface Vlan-interface 20

[MCE-Vlan-interface20] ip binding vpn-instance vpn2

[MCE-Vlan-interface20] ip address 10.214.20.3 24

[MCE-Vlan-interface20] quit

# 使用类似步骤配置VLAN21,将端口Ten-GigabitEthernet 1/0/21加入VLAN21,配置接口与VPN2实例绑定并配置IP地址。

[MCE] vlan 21

[MCE-vlan21] port ten-gigabitethernet 1/0/21

[MCE-vlan21] quit

[MCE] interface Vlan-interface 21

[MCE-Vlan-interface21] ip binding vpn-instance vpn2

[MCE-Vlan-interface21] ip address 10.214.50.3 24

[MCE-Vlan-interface21] quit

# 创建VLAN30和VLAN40,将Ten-GigabitEthernet1/0/3端口以Trunk方式加入这两个VLAN。并创建相应的VLAN接口,配置IP地址,将VLAN30接口与VPN1绑定,VLAN40接口与VPN2绑定。

[MCE] vlan 30

[MCE-vlan30] quit

[MCE] vlan 40

[MCE-vlan40] quit

[MCE] interface ten-gigabitethernet 1/0/3

[MCE-Ten-GigabitEthernet1/0/3] port link-type trunk

[MCE-Ten-GigabitEthernet1/0/3] port trunk permit vlan 30 40

[MCE-Ten-GigabitEthernet1/0/3] quit

[MCE] interface Vlan-interface 30

[MCE-Vlan-interface30] ip binding vpn-instance vpn1

[MCE-Vlan-interface30] ip address 172.16.30.1 24

[MCE-Vlan-interface30] quit

[MCE] interface Vlan-interface 40

[MCE-Vlan-interface40] ip binding vpn-instance vpn2

[MCE-Vlan-interface40] ip address 172.16.40.1 24

[MCE-Vlan-interface40] quit

说明

·     在PE设备上也需要创建相同的VPN实例及RD值,并将VPN实例分别与连接MCE的接口进行绑定,配置过程这里不再赘述。

·     为方便记忆和管理,建议用户在MCE上为VPN实例配置的RD与在PE上为该VPN实例配置的RD值保持一致。

 

2. 在VPN实例中将VPN站点的路由进行引入

(1)     引入VPN1站点中的路由

# VR1设备的配置。这里假设VR1设备连接VPN1的站点1的接口地址为192.168.1.1/24。向VLAN中增加端口和配置接口IP地址的配置这里省略。

# 在VR1上开启OSPF路由协议,并将直连网段192.168.1.0/24和10.214.10.2/24发布。

<VR1> system-view

[VR1] ospf

[VR1-ospf-1] area 0

[VR1-ospf-1-area-0.0.0.0] network 192.168.1.0 0.0.0.255

[VR1-ospf-1-area-0.0.0.0] network 10.214.10.0 0.0.0.255

# 配置MCE的Loopback0接口的IP地址为101.101.10.1,并与VPN1实例绑定,用来作为与VPN1实例绑定的OSPF进程的Router ID。

[MCE] interface LoopBack 0

[MCE--LoopBack0] ip binding vpn-instance vpn1

[MCE--LoopBack0] ip address 101.101.10.1 32

[MCE--LoopBack0] quit

# 在MCE上开启OSPF路由协议,进程为1,将该进程与VPN1实例进行绑定,使用Loopback0接口的地址作为Router ID。

[MCE] ospf 1 vpn-instance vpn1 router-id 101.101.10.1

# 将直连网段10.214.10.0发布。

[MCE-ospf-1] area 0

[MCE-ospf-1-area-0.0.0.0] network 10.214.10.0 0.0.0.255

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

[MCE-ospf-1] quit

# 显示MCE上为VPN1实例维护的路由信息。

[MCE] display ip routing-table vpn-instance vpn1

 

Destinations : 5 Routes : 5

 

Destination/Mask    Proto  Pre  Cost         NextHop         Interface

127.0.0.0/8         Direct 0     0           127.0.0.1       InLoop0

127.0.0.1/32        Direct 0     0           127.0.0.1       InLoop0

10.214.10.0/24      Direct 0     0           10.214.10.3     Vlan10

10.214.10.3/32      Direct 0     0           127.0.0.1       InLoop0

192.168.1.0/24      OSPF   10    2           10.214.10.2     Vlan10

可以看到,已经在MCE上学到了去往VPN1站点1的路由。

(2)     引入VPN2站点中的路由

# 配置VR2设备和VR3设备连接MCE的接口地址分别为10.214.20.2和10.214.50.2,具体配置过程省略。

# 配置MCE设备连接VR2和VR3设备的接口地址分别为10.214.20.3和10.214.50.3,具体配置过程省略。

# 在VR2上配置BGP(使用自治系统100),对等体为10.214.20.3(MCE),并将网段192.168.2.0和10.214.20.0发布。

<VR2> system-view

[VR2] bgp 100

[VR2-bgp] router-id 2.2.2.2

[VR2-bgp] peer 10.214.20.3 as-number 100

[VR2-bgp] ipv4-family

[VR2-bgp-ipv4] peer 10.214.20.3 enable

[VR2-bgp-ipv4] network 192.168.2.0 24

[VR2-bgp-ipv4] network 10.214.20.0 24

# 在VR3上配置BGP(使用自治系统100),对等体为10.214.50.3(MCE),并将网段192.168.3.0和10.214.50.0发布。

<VR3> system-view

[VR3] bgp 100

[VR3-bgp] router-id 3.3.3.3

[VR3-bgp] peer 10.214.50.3 as-number 100

[VR3-bgp] ipv4-family

[VR3-bgp-ipv4] peer 10.214.50.3 enable

[VR3-bgp-ipv4] network 192.168.3.0 24

[VR3-bgp-ipv4] network 10.214.50.0 24

[VR3-bgp-ipv4] network 3.3.3.3 32

# 在MCE上配置BGP(使用自治系统100),并为VPN2创建BGP-VPN实例。在该实例中配置对等体为10.214.20.2和10.214.50.2,将网段10.214.20.0/24和10.214.50.0/24发布。

[MCE] bgp 100

[MCE-bgp] ip vpn-instance vpn2

[MCE-bgp-vpn2] peer 10.214.20.2 as-number 100

[MCE-bgp-vpn2] peer 10.214.50.2 as-number 100

[MCE-bgp-vpn2] ipv4-family

[MCE-bgp-ipv4-vpn2] peer 10.214.20.2 enable

[MCE-bgp-ipv4-vpn2] peer 10.214.50.2 enable

[MCE-bgp-ipv4-vpn2] network 10.214.20.0 24

[MCE-bgp-ipv4-vpn2] network 10.214.50.0 24

# 配置MCE作为VR2和VR3设备的BGP路由反射器。

[MCE-bgp-ipv4-vpn2] peer 10.214.20.2 reflect-client

[MCE-bgp-ipv4-vpn2] peer 10.214.50.2 reflect-client

[MCE-bgp-ipv4-vpn2] quit

[MCE-bgp-vpn2] quit

# 在MCE上查看BGP路由信息。

[MCE-bgp] display bgp routing-table ipv4

 

 Total number of routes: 3

 

 BGP Local router ID is 4.4.4.4

 Status codes: * - valid, > - best, d - damped, h - history,

               s - suppressed, S - Stale, i - internal, e - external

               Origin: i - IGP, e - EGP, ? - incomplete

 

     Network            NextHop         MED        LocPrf     PrefVal Path/Ogn

 

*  i 192.168.2.0/24     10.214.20.2     0          100        0       i

*  i 192.168.3.0/24     10.214.50.2     0          100        0       i

* >  10.214.20.0/24     0.0.0.0         0                     0       i

* >  10.214.50.0/24     0.0.0.0         0                     0       i

可以看到MCE上已经学习到了VPN2站点内部的路由信息。

3. 配置MCE与PE1设备间的路由信息同步

# 配置PE1的Ten-GigabitEthernet1/0/18端口加入VLAN30和VLAN40。

<PE1> system-view

[PE1] interface ten-gigabitethernet 1/0/18

[PE1-Ten-GigabitEthernet1/0/18] port link-type trunk

[PE1-Ten-GigabitEthernet1/0/18] port trunk permit vlan 30 40

[PE1-Ten-GigabitEthernet1/0/18] quit

# 配置PE1的Vlan-interface30和Vlan-interface40的接口IP地址分别为172.16.30.2/24和172.16.40.2/24,并分别与vpn1和vpn2实例进行绑定。

[PE1] interface vlan-interface 30

[PE1-Vlan-interface30] ip binding vpn-instance vpn1

[PE1-Vlan-interface30] ip address 172.16.30.2 24

[PE1-Vlan-interface30] quit

[PE1] interface vlan-interface 40

[PE1-Vlan-interface40] ip binding vpn-instance vpn2

[PE1-Vlan-interface40] ip address 172.16.40.2 24

[PE1-Vlan-interface40] quit

# 假设PE1设备上的BGP自治系统编号为200,在PE1设备上为VPN1和VPN2创建BGP-VPN实例。

[PE1] bgp 200

[PE1-bgp] ip vpn-instance vpn1

[PE1-bgp-vpn1] quit

[PE1-bgp] ip vpn-instance vpn2

[PE1-bgp-vpn2] quit

(1)     配置MCE与PE1设备间同步VPN1的路由信息

# 在MCE设备上,为VPN1创建BGP-VPN实例,并引入OSPF的路由信息。

[MCE-bgp] ip vpn-instance vpn1

[MCE-bgp-vpn1] ipv4-family

[MCE-bgp-ipv4-vpn1] import-route ospf

[MCE-bgp-ipv4-vpn1] quit

# 在BGP-VPN实例中,指定172.16.30.2(PE1)作为EBGP对等体,自治系统号为200,并发布172.16.30.0网段。

[MCE-bgp-vpn1] peer 172.16.30.2 as-number 200

[MCE-bgp-vpn1] ipv4-family

[MCE-bgp-ipv4-vpn1] peer 172.16.30.2 enable

[MCE-bgp-ipv4-vpn1] network 172.16.30.0 24

[MCE-bgp-ipv4-vpn1] quit

[MCE-bgp-vpn1] quit

# 在PE1设备上进入VPN1的BGP-VPN实例视图,配置EBGP对等体地址为172.16.30.1(MCE),自治系统号为100,并发布172.16.30.0网段。

[PE1-bgp] ip vpn-instance vpn1

[PE1-bgp-vpn1] peer 172.16.30.1 as-number 100

[PE1-bgp-vpn1] ipv4-family

[PE1-bgp-ipv4-vpn1] peer 172.16.30.1 enable

[PE1-bgp-ipv4-vpn1] network 172.16.30.0 24

[PE1-bgp-ipv4-vpn1] quit

[PE1-bgp-vpn1] quit

(2)     配置MCE与PE1设备间同步VPN2的路由信息

# 在MCE设备VPN2的BGP-VPN实例中,指定172.16.40.2作为EBGP对等体,自治系统号为200,并发布172.16.40.0网段。

[MCE-bgp] ip vpn-instance vpn2

[MCE-bgp-vpn2] peer 172.16.40.2 as-number 200

[MCE-bgp-vpn2] ipv4-family

[MCE-bgp-ipv4-vpn2] peer 172.16.40.2 enable

[MCE-bgp-ipv4-vpn2] network 172.16.40.0 24

[MCE-bgp-ipv4-vpn2] return

# 在PE1设备上进入VPN2的BGP-VPN实例视图,配置EBGP对等体地址为172.16.40.1,自治系统号为100,并发布172.16.40.0网段。

[PE1-bgp] ip vpn-instance vpn2

[PE1-bgp-vpn2] peer 172.16.40.1 as-number 100

[PE1-bgp-vpn2] ipv4-family

[PE1-bgp-ipv4-vpn2] peer 172.16.40.2 enable

[PE1-bgp-ipv4-vpn2] network 172.16.40.0 24

[PE1-bgp-ipv4-vpn2] return

1.3.6  验证配置

# 在MCE上查看VPN1实例的EBGP对等体信息。

<MCE> display bgp peer ipv4 vpn-instance vpn1

 

 BGP local router ID : 172.16.40.1

 Local AS number : 100

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

 

  Peer                    AS  MsgRcvd  MsgSent OutQ PrefRcv Up/Down  State

 

  172.16.30.2             200       18       21    0       1 00:16:25 Established

可以看到MCE已经与PE1建立了VPNv4对等体关系。

# 在PE1设备上查看VPN1实例的路由表。

<PE1> display ip routing-table vpn-instance vpn1

 

Destinations : 5 Routes : 5

 

Destination/Mask    Proto  Pre  Cost         NextHop         Interface

 

127.0.0.0/8         Direct 0    0            127.0.0.1       InLoop0

127.0.0.1/32        Direct 0    0            127.0.0.1       InLoop0 

172.16.30.0/24      Direct 0    0            172.16.30.2     Vlan30

172.16.30.2/24      Direct 0    0            127.0.0.1       InLoop0

192.168.1.0/24      BGP    255  3            172.16.30.1     Vlan30

可以看到,在PE1设备上VPN1实例的路由表中,已经引入了VPN1站点中的192.168.1.0网段的路由信息。

# 在MCE上查看VPN2实例的EBGP对等体信息。

<MCE> display bgp peer ipv4 vpn-instance vpn2

 

 BGP local router ID : 172.16.40.1

 Local AS number : 100

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

 

  Peer                    AS  MsgRcvd  MsgSent OutQ PrefRcv Up/Down  State

 

  172.16.40.2             200       18       21    0       1 00:16:25 Established

可以看到MCE已经与PE1建立了VPNv4对等体关系。

# 在PE1设备上查看VPN2实例的路由表。

<PE1> display ip routing-table vpn-instance vpn2

 

Destinations : 5 Routes : 5

 

Destination/Mask    Proto  Pre  Cost         NextHop         Interface

 

10.214.20.0/24      BGP    255  0            172.16.40.1     Vlan30

10.214.50.0/24      BGP    255  0            172.16.40.1     Vlan30

127.0.0.0/8         Direct 0    0            127.0.0.1       InLoop0

127.0.0.1/32        Direct 0    0            127.0.0.1       InLoop0 

172.16.40.0/24      Direct 0    0            172.16.40.2     Vlan40

172.16.40.2/24      Direct 0    0            127.0.0.1       InLoop0

192.168.2.0/24      BGP    255  0            172.16.40.1     Vlan30

192.168.3.0/24      BGP    255  0            172.16.40.1     Vlan30

可以看到,在PE1设备上VPN2实例的路由表中,已经引入了VPN2站点中的192.168.2.0和192.168.3.0网段的路由信息。

1.3.7  配置文件

·     MCE设备的配置文件

#

vlan 10

#

vlan 20 to 21

#

vlan 30

#

vlan 40

#

interface LoopBack0

 ip binding vpn-instance vpn1

 ip address 101.101.10.1 255.255.255.255

#

interface Vlan-interface10

 ip binding vpn-instance vpn1

 ip address 10.214.10.3 255.255.255.0

#

interface Vlan-interface20

 ip binding vpn-instance vpn2

 ip address 10.214.20.3 255.255.255.0

#

interface Vlan-interface21

 ip binding vpn-instance vpn2

 ip address 10.214.50.3 255.255.255.0

#

interface Vlan-interface30

 ip binding vpn-instance vpn1

 ip address 172.16.30.1 255.255.255.0

#

interface Vlan-interface40

 ip binding vpn-instance vpn2

 ip address 172.16.40.1 255.255.255.0

#

interface Ten-GigabitEthernet1/0/3

 port link-type trunk

 port trunk permit vlan 1 30 40

#

interface Ten-GigabitEthernet1/0/10

 port access vlan 10

#

interface Ten-GigabitEthernet1/0/20

 port access vlan 20

#

interface Ten-GigabitEthernet1/0/21

 port access vlan 21

#

bgp 100

 #

 ip vpn-instance vpn1

  peer 172.16.30.2 as-number 200

  #

  ipv4-family unicast

   import-route ospf 1

   network 172.16.30.0 255.255.255.0

   peer 172.16.30.2 enable

 #

 ip vpn-instance vpn2

  peer 10.214.20.2 as-number 100

  peer 10.214.50.2 as-number 100

  peer 172.16.40.2 as-number 200

  #

  ipv4-family unicast

   network 10.214.20.0 255.255.255.0

   network 10.214.50.0 255.255.255.0

   network 172.16.40.0 255.255.255.0

   peer 10.214.20.2 enable

   peer 10.214.20.2 reflect-client

   peer 10.214.50.2 enable

   peer 10.214.50.2 reflect-client

   peer 172.16.40.2 enable

#

ospf 1 router-id 101.101.10.1 vpn-instance vpn1

 area 0.0.0.0

  network 10.214.10.0 0.0.0.255

#

·     PE1设备的配置文件

#

ip vpn-instance vpn1

 route-distinguisher 10:1

#

ip vpn-instance vpn2

 route-distinguisher 20:1

#

vlan 30

#

vlan 40

#

interface LoopBack0

 ip binding vpn-instance vpn1

 ip address 100.100.11.1 255.255.255.255

#

interface LoopBack1

 ip binding vpn-instance vpn2

 ip address 100.100.21.1 255.255.255.255

#

interface Vlan-interface30

 ip binding vpn-instance vpn1

 ip address 172.16.30.2 255.255.255.0

#

interface Vlan-interface40

 ip binding vpn-instance vpn2

 ip address 172.16.40.2 255.255.255.0

#

interface Ten-GigabitEthernet1/0/18

 port link-type trunk

 port trunk permit vlan 30 40

#

bgp 200

 #

 ip vpn-instance vpn1

  peer 172.16.30.1 as-number 100

  #

  ipv4-family unicast

   network 172.16.30.0 255.255.255.0

   peer 172.16.30.1 enable

 #

 ip vpn-instance vpn2

  peer 172.16.40.1 as-number 100

  #

  ipv4-family unicast

   network 172.16.40.0 255.255.255.0

   peer 172.16.40.1 enable

#

 

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

新华三官网
联系我们