24-微分段配置
本章节下载: 24-微分段配置 (491.22 KB)
目 录
微分段(Microsegment),也叫基于精细分组的安全隔离,其实质就是基于对报文进行分组后的组标识来进行流量控制。例如,将数据中心网络中的服务器按照一定的原则进行分组,然后基于分组来部署流量控制策略,从而达到简化运维、安全管控的目的。
按照一定的原则对网络终结点(例如一个或一组服务器)划分的组。每个微分段都拥有一个全局唯一的ID。
GBP(Group Based Policy,组策略),基于微分段的流量控制策略,可以通过如下任意一个配置实现:
· 策略路由:一个策略路由节点对应一个GBP,通过策略路由中的apply动作对微分段间的互通进行控制。
· QoS策略:QoS策略中的一个CB对对应一个GBP,通过流行为中的动作对微分段间的互通进行控制。
· 报文过滤:一个报文过滤对应一个GBP,通过ACL规则中的permit或deny动作对微分段间的互通进行控制。
有关策略路由的详细介绍,请参见“三层技术-IP路由配置指导”中的“策略路由”。有关QoS策略的详细介绍,请参见“ACL和QoS配置指导”中的“QoS策略”和“流量过滤”。有关报文过滤的详细介绍,请参见“ACL和QoS配置指导”中的“ACL”。
如图1-1所示,微分段功能由配置微分段、ACL和GBP共同组成。其中,GBP可以选择使用QoS策略、报文过滤或策略路由。
微分段功能不对微分段内成员间的互通进行控制,而对微分段间的互通进行控制。其控制策略生效的位置是分组流量转发链路的源端设备,因此若需要对双向流量进行控制,则需要在两端设备上都部署微分段功能,中间节点则不需要。
微分段功能支持在IP网络、VXLAN网络和EVPN网络中部署。在不同网络中微分段功能的基本配置大致相同,不同之处在于:
· 在IP网络中,所有配置均需配置在三层网关设备上;在VXLAN网络和EVPN网络中,所有配置均需配置在VTEP上。
· 在EVPN网络中,如果本端微分段ID和成员IP地址的对应关系已经通过BGP EVPN的MAC/IP发布路由的扩展团体属性同步给了对端,则实现双向流量控制时,对端就无需配置相同的微分段,仅配置所需的ACL和GBP即可。
选择不同配置作为GBP时,其流量控制动作是不同的:
· 选择QoS策略作为GBP时,流量控制动作为流行为中的filter deny或filter permit。
· 选择报文过滤作为GBP时,流量控制动作为ACL规则中的deny或permit。
· 选择策略路由作为GBP时,流量控制动作为apply next-hop或apply output-interface null0。
微分段功能在IP网络、VXLAN网络和EVPN网络中的基本运行机制相同。如图1-2所示,本节以IP网络中Host A至Host D的单向流为例,并选择QoS策略作为GBP讲述微分段功能的运行机制。
(1) Device A收到Host A发送给Host D的报文后,从报文中获取到源IP地址(192.168.1.2)和目的IP地址(192.168.1.5)。
(2) Device A根据报文的源IP地址(192.168.1.2),按照最长匹配原则查找FIB表项,获取源端Host A所属的微分段ID(微分段1)。
(3) Device A根据报文的目的IP地址(192.168.1.5),按照最长匹配原则查找FIB表项,获取目的端Host D所属的微分段ID(微分段2)。
(4) Device A根据源端Host A所属的微分段ID(微分段1)和目的端Host D所属的微分段ID(微分段2)查找ACL规则,对命中ACL的报文执行QoS策略中指定的如下动作:
¡ filter permit,允许报文通过。
¡ filter deny,禁止报文通过。
图1-2 三层报文在IP网络中进行转发示意图
对于跨设备转发流量也是同理,这里不再赘述。
使用微分段对跨VPN互访的流量进行控制时,为了保证单向的流量正常转发,需要注意的是:
· 当指导流量转发的路由是网段路由时,需要在流量入VPN的设备(即源端PE)上,将网段路由的目的IP也作为成员加入微分段中。
· 当指导流量转发的路由是主机路由时,需要在流量出VPN的设备(即目的端PE)上,将主机路由的目的IP也作为成员加入微分段中。
本特性的支持情况与设备型号有关,请以设备的实际情况为准。
系列 |
型号 |
说明 |
F5000系列 |
F5000-AI-160-G、F5000-AI-130-G、F5000-AI-120-G、F5000-AI-110-G、F5000-AI-55-G、F5000-AI-15-G、 F5000-CN160-G、F5000-E-G、F5000-E-G2、F5000-S-G2、F5000-M-G2、F5000-A-G2 |
支持 |
F5000-AI160、F5000-CN160、F5000-CN-G55、F5080、F5030 |
支持 |
|
F1000系列 |
F1000-AI-03-E |
不支持 |
F1000-AK9130、F1000-AI-90、F1000-AI-25、F1000-AI-90-G、F1000-AI-80-G、F1000-AI-75-G、F1000-AI-65-G、F1000-AI-55-G |
支持 |
|
插卡 |
LSEM1FWESD0 |
支持 |
微分段配置任务如下:
(1) 配置微分段
(2) (可选)配置聚合微分段
(3) 配置ACL
(4) 配置GBP
请选择以下一项任务进行配置:
¡ 配置策略路由
¡ 配置QoS策略
¡ 配置报文过滤
(5) (可选)配置微分段的网段地址成员采用的匹配方式
微分段功能可以应用在IP网络、VXLAN网络和EVPN网络中,有关各自网络的基础配置,本模块的配置步骤中略。
对双向流量都进行控制时:
· 对于IP网络和VXLAN网络,需要在两端设备上都配置微分段,且微分段的配置需完全一致。
· 对于EVPN网络,设备在发布MAC/IP路由时支持通过BGP扩展团体属性携带微分段ID,即微分段的配置仅需在本端设备上配置即可。当本端开启了微分段功能,且微分段中的成员(即IP地址)在MAC/IP发布路由中时:
¡ 微分段的信息会自动同步给对端设备。同步数据会直接在接收设备上生效,不受接收设备上microsegment enable命令的控制。
¡ 如果对端设备也开启了微分段功能,对于有冲突的数据,以同步数据为准。
当配置了空闲内存告警的门限值,且剩余空闲内存到达了告警门限后,无法创建微分段,也无法进入已创建的微分段。已配置的微分段功能可以正常使用。
(1) 进入系统视图。
system-view
(2) 创建微分段,并进入微分段视图。
microsegment microsegment-id [ name microsegment-name ]
缺省情况下,不存在微分段。
(3) 向微分段中添加成员。
member ipv4 ipv4-address { mask | mask-length } [ vpn-instance vpn-instance-name ]
member ipv6 ipv6-address prefix-length [ vpn-instance vpn-instance-name ]
缺省情况下,微分段中不存在成员。
(4) (可选)配置VSI与微分段关联,将通过该AC接入的用户加入到微分段中。
xconnect vsi命令用来将AC与VSI关联。有关本命令的详细介绍,请参见“VXLAN命令参考”。
缺省情况下,未配置VSI与微分段关联。
需要注意,使用本方式为微分段添加成员后,相关信息不支持通过display microsegment命令查看。
(5) 退回系统视图。
quit
(6) 开启微分段功能。
microsegment enable
缺省情况下,微分段功能处于关闭状态。
普通微分段是对网络终结点(例如IP地址)进行的分组,而聚合微分段是在此基础上对普通微分段进行的二次分组,以实现更加精细化的分组管理。一个聚合微分段是通过掩码对ID连续的多个普通微分段进行聚合后生成的新的微分段,它的ID是被聚合的普通微分段ID中的最小值。
如图1-3所示,微分段8~15这8个微分段间两两互通。在此基础上,如需禁止微分段12与14互通、微分段13与14互通,采用重新规划微分段相关配置会很繁琐,直接使用聚合微分段会更加便捷。聚合微分段的配置思路为:将普通微分段12与13进行聚合,生成聚合微分段(ID为12),并新建GBP禁止聚合微分段12与普通微分段14互通。
本特性的支持情况与设备型号有关,请以设备的实际情况为准。
系列 |
型号 |
说明 |
F5000系列 |
F5000-AI-160-G、F5000-AI-130-G、F5000-AI-120-G、F5000-AI-110-G、F5000-AI-55-G、F5000-AI-15-G、 F5000-CN160-G、F5000-E-G、F5000-S-G2、F5000-M-G2、F5000-A-G2 |
支持 |
F5000-AI160、F5000-CN-G55、F5080、F5030 |
支持 |
|
F5000-CN160 |
不支持 |
|
F1000系列 |
F1000-AI-03-E |
不支持 |
F1000-AK9130、F1000-AI-90、F1000-AI-25、F1000-AI-90-G、F1000-AI-80-G、F1000-AI-75-G、F1000-AI-65-G、F1000-AI-55-G |
支持 |
|
插卡 |
LSEM1FWESD0 |
支持 |
(1) 进入系统视图。
system-view
(2) 创建聚合微分段。
microsegment aggregation aggregation-id mask-length mask-length [ name aggregation-name ]
缺省情况下,不存在聚合微分段。
配置ACL时需要注意:
· 对双向流量都进行控制时,两端设备上都需要配置ACL,且ACL规则中指定的源、目的微分段互为相反。
· 如果使用策略路由或QoS策略作为GBP对流量进行控制,则ACL规则中的动作需配置为permit,表示命中该规则的报文会执行策略路由中对应的apply动作或QoS策略中对应的流行为动作。
· 如果使用报文过滤作为GBP对流量进行控制,则ACL规则中的动作可以配置为permit或deny,表示允许或禁止命中规则的报文通过。
(1) 进入系统视图。
system-view
(2) 创建IPv4或IPv6高级ACL,并进入IPv4或IPv6高级ACL视图。请选择其中一项进行配置。
¡ acl [ ipv6 ] number acl-number [ name acl-name ] [ match-order { auto | config } ]
¡ acl [ ipv6 ] { advanced | basic } { acl-number | name acl-name } [ match-order { auto | config } ]
(3) 创建规则。
具体配置ACL规则的命令,请参见“ACL和QoS命令参考”中“ACL”中的rule命令。
rule命令中的destination microsegment microsegment-id和source microsegment microsegment-id必须指定,其他关键字请按需配置。
在策略路由中引用ACL,并指定策略节点的apply动作为具体下一跳(表示允许流量通过)或出接口NULL0(表示禁止流量通过),就能实现控制微分段间是否可以互通的目的。
对双向流量都进行控制时,两端设备上都需要配置策略路由。
(1) 进入系统视图。
system-view
(2) 创建策略节点,并进入策略节点视图。
policy-based-route policy-name [ permit ] node node-number
不指定permit时,缺省的匹配模式即为permit。
(3) 设置匹配ACL的规则。
if-match acl { acl-number | name acl-name }
缺省情况下,未设置ACL匹配规则。
(4) 配置策略节点的动作。下面的方法互斥,请选择其中一项进行配置。
¡ 设置报文转发的下一跳。
apply next-hop ip-address
¡ 设置报文转发的出接口为NULL0。
apply output-interface null0
缺省情况下,未配置策略节点的动作。
(5) 退回系统视图。
quit
(6) 进入接口视图。
interface interface-type interface-number
(7) 对接口转发的报文应用策略路由。
ip policy-based-route policy-name [ share-mode ]
缺省情况下,未对接口转发的报文应用策略。
在QoS策略的流分类中引用ACL,并配置对应流行为中的动作为流量过滤,就能实现控制微分段间是否可以互通的目的。
(1) 进入系统视图。
system-view
(2) 定义类。
a. 创建一个类,并进入类视图。
traffic classifier classifier-name [ operator { and | or } ]
b. 定义匹配数据包的规则。
if-match acl [ ipv6 ] { acl-number | name acl-name }
缺省情况下,未定义匹配数据包的规则。
仅支持引用IPv4或IPv6高级ACL。
c. 退回系统视图。
quit
(3) 定义流行为。
a. 创建一个流行为,并进入流行为视图。
traffic behavior behavior-name
b. 配置流量过滤动作。
filter { deny | permit }
缺省情况下,未配置流量过滤动作。
c. 退回系统视图。
quit
(4) 定义策略。
a. 创建策略并进入策略视图。
qos policy policy-name
b. 在策略中为类指定采用的流行为。
classifier classifier-name behavior behavior-name
缺省情况下,未指定类对应的流行为。
c. 退回系统视图。
quit
(5) 在接口上应用QoS策略。
a. 进入接口视图。
interface interface-type interface-number
b. 在接口入方向上应用已创建的QoS策略。
qos apply policy policy-name inbound [ share-mode ]
缺省情况下,未在接口入方向上应用QoS策略。
在ACL规则中配置动作为permit或deny,然后将此ACL应用在接口入方向上进行报文过滤,就能实现控制微分段间是否可以互通的目的。
(1) 进入系统视图。
system-view
(2) 进入接口视图。
interface interface-type interface-number
(3) 在接口入方向上应用ACL进行报文过滤。
packet-filter [ ipv6 ] { acl-number | name acl-name } inbound [ share-mode ]
缺省情况下,未配置接口入方向的报文过滤。
报文在不同微分段间转发时,设备会根据GBP中的ACL规则来匹配报文的源地址和目的地址所属的微分段。匹配方式有以下两种:
· 精确匹配:报文源和目的地址的掩码长度与微分段成员的地址掩码长度一致。例如报文源地址为10.10.10.1/24则只能匹配到微分段的成员10.10.10.0/24,而无法匹配到微分段的成员10.10.10.0/23。
· 最长匹配:报文源和目的地址的掩码长度可以大于等于微分段成员的地址掩码长度。例如报文源地址为10.10.10.1/24可以匹配到微分段的成员10.10.10.0/16。
如果报文的源地址或目的地址是一个网段地址,即IPv4掩码长度为1~31位、IPv6前缀长度为1~127位的地址,则缺省情况下,设备使用精确匹配的原则来匹配其归属的微分段,因此使用member命令向微分段中添加某一网段路由时,必须精确指定网段地址及其掩码长度,否则报文的源和目的可能无法匹配到归属的微分段。当存在大量网段地址加入同一微分段时,必须逐个将网段地址加入到微分段中,配置较复杂。通过采用最长匹配方式匹配报文源和目的所归属的微分段,可以简化配置。例如不同报文源端地址分别属于10.10.10.0/24、10.10.20.0/24、10.10.30.0/24网段,要求这三个网段地址都匹配到微分段1,只需配置member ipv4 10.10.10.0/16即可。
不同掩码长度地址匹配微分段的方式不同:
· 对于主机地址(IPv4掩码长度为32位、IPv6为128位),按照最长匹配原则进行匹配;
· 对于缺省路由(0.0.0.0/0或0::0/0,即掩码长度为0位),按照精确匹配的原则进行匹配;
· 对于除缺省路由外的其他网段地址,执行本命令后按最长匹配原则进行匹配,否则按精确匹配进行匹配。
(1) 进入系统视图。
system-view
(2) 配置微分段的网段地址成员采用的匹配方式为最长匹配。
microsegment subnet-match longest
缺省情况下,网段地址采用精确匹配方式来匹配归属微分段。
在完成上述配置后,在任意视图下执行display命令可以显示微分段的运行情况,通过查看显示信息验证配置的效果。
表1-1 微分段显示和维护
操作 |
命令 |
显示聚合微分段的配置信息 |
display microsegment aggregation [ aggregation-id | name aggregation-name ] |
显示微分段的配置 |
display microsegment [ microsegment-id | name microsegment-name ] |
Host A与Host B由Device A接入三层网络,General Server与File Server由Device C接入三层网络。现通过配置微分段功能,实现如下需求:
· Host A、Host B和General Server可以访问File Server。
· Host A和General Server、Host B和General Server之间不可以互访。
表1-2 组网图示例接口与设备实际接口对应关系
组网图示例接口 |
设备实际接口 |
Interface2 |
GigabitEthernet1/0/2 |
Interface3 |
GigabitEthernet1/0/3 |
(1) 将Host A和Host B加入微分段1。
(2) 将General Server加入微分段2,File Server加入微分段3。
(3) 配置QoS策略,允许微分段1和微分段3互通,允许微分段2和微分段3互通,禁止微分段1和微分段2互通。
请在系统视图下执行system-working-mode expert命令将系统工作模式配置为专家模式,微分段功能才能正常使用。
请注意配置时保证报文源和目的地址的掩码长度与微分段成员的地址掩码长度一致,否则ACL规则中指定的微分段成员可能无法匹配到报文。
· 如果报文源和目的地址的掩码长度大于微分段成员的地址掩码长度,则必须配置微分段的网段地址成员匹配方式为最长匹配,否则ACL规则中指定的微分段成员无法匹配到报文。
· 如果报文源和目的地址的掩码长度小于微分段成员的地址掩码长度,则ACL规则中指定的微分段成员无法匹配到报文。
(1) 配置Device A
# 创建VLAN,配置各VLAN接口的IP地址。
<Sysname> system-view
[Sysname] sysname DeviceA
[DeviceA] vlan 10
[DeviceA-vlan10] port gigabitethernet 1/0/2
[DeviceA-vlan10] quit
[DeviceA] interface vlan-interface 10
[DeviceA-Vlan-interface10] ip address 192.168.1.254 24
[DeviceA-Vlan-interface10] undo shutdown
[DeviceA-Vlan-interface10] quit
[DeviceA] interface gigabitethernet 1/0/2
[DeviceA-GigabitEthernet1/0/2] undo shutdown
[DeviceA-GigabitEthernet1/0/2] quit
[DeviceA] vlan 20
[DeviceA-vlan20] port gigabitethernet 1/0/3
[DeviceA-vlan20] quit
[DeviceA] interface vlan-interface 20
[DeviceA-Vlan-interface20] ip address 192.168.2.254 24
[DeviceA-Vlan-interface20] undo shutdown
[DeviceA-Vlan-interface20] quit
[DeviceA] interface gigabitethernet 1/0/3
[DeviceA-GigabitEthernet1/0/3] undo shutdown
[DeviceA-GigabitEthernet1/0/3] quit
[DeviceA] vlan 12
[DeviceA-vlan12] quit
[DeviceA] interface vlan-interface 12
[DeviceA-Vlan-interface12] ip address 12.0.0.2 30
[DeviceA-Vlan-interface12] undo shutdown
[DeviceA-Vlan-interface12] quit
[DeviceA] interface gigabitethernet 1/0/1
[DeviceA-GigabitEthernet1/0/1] undo shutdown
[DeviceA-GigabitEthernet1/0/1] port link-type trunk
[DeviceA-GigabitEthernet1/0/1] port trunk permit vlan 12
[DeviceA-GigabitEthernet1/0/1] quit
# 配置IS-IS使网络中路由互通。
[DeviceA] isis 1
[DeviceA-isis-1] cost-style wide
[DeviceA-isis-1] network-entity 00.0000.0000.0001.00
[DeviceA-isis-1] is-level level-2
[DeviceA-isis-1] address-family ipv4 unicast
[DeviceA-isis-1-ipv4] quit
[DeviceA-isis-1] quit
[DeviceA] interface vlan-interface 10
[DeviceA-Vlan-interface20] isis enable 1
[DeviceA-Vlan-interface20] quit
[DeviceA] interface vlan-interface 20
[DeviceA-Vlan-interface30] isis enable 1
[DeviceA-Vlan-interface30] quit
[DeviceA] interface vlan-interface 12
[DeviceA-Vlan-interface12] isis enable 1
[DeviceA-Vlan-interface12] quit
# 创建微分段1,将Host A和Host B的IP地址添加为微分段1的成员。
[DeviceA] microsegment 1 name EPG1
[DeviceA-microsegment-1] member ipv4 192.168.1.1 24
[DeviceA-microsegment-1] member ipv4 192.168.2.1 24
[DeviceA-microsegment-1] quit
# 创建微分段2,将General Server的IP地址添加为微分段2的成员。
[DeviceA] microsegment 2 name EPG2
[DeviceA-microsegment-2] member ipv4 192.168.3.1 24
[DeviceA-microsegment-2] quit
# 创建微分段3,将File Server的IP地址添加为微分段3的成员。
[DeviceA] microsegment 3 name EPG3
[DeviceA-microsegment-3] member ipv4 192.168.4.1 24
[DeviceA-microsegment-3] quit
# 开启微分段功能。
[DeviceA] microsegment enable
# 创建名为EPG1-EPG3的IPv4高级ACL,并配置规则:协议类型为ip,源微分段为微分段1,目的微分段为微分段3。
[DeviceA] acl advanced name EPG1-EPG3
[DeviceA-acl-ipv4-adv-EPG1-EPG3] rule 0 permit ip source microsegment 1 destination microsegment 3
[Device-acl-ipv4-adv-EPG1-EPG3] quit
# 创建名为EPG1-EPG2的IPv4高级ACL,并配置规则:协议类型为ip,源微分段为微分段1,目的微分段为微分段2。
[DeviceA] acl advanced name EPG1-EPG2
[DeviceA-acl-ipv4-adv-EPG1-EPG2] rule 0 permit ip source microsegment 1 destination microsegment 2
[DeviceA-acl-ipv4-adv-EPG1-EPG2] quit
# 创建流分类CLASSIFIER-GBP13,引用ACL EPG1-EPG3。
[DeviceA] traffic classifier CLASSIFIER-GBP13
[DeviceA-classifier-CLASSIFIER-GBP13] if-match acl name EPG1-EPG3
[DeviceA-classifier-CLASSIFIER-GBP13] quit
# 创建流行为BEHAVIOR-GBP13,配置流量过滤动作为permit,并配置流量统计功能。
[DeviceA] traffic behavior BEHAVIOR-GBP13
[DeviceA-behavior-BEHAVIOR-GBP13] filter permit
[DeviceA-behavior-BEHAVIOR-GBP13] accounting packet
[DeviceA-behavior-BEHAVIOR-GBP13] quit
# 创建流分类CLASSIFIER-GBP12,引用ACL EPG1-EPG2,并配置流量统计功能。
[DeviceA] traffic classifier CLASSIFIER-GBP12
[DeviceA-classifier-CLASSIFIER-GBP12] if-match acl name EPG1-EPG2
[DeviceA-classifier-CLASSIFIER-GBP12] quit
# 创建流行为BEHAVIOR-GBP12,配置流量过滤动作为deny。
[DeviceA] traffic behavior BEHAVIOR-GBP12
[DeviceA-behavior-BEHAVIOR-GBP12] filter deny
[DeviceA-behavior-BEHAVIOR-GBP12] accounting packet
[DeviceA-behavior-BEHAVIOR-GBP12] quit
# 创建QoS策略GBP1,为流分类CLASSIFIER-GBP13指定流行为BEHAVIOR-GBP13,为流分类CLASSIFIER-GBP12指定流行为BEHAVIOR-GBP12。
[DeviceA] qos policy GBP1
[DeviceA-qospolicy-GBP1] classifier CLASSIFIER-GBP13 behavior BEHAVIOR-GBP13
[DeviceA-qospolicy-GBP1] classifier CLASSIFIER-GBP12 behavior BEHAVIOR-GBP12
[DeviceA-qospolicy-GBP1] quit
# 将QoS策略GBP1应用在GigabitEthernet1/0/2入方向上。
[DeviceA] interface gigabitethernet 1/0/2
[DeviceA-GigabitEthernet1/0/2] qos apply policy GBP1 inbound
[DeviceA-GigabitEthernet1/0/2] quit
# 将QoS策略GBP1应用在GigabitEthernet1/0/3入方向上。
[DeviceA] interface gigabitethernet 1/0/3
[DeviceA-GigabitEthernet1/0/3] qos apply policy GBP1 inbound
[DeviceA-GigabitEthernet1/0/3] quit
(2) 配置Device B
# 创建VLAN,配置各VLAN接口的IP地址。
<Sysname> system-view
[Sysname] sysname DeviceB
[DeviceB] vlan 12
[DeviceB-vlan12] quit
[DeviceB] interface vlan-interface 12
[DeviceB-Vlan-interface12] ip address 12.0.0.1 30
[DeviceB-Vlan-interface12] undo shutdown
[DeviceB-Vlan-interface12] quit
[DeviceB] interface gigabitethernet 1/0/1
[DeviceB-GigabitEthernet1/0/1] undo shutdown
[DeviceB-GigabitEthernet1/0/1] port link-type trunk
[DeviceB-GigabitEthernet1/0/1] port trunk permit vlan 12
[DeviceB-GigabitEthernet1/0/1] quit
[DeviceB] vlan 23
[DeviceB-vlan23] quit
[DeviceB] interface vlan-interface 23
[DeviceB-Vlan-interface23] ip address 23.0.0.2 30
[DeviceB-Vlan-interface23] undo shutdown
[DeviceB-Vlan-interface23] quit
[DeviceB] interface gigabitethernet 1/0/2
[DeviceB-GigabitEthernet1/0/2] undo shutdown
[DeviceB-GigabitEthernet1/0/2] port link-type trunk
[DeviceB-GigabitEthernet1/0/2] port trunk permit vlan 23
[DeviceB-GigabitEthernet1/0/2] quit
# 配置IS-IS使网络中路由互通。
[DeviceB] isis 1
[DeviceB-isis-1] cost-style wide
[DeviceB-isis-1] network-entity 00.0000.0000.0002.00
[DeviceB-isis-1] is-level level-2
[DeviceB-isis-1] address-family ipv4 unicast
[DeviceB-isis-1-ipv4] quit
[DeviceB-isis-1] quit
[DeviceB] interface vlan-interface 12
[DeviceB-Vlan-interface12] isis enable 1
[DeviceB-Vlan-interface12] quit
[DeviceB] interface vlan-interface 23
[DeviceB-Vlan-interface23] isis enable 1
[DeviceB-Vlan-interface23] quit
(3) 配置Device C
# 创建VLAN,配置各VLAN接口的IP地址。
<Sysname> system-view
[Sysname] sysname DeviceC
[DeviceC] vlan 30
[DeviceC-vlan30] port gigabitethernet 1/0/2
[DeviceC-vlan30] quit
[DeviceC] interface vlan-interface 30
[DeviceC-Vlan-interface30] ip address 192.168.3.254 24
[DeviceC-Vlan-interface30] undo shutdown
[DeviceC-Vlan-interface30] quit
[DeviceC] interface gigabitethernet 1/0/2
[DeviceC-GigabitEthernet1/0/2] undo shutdown
[DeviceC-GigabitEthernet1/0/2] quit
[DeviceC] vlan 40
[DeviceC-vlan40] port gigabitethernet 1/0/3
[DeviceC-vlan40] quit
[DeviceC] interface vlan-interface 40
[DeviceC-Vlan-interface40] ip address 192.168.2.254 24
[DeviceC-Vlan-interface40] undo shutdown
[DeviceC-Vlan-interface40] quit
[DeviceC] interface gigabitethernet 1/0/3
[DeviceC-GigabitEthernet1/0/3] undo shutdown
[DeviceC-GigabitEthernet1/0/3] quit
[DeviceC] vlan 23
[DeviceC-vlan23] quit
[DeviceC] interface vlan-interface 23
[DeviceC-Vlan-interface23] ip address 23.0.0.1 30
[DeviceC-Vlan-interface23] undo shutdown
[DeviceC-Vlan-interface23] quit
[DeviceC] interface gigabitethernet 1/0/1
[DeviceC-GigabitEthernet1/0/1] undo shutdown
[DeviceC-GigabitEthernet1/0/1] port link-type trunk
[DeviceC-GigabitEthernet1/0/1] port trunk permit vlan 23
[DeviceC-GigabitEthernet1/0/1] quit
# 配置IS-IS使网络中路由互通。
[DeviceC] isis 1
[DeviceC-isis-1] cost-style wide
[DeviceC-isis-1] network-entity 00.0000.0000.0003.00
[DeviceC-isis-1] is-level level-2
[DeviceC-isis-1] address-family ipv4 unicast
[DeviceC-isis-1-ipv4] quit
[DeviceC-isis-1] quit
[DeviceC] interface vlan-interface 30
[DeviceC-Vlan-interface30] isis enable 1
[DeviceC-Vlan-interface30] quit
[DeviceC] interface vlan-interface 40
[DeviceC-Vlan-interface40] isis enable 1
[DeviceC-Vlan-interface40] quit
[DeviceC] interface vlan-interface 23
[DeviceC-Vlan-interface23] isis enable 1
[DeviceC-Vlan-interface23] quit
# 创建微分段1,将Host A和Host B的IP地址添加为微分段1的成员。
[DeviceC] microsegment 1 name EPG1
[DeviceC-microsegment-1] member ipv4 192.168.1.1 24
[DeviceC-microsegment-1] member ipv4 192.168.2.1 24
[DeviceC-microsegment-1] quit
# 创建微分段2,将General Server的IP地址添加为微分段2的成员。
[DeviceC] microsegment 2 name EPG2
[DeviceC-microsegment-2] member ipv4 192.168.3.1 24
[DeviceC-microsegment-2] quit
# 创建微分段3,将File Server的IP地址添加为微分段3的成员。
[DeviceC] microsegment 3 name EPG3
[DeviceC-microsegment-3] member ipv4 192.168.4.1 24
[DeviceC-microsegment-3] quit
# 开启微分段功能。
[DeviceC] microsegment enable
# 创建名为EPG3-EPG1的IPv4高级ACL,并配置规则:协议类型为ip,源微分段为微分段3,目的微分段为微分段1。
<DeviceC> system-view
[DeviceC] acl advanced name EPG3-EPG1
[DeviceC-acl-ipv4-adv-EPG3-EPG1] rule 0 permit ip source microsegment 3 destination microsegment 1
[DeviceC-acl-ipv4-adv-EPG3-EPG1] quit
# 创建名为EPG2-EPG1的IPv4高级ACL,并配置规则:协议类型为ip,源微分段为微分段2,目的微分段为微分段1。
[DeviceC] acl advanced name EPG2-EPG1
[DeviceC-acl-ipv4-adv-EPG2-EPG1] rule 0 permit ip source microsegment 2 destination microsegment 1
[DeviceC-acl-ipv4-adv-EPG2-EPG1] quit
# 创建名为EPG2-EPG3的IPv4高级ACL,并配置规则:协议类型为ip,源微分段为微分段2,目的微分段为微分段3。
[DeviceC] acl advanced name EPG2-EPG3
[DeviceC-acl-ipv4-adv-EPG2-EPG3] rule 0 permit ip source microsegment 2 destination microsegment 3
[DeviceC-acl-ipv4-adv-EPG2-EPG3] quit
# 创建名为EPG3-EPG2的IPv4高级ACL,并配置规则:协议类型为ip,源微分段为微分段3,目的微分段为微分段2。
[DeviceC] acl advanced name EPG3-EPG2
[DeviceC-acl-ipv4-adv-EPG3-EPG2] rule 0 permit ip source microsegment 3 destination microsegment 2
[DeviceC-acl-ipv4-adv-EPG3-EPG2] quit
# 创建流分类CLASSIFIER-GBP23,引用ACL EPG2-EPG3。
[DeviceC] traffic classifier CLASSIFIER-GBP23
[DeviceC-classifier-CLASSIFIER-GBP23] if-match acl name EPG2-EPG3
[DeviceC-classifier-CLASSIFIER-GBP23] quit
# 创建流行为BEHAVIOR-GBP23,配置流量过滤动作为permit,并配置流量统计功能。
[DeviceC] traffic behavior BEHAVIOR-GBP23
[DeviceC-behavior-BEHAVIOR-GBP23] filter permit
[DeviceC-behavior-BEHAVIOR-GBP23] accounting packet
[DeviceC-behavior-BEHAVIOR-GBP23] quit
# 创建流分类CLASSIFIER-GBP21,引用ACL EPG2-EPG1,并配置流量统计功能。
[DeviceC] traffic classifier CLASSIFIER-GBP21
[DeviceC-classifier-CLASSIFIER-GBP21] if-match acl name EPG2-EPG1
[DeviceC-classifier-CLASSIFIER-GBP21] quit
# 创建流行为BEHAVIOR-GBP21,配置流量过滤动作为deny。
[DeviceC] traffic behavior BEHAVIOR-GBP21
[DeviceC-behavior-BEHAVIOR-GBP21] filter deny
[DeviceC-behavior-BEHAVIOR-GBP21] accounting packet
[DeviceC-behavior-BEHAVIOR-GBP21] quit
# 创建QoS策略GBP2,为流分类CLASSIFIER-GBP23指定流行为BEHAVIOR-GBP23,为流分类CLASSIFIER-GBP21指定流行为BEHAVIOR-GBP21。
[DeviceC] qos policy GBP2
[DeviceC-qospolicy-GBP2] classifier CLASSIFIER-GBP23 behavior BEHAVIOR-GBP23
[DeviceC-qospolicy-GBP2] classifier CLASSIFIER-GBP21 behavior BEHAVIOR-GBP21
[DeviceC-qospolicy-GBP2] quit
# 创建流分类CLASSIFIER-GBP31,引用ACL EPG3-EPG1。
[DeviceC] traffic classifier CLASSIFIER-GBP31
[DeviceC-classifier-CLASSIFIER-GBP31] if-match acl name EPG3-EPG1
[DeviceC-classifier-CLASSIFIER-GBP31] quit
# 创建流行为BEHAVIOR-GBP31,配置流量过滤动作为permit,并配置流量统计功能。
[DeviceC] traffic behavior BEHAVIOR-GBP31
[DeviceC-behavior-BEHAVIOR-GBP31] filter permit
[DeviceC-behavior-BEHAVIOR-GBP31] accounting packet
[DeviceC-behavior-BEHAVIOR-GBP31] quit
# 创建流分类CLASSIFIER-GBP32,引用ACL EPG3-EPG2。
[DeviceC] traffic classifier CLASSIFIER-GBP32
[DeviceC-classifier-CLASSIFIER-GBP32] if-match acl name EPG3-EPG2
[DeviceC-classifier-CLASSIFIER-GBP32] quit
# 创建流行为BEHAVIOR-GBP32,配置流量过滤动作为permit,并配置流量统计功能。
[DeviceC] traffic behavior BEHAVIOR-GBP32
[DeviceC-behavior-BEHAVIOR-GBP32] filter permit
[DeviceC-behavior-BEHAVIOR-GBP32] accounting packet
[DeviceC-behavior-BEHAVIOR-GBP32] quit
# 创建QoS策略GBP3,为流分类CLASSIFIER-GBP31指定流行为BEHAVIOR-GBP31,为流分类CLASSIFIER-GBP32指定流行为BEHAVIOR-GBP32。
[DeviceC] qos policy GBP3
[DeviceC-qospolicy-GBP3] classifier CLASSIFIER-GBP31 behavior BEHAVIOR-GBP31
[DeviceC-qospolicy-GBP3] classifier CLASSIFIER-GBP32 behavior BEHAVIOR-GBP32
[DeviceC-qospolicy-GBP3] quit
# 将QoS策略GBP2应用在GigabitEthernet1/0/2入方向上。
[DeviceC] interface gigabitethernet 1/0/2
[DeviceC-GigabitEthernet1/0/2] qos apply policy GBP2 inbound
[DeviceC-GigabitEthernet1/0/2] quit
# 将QoS策略GBP3应用在GigabitEthernet1/0/3入方向上。
[DeviceC] interface gigabitethernet 1/0/3
[DeviceC-GigabitEthernet1/0/3] qos apply policy GBP3 inbound
[DeviceC-GigabitEthernet1/0/3] quit
# 分别在Host A和Host B上检查到General Server是否可达。
C:\> ping 192.168.3.1
Pinging 192.168.3.1 with 32 bytes of data:
Request timed out
Request timed out
Request timed out
Request timed out
Ping statistics for 192.168.3.1:
Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),
Host A和Host B无法ping通General Server。
# 分别在Host A、Host B上检查到Filer Server是否可达。
C:\> ping 192.168.4.1
Pinging 192.168.40.100 with 32 bytes of data:
Reply from 192.168.10.100: bytes=32 time=1ms TTL=255
Reply from 192.168.10.100: bytes=32 time<1ms TTL=255
Reply from 192.168.10.100: bytes=32 time<1ms TTL=255
Reply from 192.168.10.100: bytes=32 time<1ms TTL=255
Ping statistics for 192.168.10.100:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 1ms, Average = 0ms
Host A和Host B可以ping通Filer Server。
# 查看Device A上各微分段的配置信息。
[DeviceA] display microsegment 1
Microsegment ID : 1
Microsegment name : EPG1
IPv4 member:
192.168.1.1/24
192.168.2.1/24
[DeviceA] display microsegment 2
Microsegment ID : 2
Microsegment name : EPG2
IPv4 member:
192.168.3.1/24
[DeviceA] display microsegment 3
Microsegment ID : 3
Microsegment name : EPG3
IPv4 member:
192.168.4.1/24
# 查看Device A上微分段的概要和状态信息。
[DeviceA] display microsegment
Microsegment status: Enabled
Total microsegments: 3
Microsegment list :
Microsegment ID Members Microsegment name
1 2 EPG1
2 1 EPG2
3 1 EPG3
# 查看Device A接口上QoS策略的配置信息和运行情况。
[DeviceA] display qos policy interface
Interface: GigabitEthernet1/0/2
Direction: Inbound
Policy: GBP1
Classifier: CLASSIFIER-GBP13
Matched : 0 (Packets) 0 (Bytes)
Operator: AND
Rule(s) :
If-match acl name EPG1-EPG3
Behavior: BEHAVIOR-GBP13
Accounting enable:
5 (Packets)
0 (pps)
Filter enable: Permit
Classifier: CLASSIFIER-GBP12
Matched : 0 (Packets) 0 (Bytes)
Operator: AND
Rule(s) :
If-match acl name EPG1-EPG2
Behavior: BEHAVIOR-GBP12
Accounting enable:
5 (Packets)
0 (pps)
Filter enable: Deny
Interface: GigabitEthernet1/0/2
Direction: Inbound
Policy: GBP1
Classifier: CLASSIFIER-GBP13
Matched : 0 (Packets) 0 (Bytes)
Operator: AND
Rule(s) :
If-match acl name EPG1-EPG3
Behavior: BEHAVIOR-GBP13
Accounting enable:
5 (Packets)
0 (pps)
Filter enable: Permit
Classifier: CLASSIFIER-GBP12
Matched : 0 (Packets) 0 (Bytes)
Operator: AND
Rule(s) :
If-match acl name EPG1-EPG2
Behavior: BEHAVIOR-GBP12
Accounting enable:
5 (Packets)
0 (pps)
Filter enable: Deny
# 查看Device C上微分段、ACL和策略路由的相关配置信息略。
· Device A
#
sysname DeviceA
#
isis 1
is-level level-2
cost-style wide
network-entity 00.0000.0000.0001.00
#
address-family ipv4 unicast
#
vlan 10
#
vlan 12
#
vlan 20
#
microsegment enable
#
microsegment 1 name EPG1
member ipv4 192.168.1.0 255.255.255.0
member ipv4 192.168.2.0 255.255.255.0
#
microsegment 2 name EPG2
member ipv4 192.168.3.0 255.255.255.0
#
microsegment 3 name EPG3
member ipv4 192.168.4.0 255.255.255.0
#
traffic classifier CLASSIFIER-GBP12 operator and
if-match acl name EPG1-EPG2
#
traffic classifier CLASSIFIER-GBP13 operator and
if-match acl name EPG1-EPG3
#
traffic behavior BEHAVIOR-GBP12
accounting packet
filter deny
#
traffic behavior BEHAVIOR-GBP13
accounting packet
filter permit
#
qos policy GBP1
classifier CLASSIFIER-GBP13 behavior BEHAVIOR-GBP13
classifier CLASSIFIER-GBP12 behavior BEHAVIOR-GBP12
#
interface Vlan-interface10
ip address 192.168.1.254 255.255.255.0
isis enable 1
#
interface Vlan-interface12
ip address 12.0.0.2 255.255.255.252
isis enable 1
#
interface Vlan-interface20
ip address 192.168.2.254 255.255.255.0
isis enable 1
#
interface GigabitEthernet1/0/1
port link-type trunk
port trunk permit vlan 1 12
#
interface GigabitEthernet1/0/2
port access vlan 10
qos apply policy GBP1 inbound
#
interface GigabitEthernet1/0/3
port access vlan 20
qos apply policy GBP1 inbound
#
acl advanced name EPG1-EPG2
rule 0 permit ip source microsegment 1 destination microsegment 2
#
acl advanced name EPG1-EPG3
rule 0 permit ip source microsegment 1 destination microsegment 3
#
· Device B
#
sysname DeviceB
#
isis 1
is-level level-2
cost-style wide
network-entity 00.0000.0000.0002.00
#
address-family ipv4 unicast
#
vlan 12
#
vlan 23
#
interface Vlan-interface12
ip address 12.0.0.1 255.255.255.252
isis enable 1
#
interface Vlan-interface23
ip address 23.0.0.2 255.255.255.252
isis enable 1
#
interface GigabitEthernet1/0/1
port link-type trunk
port trunk permit vlan 1 12
#
interface GigabitEthernet1/0/2
port link-type trunk
port trunk permit vlan 1 23
#
· Device C
#
sysname DeviceC
#
isis 1
is-level level-2
cost-style wide
network-entity 00.0000.0000.0003.00
#
address-family ipv4 unicast
#
vlan 23
#
vlan 30
#
vlan 40
#
microsegment enable
#
microsegment 1 name EPG1
member ipv4 192.168.1.0 255.255.255.0
member ipv4 192.168.2.0 255.255.255.0
#
microsegment 2 name EPG2
member ipv4 192.168.3.0 255.255.255.0
#
microsegment 3 name EPG3
member ipv4 192.168.4.0 255.255.255.0
#
traffic classifier CLASSIFIER-GBP21 operator and
if-match acl name EPG2-EPG1
#
traffic classifier CLASSIFIER-GBP23 operator and
if-match acl name EPG2-EPG3
#
traffic classifier CLASSIFIER-GBP31 operator and
if-match acl name EPG3-EPG1
#
traffic classifier CLASSIFIER-GBP32 operator and
if-match acl name EPG3-EPG2
#
traffic behavior BEHAVIOR-GBP21
accounting packet
filter deny
#
traffic behavior BEHAVIOR-GBP23
accounting packet
filter permit
#
traffic behavior BEHAVIOR-GBP31
accounting packet
filter permit
#
traffic behavior BEHAVIOR-GBP32
accounting packet
filter permit
#
qos policy GBP2
classifier CLASSIFIER-GBP23 behavior BEHAVIOR-GBP23
classifier CLASSIFIER-GBP21 behavior BEHAVIOR-GBP21
#
qos policy GBP3
classifier CLASSIFIER-GBP31 behavior BEHAVIOR-GBP31
classifier CLASSIFIER-GBP32 behavior BEHAVIOR-GBP32
#
interface Vlan-interface23
ip address 23.0.0.1 255.255.255.252
isis enable 1
#
interface Vlan-interface30
ip address 192.168.3.254 255.255.255.0
isis enable 1
#
interface Vlan-interface40
ip address 192.168.2.254 255.255.255.0
isis enable 1
#
interface GigabitEthernet1/0/1
port link-type trunk
port trunk permit vlan 1 23
#
interface GigabitEthernet1/0/2
port access vlan 30
qos apply policy GBP2 inbound
#
interface GigabitEthernet1/0/3
port access vlan 40
qos apply policy GBP3 inbound
#
acl advanced name EPG2-EPG1
rule 0 permit ip source microsegment 2 destination microsegment 1
#
acl advanced name EPG2-EPG3
rule 0 permit ip source microsegment 2 destination microsegment 3
#
acl advanced name EPG3-EPG1
rule 0 permit ip source microsegment 3 destination microsegment 1
#
acl advanced name EPG3-EPG2
rule 0 permit ip source microsegment 3 destination microsegment 2
#
Host A与Host B由Device A接入EVPN网络,General Server由Device C接入EVPN网络。现通过配置微分段功能,实现如下需求:
· Host A、Host B可以互相访问。
· Host A禁止访问General Server,Host B可以访问General Server。
表1-3 组网图示例接口与设备实际接口对应关系
组网图示例接口 |
设备实际接口 |
Interface2 |
GigabitEthernet1/0/2 |
Interface3 |
GigabitEthernet1/0/3 |
(1) 将Host A加入微分段1,Host B加入微分段2,General Server加入微分段3。
(2) 配置策略路由,允许微分段1和微分段2互通,允许微分段2和微分段3互通,禁止微分段1和微分段3互通。
(3) Device A和Device C为分布式EVPN网关。Host A和General Server属于VXLAN 10,Host B和File Server属于VXLAN 20。相同VXLAN之间通过二层互通,不同VXLAN之间通过分布式EVPN网关实现三层互通。
(4) Device A上需要手工配置微分段1和微分段2,Device C上需要手工配置微分段3,微分段的成员信息会通过BGP EVPN路由同步至对端设备上。
请在系统视图下执行system-working-mode expert命令将系统工作模式配置为专家模式,微分段功能才能正常使用。
请注意配置时保证报文源和目的地址的掩码长度与微分段成员的地址掩码长度一致,否则ACL规则中指定的微分段成员可能无法匹配到报文。
(1) 配置Device A
# 创建VLAN,配置各VLAN接口的IP地址。
<Sysname> system-view
[Sysname] sysname DeviceA
[DeviceA] vlan 10
[DeviceA-vlan10] port gigabitethernet 1/0/2
[DeviceA-vlan10] quit
[DeviceA] interface gigabitethernet 1/0/2
[DeviceA-GigabitEthernet1/0/2] undo shutdown
[DeviceA-GigabitEthernet1/0/2] quit
[DeviceA] vlan 20
[DeviceA-vlan20] port gigabitethernet 1/0/3
[DeviceA-vlan20] quit
[DeviceA] interface gigabitethernet 1/0/3
[DeviceA-GigabitEthernet1/0/3] undo shutdown
[DeviceA-GigabitEthernet1/0/3] quit
[DeviceA] vlan 12
[DeviceA-vlan12] quit
[DeviceA] interface vlan-interface 12
[DeviceA-Vlan-interface12] ip address 12.0.0.2 30
[DeviceA-Vlan-interface12] undo shutdown
[DeviceA-Vlan-interface12] quit
[DeviceA] interface gigabitethernet 1/0/1
[DeviceA-GigabitEthernet1/0/1] undo shutdown
[DeviceA-GigabitEthernet1/0/1] port link-type trunk
[DeviceA-GigabitEthernet1/0/1] port trunk permit vlan 12
[DeviceA-GigabitEthernet1/0/1] quit
# 配置IS-IS使网络中路由互通。
[DeviceA] isis 1
[DeviceA-isis-1] cost-style wide
[DeviceA-isis-1] network-entity 00.0000.0000.0001.00
[DeviceA-isis-1] is-level level-2
[DeviceA-isis-1] address-family ipv4 unicast
[DeviceA-isis-1-ipv4] quit
[DeviceA-isis-1] quit
[DeviceA] interface vlan-interface 12
[DeviceA-Vlan-interface12] isis enable 1
[DeviceA-Vlan-interface12] quit
[DeviceA] interface LoopBack0
[DeviceA-LoopBack0] ip address 1.1.1.1 32
[DeviceA-LoopBack0] isis enable 1
[DeviceA-LoopBack0] quit
# 开启L2VPN能力。
[DeviceA] l2vpn enable
# 关闭远端MAC地址和远端ARP自动学习功能。
[DeviceA] vxlan tunnel mac-learning disable
[DeviceA] vxlan tunnel arp-learning disable
# 在VSI实例vpna下创建EVPN实例,并配置自动生成EVPN实例的RD和RT。
[DeviceA] vsi vpna
[DeviceA-vsi-vpna] evpn encapsulation vxlan
[DeviceA-vsi-vpna-evpn-vxlan] route-distinguisher auto
[DeviceA-vsi-vpna-evpn-vxlan] vpn-target auto
[DeviceA-vsi-vpna-evpn-vxlan] quit
# 创建VXLAN 10。
[DeviceA-vsi-vpna] vxlan 10
[DeviceA-vsi-vpna-vxlan-10] quit
[DeviceA-vsi-vpna] quit
# 在VSI实例vpnb下创建EVPN实例,并配置自动生成EVPN实例的RD和RT。
[DeviceA] vsi vpnb
[DeviceA-vsi-vpnb] evpn encapsulation vxlan
[DeviceA-vsi-vpnb-evpn-vxlan] route-distinguisher auto
[DeviceA-vsi-vpnb-evpn-vxlan] vpn-target auto
[DeviceA-vsi-vpnb-evpn-vxlan] quit
# 创建VXLAN 20。
[DeviceA-vsi-vpnb] vxlan 20
[DeviceA-vsi-vpnb-vxlan-20] quit
[DeviceA-vsi-vpnb] quit
# 在VSI实例vpnc下创建EVPN实例,并配置自动生成EVPN实例的RD和RT。
[DeviceA] vsi vpnc
[DeviceA-vsi-vpnc] evpn encapsulation vxlan
[DeviceA-vsi-vpnc-evpn-vxlan] route-distinguisher auto
[DeviceA-vsi-vpnc-evpn-vxlan] vpn-target auto
[DeviceA-vsi-vpnc-evpn-vxlan] quit
# 创建VXLAN 30。
[DeviceA-vsi-vpnc] vxlan 30
[DeviceA-vsi-vpnc-vxlan-30] quit
[DeviceA-vsi-vpnc] quit
# 配置BGP发布EVPN路由。
[DeviceA] bgp 100
[DeviceA-bgp-default] peer 3.3.3.3 as-number 100
[DeviceA-bgp-default] peer 3.3.3.3 connect-interface loopback 0
[DeviceA-bgp-default] address-family l2vpn evpn
[DeviceA-bgp-default-evpn] peer 3.3.3.3 enable
[DeviceA-bgp-default-evpn] quit
[DeviceA-bgp-default] quit
# 在接入Host A的接口GigabitEthernet1/0/2上创建以太网服务实例1000,该实例用来匹配VLAN 10的数据帧。
[DeviceA] interface gigabitethernet 1/0/2
[DeviceA-GigabitEthernet1/0/2] service-instance 1000
[DeviceA-GigabitEthernet1/0/2-srv1000] encapsulation s-vid 10
# 配置以太网服务实例1000与VSI实例vpna关联。
[DeviceA-GigabitEthernet1/0/2-srv1000] xconnect vsi vpna
[DeviceA-GigabitEthernet1/0/2-srv1000] quit
# 在接入Host B的接口GigabitEthernet1/0/3上创建以太网服务实例2000,该实例用来匹配VLAN 20的数据帧。
[DeviceA] interface gigabitethernet 1/0/3
[DeviceA-GigabitEthernet1/0/3] service-instance 2000
[DeviceA-GigabitEthernet1/0/3-srv2000] encapsulation s-vid 20
# 配置以太网服务实例2000与VSI实例vpnb关联。
[DeviceA-GigabitEthernet1/0/3-srv2000] xconnect vsi vpnb
[DeviceA-GigabitEthernet1/0/3-srv2000] quit
[DeviceA-GigabitEthernet1/0/3] quit
# 配置L3VNI的RD和RT。
[DeviceA] ip vpn-instance l3vpna
[DeviceA-vpn-instance-l3vpna] route-distinguisher 1:1
[DeviceA-vpn-instance-l3vpna] address-family ipv4
[DeviceA-vpn-ipv4-l3vpna] vpn-target 2:2
[DeviceA-vpn-ipv4-l3vpna] quit
[DeviceA-vpn-instance-l3vpna] address-family evpn
[DeviceA-vpn-evpn-l3vpna] vpn-target 1:1
[DeviceA-vpn-evpn-l3vpna] quit
[DeviceA-vpn-instance-l3vpna] quit
# 配置VSI虚接口VSI-interface1。
[DeviceA] interface vsi-interface 1
[DeviceA-Vsi-interface1] ip binding vpn-instance l3vpna
[DeviceA-Vsi-interface1] ip address 192.168.1.254 24
[DeviceA-Vsi-interface1] mac-address 1-1-1
[DeviceA-Vsi-interface1] distributed-gateway local
[DeviceA-Vsi-interface1] local-proxy-arp enable
[DeviceA-Vsi-interface1] quit
# 配置VSI虚接口VSI-interface2。
[DeviceA] interface vsi-interface 2
[DeviceA-Vsi-interface2] ip binding vpn-instance l3vpna
[DeviceA-Vsi-interface2] ip address 192.168.2.254 24
[DeviceA-Vsi-interface2] mac-address 2-2-2
[DeviceA-Vsi-interface2] distributed-gateway local
[DeviceA-Vsi-interface2] local-proxy-arp enable
[DeviceA-Vsi-interface2] quit
# 配置VSI虚接口VSI-interface3。
[DeviceA] interface vsi-interface 3
[DeviceA-Vsi-interface1] ip binding vpn-instance l3vpna
[DeviceA-Vsi-interface1] ip address 192.168.3.254 24
[DeviceA-Vsi-interface1] mac-address 3-3-3
[DeviceA-Vsi-interface1] distributed-gateway local
[DeviceA-Vsi-interface1] local-proxy-arp enable
[DeviceA-Vsi-interface1] quit
# 创建VSI虚接口VSI-interface4,在该接口上配置VPN实例l3vpna对应的L3VNI为1000。
[DeviceA] interface vsi-interface 4
[DeviceA-Vsi-interface4] ip binding vpn-instance l3vpna
[DeviceA-Vsi-interface4] l3-vni 1000
[DeviceA-Vsi-interface4] quit
# 配置VXLAN 10所在的VSI实例和接口VSI-interface1关联。
[DeviceA] vsi vpna
[DeviceA-vsi-vpna] gateway vsi-interface 1
[DeviceA-vsi-vpna] quit
# 配置VXLAN 20所在的VSI实例和接口VSI-interface2关联。
[DeviceA] vsi vpnb
[DeviceA-vsi-vpnb] gateway vsi-interface 2
[DeviceA-vsi-vpnb] quit
# 配置VXLAN 30所在的VSI实例和接口VSI-interface3关联。
[DeviceA] vsi vpnc
[DeviceA-vsi-vpnc] gateway vsi-interface 3
[DeviceA-vsi-vpnc] quit
# 创建微分段1,将Host A的IP地址添加为微分段1的成员。
[DeviceA] microsegment 1 name EPG1
[DeviceA-microsegment-1] member ipv4 192.168.1.1 24 vpn-instance l3vpna
[DeviceA-microsegment-1] quit
# 创建微分段2,将Host B的IP地址添加为微分段2的成员。
[DeviceA] microsegment 2 name EPG2
[DeviceA-microsegment-2] member ipv4 192.168.2.1 24 vpn-instance l3vpna
[DeviceA-microsegment-2] quit
# 开启微分段功能。
[DeviceA] microsegment enable
# 创建名为EPG1-EPG3的IPv4高级ACL,并配置规则:协议类型为ip,源微分段为微分段1,目的微分段为微分段3。
[DeviceA] acl advanced name EPG1-EPG3
[DeviceA-acl-ipv4-adv-EPG1-EPG3] rule 0 permit ip source microsegment 1 destination microsegment 3
[Device-acl-ipv4-adv-EPG1-EPG3] quit
# 创建名为EPG1-EPG2的IPv4高级ACL,并配置规则:协议类型为ip,源微分段为微分段1,目的微分段为微分段2。
[DeviceA] acl advanced name EPG1-EPG2
[DeviceA-acl-ipv4-adv-EPG1-EPG2] rule 0 permit ip source microsegment 1 destination microsegment 2
[DeviceA-acl-ipv4-adv-EPG1-EPG2] quit
# 创建名为EPG2-EPG3的IPv4高级ACL,并配置规则:协议类型为ip,源微分段为微分段2,目的微分段为微分段3。
[DeviceA] acl advanced name EPG2-EPG3
[DeviceA-acl-ipv4-adv-EPG2-EPG3] rule 0 permit ip source microsegment 2 destination microsegment 3
[DeviceA-acl-ipv4-adv-EPG2-EPG3] quit
# 创建流分类CLASSIFIER-GBP13,引用ACL EPG1-EPG3。
[DeviceA] traffic classifier CLASSIFIER-GBP13
[DeviceA-classifier-CLASSIFIER-GBP13] if-match acl name EPG1-EPG3
[DeviceA-classifier-CLASSIFIER-GBP13] quit
# 创建流行为BEHAVIOR-GBP13,配置流量过滤动作为deny,并配置流量统计功能。
[DeviceA] traffic behavior BEHAVIOR-GBP13
[DeviceA-behavior-BEHAVIOR-GBP13] filter deny
[DeviceA-behavior-BEHAVIOR-GBP13] accounting packet
[DeviceA-behavior-BEHAVIOR-GBP13] quit
# 创建流分类CLASSIFIER-GBP12,引用ACL EPG1-EPG2。
[DeviceA] traffic classifier CLASSIFIER-GBP12
[DeviceA-classifier-CLASSIFIER-GBP12] if-match acl name EPG1-EPG2
[DeviceA-classifier-CLASSIFIER-GBP12] quit
# 创建流行为BEHAVIOR-GBP12,配置流量过滤动作为permit,并配置流量统计功能。
[DeviceA] traffic behavior BEHAVIOR-GBP12
[DeviceA-behavior-BEHAVIOR-GBP12] filter permit
[DeviceA-behavior-BEHAVIOR-GBP12] accounting packet
[DeviceA-behavior-BEHAVIOR-GBP12] quit
# 创建流分类CLASSIFIER-GBP23,引用ACL EPG2-EPG3。
[DeviceA] traffic classifier CLASSIFIER-GBP23
[DeviceA-classifier-CLASSIFIER-GBP23] if-match acl name EPG2-EPG3
[DeviceA-classifier-CLASSIFIER-GBP23] quit
# 创建流行为BEHAVIOR-GBP23,配置流量过滤动作为permit,并配置流量统计功能。
[DeviceA] traffic behavior BEHAVIOR-GBP23
[DeviceA-behavior-BEHAVIOR-GBP23] filter permit
[DeviceA-behavior-BEHAVIOR-GBP23] accounting packet
[DeviceA-behavior-BEHAVIOR-GBP23] quit
# 创建QoS策略GBP1,为流分类CLASSIFIER-GBP13指定流行为BEHAVIOR-GBP13,为流分类CLASSIFIER-GBP12指定流行为BEHAVIOR-GBP12。
[DeviceA] qos policy GBP1
[DeviceA-qospolicy-GBP1] classifier CLASSIFIER-GBP13 behavior BEHAVIOR-GBP13
[DeviceA-qospolicy-GBP1] classifier CLASSIFIER-GBP12 behavior BEHAVIOR-GBP12
[DeviceA-qospolicy-GBP1] quit
# 创建QoS策略GBP2,为流分类CLASSIFIER-GBP23指定流行为BEHAVIOR-GBP23。
[DeviceA] qos policy GBP2
[DeviceA-qospolicy-GBP2] classifier CLASSIFIER-GBP23 behavior BEHAVIOR-GBP23
[DeviceA-qospolicy-GBP2] quit
# 将QoS策略GBP1应用在GigabitEthernet1/0/2入方向上。
[DeviceA] interface gigabitethernet 1/0/2
[DeviceA-GigabitEthernet1/0/2] qos apply policy GBP1 inbound
[DeviceA-GigabitEthernet1/0/2] quit
# 将QoS策略GBP2应用在GigabitEthernet1/0/3入方向上。
[DeviceA] interface gigabitethernet 1/0/3
[DeviceA-GigabitEthernet1/0/3] qos apply policy GBP2 inbound
[DeviceA-GigabitEthernet1/0/3] quit
(2) 配置Device B
# 创建VLAN,配置各VLAN接口的IP地址。
<Sysname> system-view
[Sysname] sysname DeviceB
[DeviceB] vlan 12
[DeviceB-vlan12] quit
[DeviceB] interface vlan-interface 12
[DeviceB-Vlan-interface12] ip address 12.0.0.1 30
[DeviceB-Vlan-interface12] undo shutdown
[DeviceB-Vlan-interface12] quit
[DeviceB] interface gigabitethernet 1/0/1
[DeviceB-GigabitEthernet1/0/1] undo shutdown
[DeviceB-GigabitEthernet1/0/1] port link-type trunk
[DeviceB-GigabitEthernet1/0/1] port trunk permit vlan 12
[DeviceB-GigabitEthernet1/0/1] quit
[DeviceB] vlan 23
[DeviceB-vlan23] quit
[DeviceB] interface vlan-interface 23
[DeviceB-Vlan-interface23] ip address 23.0.0.2 30
[DeviceB-Vlan-interface23] undo shutdown
[DeviceB-Vlan-interface23] quit
[DeviceB] interface gigabitethernet 1/0/2
[DeviceB-GigabitEthernet1/0/2] undo shutdown
[DeviceB-GigabitEthernet1/0/2] port link-type trunk
[DeviceB-GigabitEthernet1/0/2] port trunk permit vlan 23
[DeviceB-GigabitEthernet1/0/2] quit
# 配置IS-IS使网络中路由互通。
[DeviceB] isis 1
[DeviceB-isis-1] cost-style wide
[DeviceB-isis-1] network-entity 00.0000.0000.0002.00
[DeviceB-isis-1] is-level level-2
[DeviceB-isis-1] address-family ipv4 unicast
[DeviceB-isis-1-ipv4] quit
[DeviceB-isis-1] quit
[DeviceB] interface vlan-interface 12
[DeviceB-Vlan-interface12] isis enable 1
[DeviceB-Vlan-interface12] quit
[DeviceB] interface vlan-interface 23
[DeviceB-Vlan-interface23] isis enable 1
[DeviceB-Vlan-interface23] quit
[DeviceB] interface LoopBack0
[DeviceB-LoopBack0] ip address 2.2.2.2 32
[DeviceB-LoopBack0] isis enable 1
[DeviceB-LoopBack0] quit
(3) 配置Device C
# 创建VLAN,配置各VLAN接口的IP地址。
<Sysname> system-view
[Sysname] sysname DeviceC
[DeviceC] vlan 30
[DeviceC-vlan30] port gigabitethernet 1/0/2
[DeviceC-vlan30] quit
[DeviceC] interface gigabitethernet 1/0/2
[DeviceC-GigabitEthernet1/0/2] undo shutdown
[DeviceC-GigabitEthernet1/0/2] quit
[DeviceC] vlan 23
[DeviceC-vlan23] quit
[DeviceC] interface vlan-interface 23
[DeviceC-Vlan-interface23] ip address 23.0.0.1 30
[DeviceC-Vlan-interface23] undo shutdown
[DeviceC-Vlan-interface23] quit
[DeviceC] interface gigabitethernet 1/0/1
[DeviceC-GigabitEthernet1/0/1] undo shutdown
[DeviceC-GigabitEthernet1/0/1] port link-type trunk
[DeviceC-GigabitEthernet1/0/1] port trunk permit vlan 23
[DeviceC-GigabitEthernet1/0/1] quit
# 配置IS-IS使网络中路由互通。
[DeviceC] isis 1
[DeviceC-isis-1] cost-style wide
[DeviceC-isis-1] network-entity 00.0000.0000.0003.00
[DeviceC-isis-1] is-level level-2
[DeviceC-isis-1] address-family ipv4 unicast
[DeviceC-isis-1-ipv4] quit
[DeviceC-isis-1] quit
[DeviceC] interface vlan-interface 23
[DeviceC-Vlan-interface23] isis enable 1
[DeviceC-Vlan-interface23] quit
[DeviceC] interface LoopBack0
[DeviceC-LoopBack0] ip address 3.3.3.3 32
[DeviceC-LoopBack0] isis enable 1
[DeviceC-LoopBack0] quit
# 开启L2VPN能力。
[DeviceC] l2vpn enable
# 关闭远端MAC地址和远端ARP自动学习功能。
[DeviceC] vxlan tunnel mac-learning disable
[DeviceC] vxlan tunnel arp-learning disable
# 在VSI实例vpna下创建EVPN实例,并配置自动生成EVPN实例的RD和RT。
[DeviceC] vsi vpna
[DeviceC-vsi-vpna] evpn encapsulation vxlan
[DeviceC-vsi-vpna-evpn-vxlan] route-distinguisher auto
[DeviceC-vsi-vpna-evpn-vxlan] vpn-target auto
[DeviceC-vsi-vpna-evpn-vxlan] quit
# 创建VXLAN 10。
[DeviceC-vsi-vpna] vxlan 10
[DeviceC-vsi-vpna-vxlan-10] quit
[DeviceC-vsi-vpna] quit
# 在VSI实例vpnb下创建EVPN实例,并配置自动生成EVPN实例的RD和RT。
[DeviceC] vsi vpnb
[DeviceC-vsi-vpnb] evpn encapsulation vxlan
[DeviceC-vsi-vpnb-evpn-vxlan] route-distinguisher auto
[DeviceC-vsi-vpnb-evpn-vxlan] vpn-target auto
[DeviceC-vsi-vpnb-evpn-vxlan] quit
# 创建VXLAN 20。
[DeviceC-vsi-vpnb] vxlan 20
[DeviceC-vsi-vpnb-vxlan-20] quit
[DeviceC-vsi-vpnb] quit
# 在VSI实例vpnc下创建EVPN实例,并配置自动生成EVPN实例的RD和RT。
[DeviceC] vsi vpnc
[DeviceC-vsi-vpnc] evpn encapsulation vxlan
[DeviceC-vsi-vpnc-evpn-vxlan] route-distinguisher auto
[DeviceC-vsi-vpnc-evpn-vxlan] vpn-target auto
[DeviceC-vsi-vpnc-evpn-vxlan] quit
# 创建VXLAN 30。
[DeviceC-vsi-vpnc] vxlan 30
[DeviceC-vsi-vpnc-vxlan-30] quit
[DeviceC-vsi-vpnc] quit
# 配置BGP发布EVPN路由。
[DeviceC] bgp 100
[DeviceC-bgp-default] peer 1.1.1.1 as-number 100
[DeviceC-bgp-default] peer 1.1.1.1 connect-interface loopback 0
[DeviceC-bgp-default] address-family l2vpn evpn
[DeviceC-bgp-default-evpn] peer 1.1.1.1 enable
[DeviceC-bgp-default-evpn] quit
[DeviceC-bgp-default] quit
# 在接入General Server的接口GigabitEthernet1/0/2上创建以太网服务实例1000,该实例用来匹配VLAN 30的数据帧。
[DeviceC] interface gigabitethernet 1/0/2
[DeviceC-GigabitEthernet1/0/2] service-instance 1000
[DeviceC-GigabitEthernet1/0/2-srv1000] encapsulation s-vid 30
# 配置以太网服务实例1000与VSI实例vpna关联。
[DeviceC-GigabitEthernet1/0/2-srv1000] xconnect vsi vpna
[DeviceC-GigabitEthernet1/0/2-srv1000] quit
# 配置L3VNI的RD和RT。
[DeviceC] ip vpn-instance l3vpna
[DeviceC-vpn-instance-l3vpna] route-distinguisher 1:1
[DeviceC-vpn-instance-l3vpna] address-family ipv4
[DeviceC-vpn-ipv4-l3vpna] vpn-target 2:2
[DeviceC-vpn-ipv4-l3vpna] quit
[DeviceC-vpn-instance-l3vpna] address-family evpn
[DeviceC-vpn-evpn-l3vpna] vpn-target 1:1
[DeviceC-vpn-evpn-l3vpna] quit
[DeviceC-vpn-instance-l3vpna] quit
# 配置VSI虚接口VSI-interface1。
[DeviceC] interface vsi-interface 1
[DeviceC-Vsi-interface1] ip binding vpn-instance l3vpna
[DeviceC-Vsi-interface1] ip address 192.168.1.254 24
[DeviceC-Vsi-interface1] mac-address 1-1-1
[DeviceC-Vsi-interface1] distributed-gateway local
[DeviceC-Vsi-interface1] local-proxy-arp enable
[DeviceC-Vsi-interface1] quit
# 配置VSI虚接口VSI-interface2。
[DeviceC] interface vsi-interface 2
[DeviceC-Vsi-interface2] ip binding vpn-instance l3vpna
[DeviceC-Vsi-interface2] ip address 192.168.2.254 24
[DeviceC-Vsi-interface2] mac-address 2-2-2
[DeviceC-Vsi-interface2] distributed-gateway local
[DeviceC-Vsi-interface2] local-proxy-arp enable
[DeviceC-Vsi-interface2] quit
# 配置VSI虚接口VSI-interface3。
[DeviceC] interface vsi-interface 3
[DeviceC-Vsi-interface1] ip binding vpn-instance l3vpna
[DeviceC-Vsi-interface1] ip address 192.168.3.254 24
[DeviceC-Vsi-interface1] mac-address 3-3-3
[DeviceC-Vsi-interface1] distributed-gateway local
[DeviceC-Vsi-interface1] local-proxy-arp enable
[DeviceC-Vsi-interface1] quit
# 创建VSI虚接口VSI-interface4,在该接口上配置VPN实例l3vpna对应的L3VNI为1000。
[DeviceC] interface vsi-interface 4
[DeviceC-Vsi-interface4] ip binding vpn-instance l3vpna
[DeviceC-Vsi-interface4] l3-vni 1000
[DeviceC-Vsi-interface4] quit
# 配置VXLAN 10所在的VSI实例和接口VSI-interface1关联。
[DeviceC] vsi vpna
[DeviceC-vsi-vpna] gateway vsi-interface 1
[DeviceC-vsi-vpna] quit
# 配置VXLAN 20所在的VSI实例和接口VSI-interface2关联。
[DeviceC] vsi vpnb
[DeviceC-vsi-vpnb] gateway vsi-interface 2
[DeviceC-vsi-vpnb] quit
# 配置VXLAN 30所在的VSI实例和接口VSI-interface3关联。
[DeviceC] vsi vpnc
[DeviceC-vsi-vpnc] gateway vsi-interface 3
[DeviceC-vsi-vpnc] quit
# 创建微分段3,将General Server的IP地址添加为微分段3的成员。
[DeviceC] microsegment 3 name EPG3
[DeviceC-microsegment-3] member ipv4 192.168.3.1 24 vpn-instance l3vpna
[DeviceC-microsegment-3] quit
# 在Device C上执行display bgp l2vpn evpn命令可以查看详细的EVPN路由信息,查看IP地址为192.168.1.1的MAC/IP发布路由,可见该路由携带的扩展团体属性Ext-Community中包含所属微分段信息,表示EVPN路由学习正常。
[DeviceC] display bgp l2vpn evpn [2][0][48][6e7f-a8c5-0407][32][192.168.1.1]/136
BGP local router ID: 3.3.3.3
Local AS number: 100
Route distinguisher: 1:2(l3vpna)
Total number of routes: 1
Paths: 1 available, 1 best
BGP routing table information of [2][0][48][6e7f-a8c5-0407][32][192.168.1.1]/136:
From : 1.1.1.1 (1.1.1.1)
Rely nexthop : 23.0.0.2
Original nexthop: 1.1.1.1
Route age : 00h02m32s
OutLabel : NULL
Ext-Community : <RT: 1:1>, <RT: 100:10>, <Encapsulation Type: VXLAN>, <Route
r's MAC: 6e7f-9995-0100>, <MicroSegment-id: Type 0x83ff, ID
1>
RxPathID : 0x0
TxPathID : 0x0
AS-path : (null)
Origin : igp
Attribute value : MED 0, localpref 100, pref-val 0
State : valid, internal, best, remoteredist
IP precedence : N/A
QoS local ID : N/A
Traffic index : N/A
EVPN route type : MAC/IP advertisement route
ESI : 0000.0000.0000.0000.0000
Ethernet tag ID : 0
MAC address : 6e7f-a8c5-0407
IP address : 192.168.1.1/32
MPLS label1 : 10
MPLS label2 : 1000
Tunnel policy : NULL
Rely tunnel IDs : N/A
…
# 分别在Host A和Host B上检查到General Server是否可达。发现Host A无法访问General Server。
C:\> ping 192.168.3.1
Pinging 192.168.3.1 with 32 bytes of data:
Request timed out
Request timed out
Request timed out
Request timed out
Ping statistics for 192.168.3.1:
Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),
Host B可以ping通General Server。
# 查看Device A上各微分段的配置信息。
[DeviceA] display microsegment 1
Microsegment ID : 1
Microsegment name : EPG1
IPv4 member:
192.168.1.1/24
[DeviceA] display microsegment 2
Microsegment ID : 2
Microsegment name : EPG2
IPv4 member:
192.168.2.1/24
[DeviceA] display microsegment 3
Microsegment ID : 3
Microsegment name : EPG3
IPv4 member:
192.168.2.1/24
# 查看Device A上微分段的概要和状态信息。
[DeviceA] display microsegment
Microsegment status: Enabled
Total microsegments: 3
Microsegment list :
Microsegment ID Members Microsegment name
1 1 EPG1
2 1 EPG2
3 1 EPG3
# 查看Device A接口上QoS策略的配置信息和运行情况。
[DeviceA] display qos policy interface GigabitEthernet1/0/2
Interface: GigabitEthernet1/0/2
Direction: Inbound
Policy: GBP1
Classifier: CLASSIFIER-GBP13
Rule(s) :
If-match acl name EPG1-EPG3
Behavior: BEHAVIOR-GBP13
Accounting enable:
5 (Packets)
0 (pps)
Filter enable: Deny
Classifier: CLASSIFIER-GBP12
Rule(s) :
If-match acl name EPG1-EPG2
Behavior: BEHAVIOR-GBP12
Accounting enable:
5 (Packets)
0 (pps)
Filter enable: Permit
· Device A
#
sysname DeviceA
#
ip vpn-instance l3vpna
route-distinguisher 1:1
#
address-family ipv4
vpn-target 2:2 import-extcommunity
vpn-target 2:2 export-extcommunity
#
address-family evpn
vpn-target 1:1 import-extcommunity
vpn-target 1:1 export-extcommunity
#
vxlan tunnel mac-learning disable
#
isis 1
is-level level-2
cost-style wide
network-entity 00.0000.0000.0001.00
#
address-family ipv4 unicast
#
vlan 10
#
vlan 12
#
vlan 20
#
microsegment enable
#
microsegment 1 name EPG1
member ipv4 192.168.1.0 255.255.255.0 vpn-instance l3vpna
#
microsegment 2 name EPG2
member ipv4 192.168.2.0 255.255.255.0 vpn-instance l3vpna
#
traffic classifier CLASSIFIER-GBP12 operator and
if-match acl name EPG1-EPG2
#
traffic classifier CLASSIFIER-GBP13 operator and
if-match acl name EPG1-EPG3
#
traffic classifier CLASSIFIER-GBP23 operator and
if-match acl name EPG2-EPG3
#
traffic behavior BEHAVIOR-GBP12
accounting packet
filter permit
#
traffic behavior BEHAVIOR-GBP13
accounting packet
filter deny
#
traffic behavior BEHAVIOR-GBP23
accounting packet
filter permit
#
qos policy GBP1
classifier CLASSIFIER-GBP13 behavior BEHAVIOR-GBP13
classifier CLASSIFIER-GBP12 behavior BEHAVIOR-GBP12
#
qos policy GBP2
classifier CLASSIFIER-GBP23 behavior BEHAVIOR-GBP23
#
l2vpn enable
vxlan tunnel arp-learning disable
#
vsi vpna
gateway Vsi-interface 1
vxlan 10
evpn encapsulation vxlan
route-distinguisher auto
vpn-target auto export-extcommunity
vpn-target auto import-extcommunity
#
vsi vpnb
gateway Vsi-interface 2
vxlan 20
evpn encapsulation vxlan
route-distinguisher auto
vpn-target auto export-extcommunity
vpn-target auto import-extcommunity
#
vsi vpnc
gateway Vsi-interface 3
vxlan 30
evpn encapsulation vxlan
route-distinguisher auto
vpn-target auto export-extcommunity
vpn-target auto import-extcommunity
#
interface LoopBack0
ip address 1.1.1.1 255.255.255.255
isis enable 1
#
interface Vlan-interface12
ip address 12.0.0.2 255.255.255.252
isis enable 1
#
interface GigabitEthernet1/0/1
port link-type trunk
port trunk permit vlan 1 12
#
interface GigabitEthernet1/0/2
port access vlan 10
qos apply policy GBP1 inbound
#
service-instance 1000
encapsulation s-vid 10
xconnect vsi vpna
#
interface GigabitEthernet1/0/3
port access vlan 20
qos apply policy GBP2 inbound
#
service-instance 2000
encapsulation s-vid 20
xconnect vsi vpnb
#
#
interface Vsi-interface1
ip binding vpn-instance l3vpna
ip address 192.168.1.254 255.255.255.0
mac-address 0001-0001-0001
local-proxy-arp enable
distributed-gateway local
#
interface Vsi-interface2
ip binding vpn-instance l3vpna
ip address 192.168.2.254 255.255.255.0
mac-address 0002-0002-0002
local-proxy-arp enable
distributed-gateway local
#
interface Vsi-interface3
ip binding vpn-instance l3vpna
ip address 192.168.3.254 255.255.255.0
mac-address 0003-0003-0003
local-proxy-arp enable
distributed-gateway local
#
interface Vsi-interface4
ip binding vpn-instance l3vpna
l3-vni 1000
#
bgp 100
router-id 1.1.1.1
peer 3.3.3.3 as-number 100
peer 3.3.3.3 connect-interface LoopBack0
#
address-family l2vpn evpn
peer 3.3.3.3 enable
#
acl advanced name EPG1-EPG2
rule 0 permit ip source microsegment 1 destination microsegment 2
#
acl advanced name EPG1-EPG3
rule 0 permit ip source microsegment 1 destination microsegment 3
#
acl advanced name EPG2-EPG3
rule 0 permit ip source microsegment 2 destination microsegment 3
#
· Device B
#
sysname DeviceB
#
isis 1
is-level level-2
cost-style wide
network-entity 00.0000.0000.0002.00
#
address-family ipv4 unicast
#
vlan 12
#
vlan 23
#
interface LoopBack0
ip address 2.2.2.2 255.255.255.255
isis enable 1
#
interface Vlan-interface12
ip address 12.0.0.1 255.255.255.252
isis enable 1
#
interface Vlan-interface23
ip address 23.0.0.2 255.255.255.252
isis enable 1
#
interface GigabitEthernet1/0/1
port link-type trunk
port trunk permit vlan 1 12
#
interface GigabitEthernet1/0/2
port link-type trunk
port trunk permit vlan 1 23
#
· Device C
#
sysname DeviceC
#
ip vpn-instance l3vpna
route-distinguisher 1:2
#
address-family ipv4
vpn-target 2:2 import-extcommunity
vpn-target 2:2 export-extcommunity
#
address-family evpn
vpn-target 1:1 import-extcommunity
vpn-target 1:1 export-extcommunity
#
vxlan tunnel mac-learning disable
#
isis 1
is-level level-2
cost-style wide
network-entity 00.0000.0000.0003.00
#
address-family ipv4 unicast
vlan 23
#
vlan 30
#
vlan 40
#
microsegment enable
#
microsegment 3 name EPG3
member ipv4 192.168.3.0 255.255.255.0 vpn-instance l3vpna
#
l2vpn enable
vxlan tunnel arp-learning disable
#
vsi vpna
gateway Vsi-interface 1
vxlan 10
evpn encapsulation vxlan
route-distinguisher auto
vpn-target auto export-extcommunity
vpn-target auto import-extcommunity
#
vsi vpnb
gateway Vsi-interface 2
vxlan 20
evpn encapsulation vxlan
route-distinguisher auto
vpn-target auto export-extcommunity
vpn-target auto import-extcommunity
#
vsi vpnc
gateway Vsi-interface 3
vxlan 30
evpn encapsulation vxlan
route-distinguisher auto
vpn-target auto export-extcommunity
vpn-target auto import-extcommunity
#
interface LoopBack0
ip address 3.3.3.3 255.255.255.255
isis enable 1
#
interface Vlan-interface23
ip address 23.0.0.1 255.255.255.252
isis enable 1
#
interface GigabitEthernet1/0/1
port link-type trunk
port trunk permit vlan 1 23
#
interface GigabitEthernet1/0/2
port access vlan 30
#
service-instance 1000
encapsulation s-vid 30
xconnect vsi vpnc
#
interface Vsi-interface1
ip binding vpn-instance l3vpna
ip address 192.168.1.254 255.255.255.0
mac-address 0001-0001-0001
local-proxy-arp enable
distributed-gateway local
#
interface Vsi-interface2
ip binding vpn-instance l3vpna
ip address 192.168.2.254 255.255.255.0
mac-address 0002-0002-0002
local-proxy-arp enable
distributed-gateway local
#
interface Vsi-interface3
ip binding vpn-instance l3vpna
ip address 192.168.3.254 255.255.255.0
mac-address 0003-0003-0003
local-proxy-arp enable
distributed-gateway local
#
interface Vsi-interface4
ip binding vpn-instance l3vpna
l3-vni 1000
#
bgp 100
router-id 3.3.3.3
peer 1.1.1.1 as-number 100
peer 1.1.1.1 connect-interface LoopBack0
#
address-family l2vpn evpn
peer 1.1.1.1 enable
#
不同款型规格的资料略有差异, 详细信息请向具体销售和400咨询。H3C保留在没有任何通知或提示的情况下对资料内容进行修改的权利!