01-H3C_S12500_端口隔离典型配置举例
本章节下载: 01-H3C_S12500_端口隔离典型配置举例 (211.47 KB)
目 录
本文档介绍了端口隔离的配置举例。
本文档中的配置均是在实验室环境下进行的配置和验证,配置前设备的所有参数均采用出厂时的缺省配置。如果您已经对设备进行了配置,为了保证配置效果,请确认现有配置和以下举例中的配置不冲突。
本文假设您已了解端口隔离特性。
当设备配置了IRF增强功能时,不支持端口隔离。有关IRF增强功能的介绍,请参见“虚拟化技术配置指导”中的“IRF”。
在IRF模式下,请不要同时配置隔离组和精简型二层聚合组,否则会导致报文转发异常。有关精简型二层聚合组的介绍,请参见“二层技术-以太网交换配置指导”中的“以太网链路聚合”。
如图1所示:
· Site 1和Site 2是某公司的两个部门,分别在VLAN 2和VLAN 3上承载业务,并接入Device A。
· Device A通过Ten-GigabitEthernet1/0/1端口与外部网络相连。
· 公司希望这两个部门都可以通过Device A和外部网络通信,但两部门内部的二层流量都互相隔离。
本举例是在S12500-CMW710-R7328P02版本上进行配置和验证的。
· 缺省情况下,以太网接口、VLAN接口及聚合接口均处于down状态。如果要使这些接口能够正常工作,请先使用undo shutdown命令使接口状态处于up状态。
· 在设备上将端口加入到指定的隔离组中前,必须先完成该隔离组的创建。
· 一个端口最多只能加入一个隔离组。
# 在Device A上创建VLAN 2和VLAN 3,将端口Ten-GigabitEthernet1/0/1的链路类型配置为Trunk,并允许VLAN 2和VLAN 3的报文通过。将端口Ten-GigabitEthernet1/0/2和Ten-GigabitEthernet1/0/3加入VLAN2;将端口Ten-GigabitEthernet1/0/4和Ten-GigabitEthernet1/0/5加入VLAN3。
<DeviceA> system-view
[DeviceA] vlan 2
[DeviceA-vlan2] port ten-gigabitethernet 1/0/2
[DeviceA-vlan2] port ten-gigabitethernet 1/0/3
[DeviceA-vlan2] quit
[DeviceA] vlan 3
[DeviceA-vlan3] port ten-gigabitethernet 1/0/4
[DeviceA-vlan3] port ten-gigabitethernet 1/0/5
[DeviceA-vlan3] quit
[DeviceA] interface ten-gigabitethernet 1/0/1
[DeviceA-Ten-GigabitEthernet1/0/1] port link-type trunk
[DeviceA-Ten-GigabitEthernet1/0/1] port trunk permit vlan 2 3
[DeviceA-Ten-GigabitEthernet1/0/1] quit
# 创建隔离组1和隔离组2。
[DeviceA] port-isolate group 1
[DeviceA-port-isolate-group1] quit
[DeviceA] port-isolate group 2
[DeviceA-port-isolate-group2] quit
# 将端口Ten-GigabitEthernet1/0/2、Ten-GigabitEthernet1/0/3加入隔离组1;将Ten-GigabitEthernet1/0/4、Ten-GigabitEthernet1/0/5加入隔离组2。
[DeviceA] interface ten-gigabitethernet 1/0/2
[DeviceA-Ten-GigabitEthernet1/0/2] port-isolate enable group 1
[DeviceA-Ten-GigabitEthernet1/0/2] quit
[DeviceA] interface ten-gigabitethernet 1/0/3
[DeviceA-Ten-GigabitEthernet1/0/3] port-isolate enable group 1
[DeviceA-Ten-GigabitEthernet1/0/3] quit
[DeviceA] interface ten-gigabitethernet 1/0/4
[DeviceA-Ten-GigabitEthernet1/0/4] port-isolate enable group 2
[DeviceA-Ten-GigabitEthernet1/0/4] quit
[DeviceA] interface ten-gigabitethernet 1/0/5
[DeviceA-Ten-GigabitEthernet1/0/5] port-isolate enable group 2
[DeviceA-Ten-GigabitEthernet1/0/5] quit
# 显示所有隔离组的信息。
[DeviceA] display port-isolate group
Port isolation group information:
Group ID: 1
Group members:
Ten-GigabitEthernet1/0/2
Ten-GigabitEthernet1/0/3
Group ID: 2
Group members:
Ten-GigabitEthernet1/0/4
Ten-GigabitEthernet1/0/5
以上信息显示:
· DeviceA上的端口Ten-GigabitEthernet1/0/2、Ten-GigabitEthernet1/0/3已经加入隔离组1,从而实现二层隔离,分别对应的Host A和Host B彼此之间不能Ping通。
· Device A上的端口Ten-GigabitEthernet1/0/4、Ten-GigabitEthernet1/0/5已经加入隔离组2,从而实现二层隔离,分别对应的Host C和Host D彼此之间不能Ping通。
#
port-isolate group 1
port-isolate group 2
#
vlan 2 to 3
#
interface Ten-GigabitEthernet1/0/1
port link-mode bridge
port link-type trunk
port trunk permit vlan 1 to 3
#
interface Ten-GigabitEthernet1/0/2
port link-mode bridge
port access vlan 2
port-isolate enable group 1
#
interface Ten-GigabitEthernet1/0/3
port link-mode bridge
port access vlan 2
port-isolate enable group 1
#
interface Ten-GigabitEthernet1/0/4
port link-mode bridge
port access vlan 3
port-isolate enable group 2
#
interface Ten-GigabitEthernet1/0/5
port link-mode bridge
port access vlan 3
port-isolate enable group 2
#
如图2所示:
· Site 1和Site 2是某公司的两个部门,都在VLAN 2和VLAN 3上承载业务,分别通过Device B和C接入Device A,并通过网关设备Device G与外界通信。
· 根据公司安全策略,Site 1和Site 2之间只允许VLAN 3的设备互相通信,其他VLAN的设备都互相隔离。而Device G由于VLAN资源限制,不能分配更多VLAN给Site 1和Site 2用于二层隔离。
要求通过配置端口隔离和非隔离VLAN功能,实现:
· Site 1和Site 2之间除VLAN 3之外的所有设备都二层隔离。
· 所有用户均可以和Device G通信。
· 由于Site 1和Site 2的二层流量上行到Device A,将Device A的用户侧端口GE1/0/2和GE1/0/3加入隔离组,就能隔离Site 1和Site 2之间的二层流量。
· 要使Site 1和Site 2之间VLAN 3的报文能够互通,需要在Device A的隔离组中指定VLAN 3为非隔离VLAN。
· 要使所有用户都能和Device G通信,则Device A接入Device G的上行端口GE1/0/1必须和用户侧端口二层互通,因此该上行端口不加入隔离组。
如果将Device A的上行端口也加入隔离组,则Device G和用户之间只有非隔离VLAN 3的报文可以互通,其他VLAN的报文不能互通。
本举例是在S12500-CMW710-R7328P02版本上进行配置和验证的。
只有运行模式为独立运行模式,或处于IRF模式但没有配置IRF增强功能的设备支持非隔离VLAN功能。
(1) 配置Device A
# 创建VLAN 2和VLAN 3,将设备的各端口配置为Trunk端口并允许VLAN 2、3的报文通过。
[DeviceA] vlan 2 to 3
[DeviceA] interface range gigabitethernet 1/0/1 to gigabitethernet 1/0/3
[DeviceA-if-range] port link-mode bridge
[DeviceA-if-range] port link-type trunk
[DeviceA-if-range] port trunk permit vlan 2 3
[DeviceA-if-range] undo shutdown
[DeviceA-if-range] quit
# 创建隔离组1,并配置该隔离组中的VLAN 3为非隔离VLAN。
[DeviceA] port-isolate group 1
[DeviceA-port-isolate-group1] community-vlan vlan 3
[DeviceA-port-isolate-group1] quit
# 将用户侧端口GigabitEthernet1/0/2和GigabitEthernet1/0/3加入隔离组1。
[DeviceA] interface range gigabitethernet 1/0/2 to gigabitethernet 1/0/3
[DeviceA-if-range] port-isolate enable group 1
[DeviceA-if-range] quit
(2) 配置Device B、C
Device B、C的配置相同,这里以Device B为例。
# 创建VLAN 2和VLAN 3,并将用户侧端口GigabitEthernet1/0/2加入VLAN 2,GigabitEthernet1/0/3加入VLAN 3。
[DeviceB] vlan 2 to 3
[DeviceB] interface gigabitethernet 1/0/2
[DeviceB-GigabitEthernet1/0/2] port link-mode bridge
[DeviceB-GigabitEthernet1/0/2] port access vlan 2
[DeviceB-GigabitEthernet1/0/2] undo shutdown
[DeviceB-GigabitEthernet1/0/2] quit
[DeviceB] interface gigabitethernet 1/0/3
[DeviceB-GigabitEthernet1/0/3] port link-mode bridge
[DeviceB-GigabitEthernet1/0/3] port access vlan 3
[DeviceB-GigabitEthernet1/0/3] undo shutdown
[DeviceB-GigabitEthernet1/0/3] quit
# 配置上行端口的链路类型为Trunk,并允许VLAN 2和3的报文通过。
[DeviceB] interface gigabitethernet 1/0/1
[DeviceB-GigabitEthernet1/0/1] port link-mode bridge
[DeviceB-GigabitEthernet1/0/1] port link-type trunk
[DeviceB-GigabitEthernet1/0/1] port trunk permit vlan 2 3
[DeviceB-GigabitEthernet1/0/1] undo shutdown
[DeviceB-GigabitEthernet1/0/1] quit
(3) 配置Device G
# 创建VLAN 2和VLAN 3,将下行端口配置为Trunk端口并允许VLAN 2和3的报文通过。
<DeviceG> system-view
[DeviceG] vlan 2 to 3
[DeviceG] interface gigabitethernet 1/0/1
[DeviceG-GigabitEthernet1/0/1] port link-mode bridge
[DeviceG-GigabitEthernet1/0/1] port link-type trunk
[DeviceG-GigabitEthernet1/0/1] port trunk permit vlan 2 3
[DeviceG-GigabitEthernet1/0/1] undo shutdown
[DeviceG-GigabitEthernet1/0/1] quit
# 配置网关接口VLAN-interface2和VLAN-interface3。
[DeviceG] interface vlan-interface 2
[DeviceG-Vlan-interface2] ip address 10.0.2.1 24
[DeviceG-Vlan-interface2] undo shutdown
[DeviceG-Vlan-interface2] quit
[DeviceG] interface vlan-interface 3
[DeviceG-Vlan-interface3] ip address 10.0.3.1 24
[DeviceG-Vlan-interface3] undo shutdown
[DeviceG-Vlan-interface3] quit
# Device G可以ping通所有用户。查看ARP表,可以看到Device G学习到了VLAN 2~3用户的ARP表项。
[DeviceG] display arp
Type: S-Static D-Dynamic O-Openflow M-Multiport I-Invalid
IP address MAC address VLAN Interface Aging Type
10.0.2.2 d485-64a1-7e4a 2 GE1/0/1 19 D
10.0.2.3 7446-a0aa-7774 2 GE1/0/1 19 D
10.0.3.2 6805-ca05-39ae 3 GE1/0/1 20 D
10.0.3.3 6805-ca05-414e 3 GE1/0/1 20 D
# 显示Device A上隔离组1的配置情况。
[DeviceA] display port-isolate group 1
Port isolation group information:
Group ID: 1
Group members:
GigabitEthernet1/0/2 GigabitEthernet1/0/3
Community VLAN ID: 3
# 属于非隔离VLAN的Host B和D可以互通。Host A和C之间不能通讯。
· Device A
#
vlan 1
#
vlan 2 to 3
#
port-isolate group 1
community-vlan vlan 3
#
interface GigabitEthernet1/0/1
port link-mode bridge
port link-type trunk
port trunk permit vlan 1 to 3
#
interface GigabitEthernet1/0/2
port link-mode bridge
port link-type trunk
port trunk permit vlan 1 to 3
port-isolate enable group 1
#
interface GigabitEthernet1/0/3
port link-mode bridge
port link-type trunk
port trunk permit vlan 1 to 3
port-isolate enable group 1
#
· Device B、C
#
vlan 1
#
vlan 2 to 3
#
interface GigabitEthernet1/0/1
port link-mode bridge
port link-type trunk
port trunk permit vlan 1 to 3
#
interface GigabitEthernet1/0/2
port link-mode bridge
port access vlan 2
#
interface GigabitEthernet1/0/3
port link-mode bridge
port access vlan 3
#
· Device G
#
vlan 1
#
vlan 2 to 3
#
interface Vlan-interface2
ip address 10.0.2.1 255.255.255.0
#
interface Vlan-interface3
ip address 10.0.3.1 255.255.255.0
#
interface GigabitEthernet1/0/1
port link-mode bridge
port link-type trunk
port trunk permit vlan 1 to 3
#
· H3C S12500系列路由交换机 二层技术-以太网交换配置指导-Release 7328
· H3C S12500系列路由交换机 二层技术-以太网交换命令参考-Release 7328
不同款型规格的资料略有差异, 详细信息请向具体销售和400咨询。H3C保留在没有任何通知或提示的情况下对资料内容进行修改的权利!